⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 administer.aspx.cs

📁 客户关系管理系统 客户关系管理系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MyCRM.BLL;
using MyCRM.Models;

public partial class department_administer : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["User"] != null && Request.QueryString["chanceid"] != null)
            {
                int chanceid = int.Parse(Request.Params["chanceid"].ToString());
                DisplayInfo(chanceid);
                DisplayGrid(chanceid);
            }
        }
    }
    protected void DisplayInfo(int chanceid)
    {
        Sal_chance chance = ChanceManager.GetChanceById(chanceid);
        num.Text = chance.Chance_id.ToString();
        source.Text = chance.Chance_source;
        name.Text = chance.Chance_customer_name;
        title.Text = chance.Chance_title;
        jl.Text = chance.Chance_rate.ToString();
        lx.Text = chance.Chance_linkman;
        tel.Text = chance.Chance_tel;
        hap.Text = chance.Chance_desc;
        ren.Text = chance.Chance_create_by;
        time.Text = chance.Chance_create_date.ToString("yyyy年MM月dd日 HH时mm分ss秒");
        zp.Text = chance.Chance_due_to;
        zptime.Text = chance.Chance_due_date.ToString("yyyy年MM月dd日 HH时mm分ss秒");

    }
    protected void DisplayGrid(int chanceid)
    {
        GridView1.DataSource = PlanManager.GetPlanByChanceid(chanceid);
        GridView1.DataBind();
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        int chanceid = int.Parse(Request.Params["chanceid"].ToString());
        DisplayGrid(chanceid);
    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int chanceid = int.Parse(Request.Params["chanceid"].ToString());
        int planid = Convert.ToInt32(e.CommandArgument);
        if (e.CommandName == "edit")
        {
            TextBox txt = (TextBox)(this.GridView1.Rows[planid]).FindControl("txt");
            string n = txt.Text;
            int ab = int.Parse(txt.ToolTip);
            if (n != null)
            {
                PlanManager.UpdatePlanResult(n, ab);
            }
        }
    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        int chanceid = int.Parse(Request.Params["chanceid"].ToString());
        Response.Write("<script>alert('保存执行效果成功');location.href('administer.aspx?chanceid=" + chanceid + "');</script>");
    }
    protected void btnEnd_Click(object sender, EventArgs e)
    {
        int chanceid = int.Parse(Request.Params["chanceid"].ToString());
        Sal_chance chance = new Sal_chance();
        chance.Chance_status = "4";
        chance.Chance_id = chanceid;
        int result = ChanceManager.UpdateStatus(chance);
        if(result>0)
        {
            Response.Write("<script>alert('终止计划成功');location.href('plan.aspx');</script>");
        }
    }
    protected void btn_Click(object sender, EventArgs e)
    {
        int chanceid = int.Parse(Request.Params["chanceid"].ToString());
        Response.Redirect("constitute.aspx?chanceid=" + chanceid);
    }
    protected void btnSta_Click(object sender, EventArgs e)
    {
        int chanceid = int.Parse(Request.Params["chanceid"].ToString());

        Sal_chance chance = ChanceManager.GetChanceById(chanceid);
        Cst_customer customers = new Cst_customer();
        Random rd = new Random();
        customers.Customer_no = rd.Next().ToString().Substring(0, 6).Trim();
        customers.Customer_name = chance.Chance_customer_name;
        customers.Customer_region = "";
        customers.Customer_manager_id = chance.Chance_cue_id;
        customers.Customer_manager_name = chance.Chance_due_to;
        customers.Customer_level = 0;
        customers.Customer_level_label = "";
        customers.Customer_satisfy = 0;
        customers.Customer_credit = 0;
        customers.Customer_addr = "";
        customers.Customer_zip = "";
        customers.Customer_tel = "";
        customers.Customer_fax = "";
        customers.Customer_website = "";
        customers.Customer_licence_no = "";
        customers.Customer_chieftain = "";
        customers.Customer_bankroll = 0;
        customers.Customer_turnover = 0;
        customers.Customer_bank = "";
        customers.Customer_bank_account = "";
        customers.Customer_local_tax_no = "";
        customers.Customer_national_tax_no = "";
        customers.Customer_status = "1";
        CustomerManager.AddCustomer(customers);
        Cst_linkman link = new Cst_linkman();
        link.Customer = CustomerManager.GetCustomerByCustomerId(customers.Customer_no.Trim());
        link.Linkman_memo = "";
        link.Linkman_mobile = "";
        link.Linkman_tel = chance.Chance_tel;
        link.Linkman_sex = "男";
        link.Linkman_postion = "";
        link.Linkman_name = chance.Chance_linkman;
        LinkManManager.AddLinkman(link);
        chance.Chance_status = "3";
        chance.Chance_id = chanceid;
        int result = ChanceManager.UpdateStatus(chance);
        if (result > 0)
        {
            Response.Write("<script>alert('开发计划成功');location.href('plan.aspx');</script>");
        }
    }
    protected void btnExit_Click(object sender, EventArgs e)
    {
        int chanceid = int.Parse(Request.Params["chanceid"].ToString());
        Response.Redirect("constitute.aspx?chanceid=" + chanceid);
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Button save = (Button)e.Row.FindControl("save");
            save.CommandArgument = e.Row.RowIndex.ToString();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -