protected void btnDeletetemp_Command(object sender, CommandEventArgs e)
        {
            string id = e.CommandArgument.ToString();

            WX.CRM.ContactTemp.MODEL contact = WX.CRM.ContactTemp.GetModel("SELECT * FROM CRM_ContactTemp WHERE ContactID=" + id);
            int row;

            if (contact == null)
            {
                contact = WX.CRM.ContactTemp.GetModel("SELECT * FROM CRM_Contact WHERE ID=" + id);
                contact.ContactID.value = id;
                contact.State.value     = -1;
                row = contact.Insert();
            }
            else
            {
                contact.State.value      = -1;
                contact.CheckState.value = 0;
                row = contact.Update();
            }
            if (row > 0)
            {
                WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(contact.CustomerID.ToString());
                WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 10, "申请删除(" + contact.ContactName.ToString() + ")");
                WX.Main.AddLog(WX.LogType.Default, "客户联系人信息删除申请!", null);
                ULCode.Debug.Alert("删除信息申请成功!", "Crm_Single_AddContact.aspx?PageMode=" + Request["PageMode"] + "&Action=Add&CustomerID=" + WX.Request.rCustomerID);
            }
            else
            {
                ULCode.Debug.Alert("删除信息申请失败!", "Crm_Single_AddContact.aspx?PageMode=" + Request["PageMode"] + "&Action=Add&CustomerID=" + WX.Request.rCustomerID);
            }
        }
Ejemplo n.º 2
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     WX.CRM.ContactTemp.MODEL contacttemp = WX.CRM.ContactTemp.NewDataModel(Request["ContactTempID"]);
     if (contacttemp.State.ToInt32() == -1)
     {
         WX.Main.ExecuteDelete("CRM_Contact", "ID", contacttemp.ContactID.ToString());
         contacttemp.Delete();
     }
     else
     {
         WX.CRM.Contact.MODEL contact = getnew();
         if (contact.ID.ToInt32() > 0)
         {
             contact.Update();
         }
         else
         {
             contact.Insert();
         }
     }
     WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(contacttemp.CustomerID.ToString());
     contacttemp.Delete();
     mes = "butsumit();";
     WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 5, "通过");
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!ULCode.Validation.IsNumber(Request.QueryString["ContactID"]))
         {
             return;
         }
         string contactId = Request.QueryString["ContactID"];
         WX.CRM.Contact.MODEL  contact  = WX.Request.rContact;
         WX.CRM.Customer.MODEL customer = WX.CRM.Customer.GetModel("select * from CRM_Customers where ID=" + contact.CustomerID.ToString());
         this.lblCustomerName.Text  = "<a style='color:#888;' href='Crm_ShowCustomerInfo.aspx?CustomerID=" + customer.ID.ToString() + "'>" + customer.CustomerName.ToString() + " << </a>";
         this.lblContactName.Text   = contact.ContactName.ToString();
         this.lblSex.Text           = contact.Sex.ToString();
         this.lblAge.Text           = contact.Age.ToString();
         this.lblWorkPhone.Text     = contact.WorkPhone.ToString();
         this.lblMobilePhone.Text   = contact.MobilePhone.ToString();
         this.lblEmail.Text         = contact.Email.ToString();
         this.lblFamilyPhone.Text   = contact.FamilyPhone.ToString();
         this.lblFax.Text           = contact.Fax.ToString();
         this.lblBirthday.Text      = contact.Birthday.ToString();
         this.lblHobby.Text         = contact.Hobby.ToString();
         this.lblBabyBirthday.Text  = contact.BabyBirthday.ToString();
         this.lblBabySex.Text       = contact.BabySex.ToString();
         this.lblWorkAddress.Text   = contact.WorkAddress.ToString();
         this.lblFamilyAddress.Text = contact.FamilyAddress.ToString();
         this.lblRemarks.Text       = contact.Remarks.ToString();
         if (!string.IsNullOrEmpty(contact.CardPath.ToString()))
         {
             this.imgPhoto.ImageUrl = "../../" + contact.CardPath.ToString();
         }
     }
 }
        protected void btnCancelShare_Command(object sender, CommandEventArgs e)
        {
            string customerId = e.CommandArgument.ToString();

            WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(customerId);
            customer.IsShare.value = 0;
            customer.Update();
            WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 6, "撤销共享");
            InitCustomerRepeater(false);
        }
Ejemplo n.º 5
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     WX.CRM.ContactTemp.MODEL contacttemp = WX.CRM.ContactTemp.NewDataModel(Request["ContactTempID"]);
     WX.CRM.Customer.MODEL    customer    = WX.CRM.Customer.NewDataModel(contacttemp.CustomerID.ToString());
     contacttemp.CheckState.set(-1);
     contacttemp.CheckUserID.value = WX.Main.CurUser.UserID;
     contacttemp.Update();
     mes = "butsumit();";
     WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 5, "未通过");
 }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //1.验证用户权限
            if (!this.Master.A_Edit)
            {
                Response.Write("你没有权限访问此功能!");
                Response.End();
                return;
            }
            //2.取得用户变量
            WX.CRM.ContactTemp.MODEL contact = WX.CRM.ContactTemp.NewDataModel();
            contact.CustomerID.value    = WX.Request.rCustomerID;
            contact.ContactName.value   = this.txtContactName.Text.Trim();
            contact.Dept.value          = this.txtDept.Text.Trim();
            contact.Duty.value          = this.txtDuty.Text.Trim();
            contact.IsMain.value        = Convert.ToInt32(this.cbIsMain.Checked);
            contact.Sex.value           = this.rblSex.SelectedItem.Value;
            contact.Email.value         = this.txtEmail.Text.Trim();
            contact.FamilyPhone.value   = this.txtFamilyPhone.Text.Trim();
            contact.MobilePhone.value   = this.txtMobilePhone.Text.Trim();
            contact.Fax.value           = this.txtFax.Text.Trim();
            contact.WorkPhone.value     = this.txtWorkPhone.Text.Trim();
            contact.Birthday.value      = this.txtBirthday.Text.Trim();
            contact.Hobby.value         = this.txtHobby.Text.Trim();
            contact.BabySex.value       = this.ddlBabySex.SelectedValue;
            contact.BabyBirthday.value  = this.txtBabyBirthday.Text.Trim();
            contact.WorkAddress.value   = this.txtWorkAddress.Text.Trim();
            contact.FamilyAddress.value = this.txtFamilyAddress.Text.Trim();
            contact.CardPath.value      = this.txtCardPath.Text.Trim();
            contact.PhotoPath.value     = this.txtPhotoPath.Text.Trim();
            contact.Remarks.value       = this.txtRemarks.Text.Trim();
            contact.State.value         = 0;
            //3.验证用户变量,包含Request.QueryString及Request.Form
            //4.业务处理过程
            int row = contact.Save();

            //填写主要业务逻辑代码
            //5.(用户及业务对象)统计与状态

            //6.登记日志
            if (row > 0)
            {
                WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(WX.Request.rCustomerID);
                WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 3, contact.ContactName.ToString());

                ULCode.Debug.Confirm("客户联系人信息添加成功!是否继续添加联系人信息?", "Crm_Single_AddContact.aspx?PageMode=" + Request["PageMode"] + "&Action=Add&CustomerID=" + WX.Request.rCustomerID, "Crm_My_CustomerToCheck.aspx");
            }
            else
            {
                ULCode.Debug.Alert("客户信息添加失败!", null);
            }
        }
Ejemplo n.º 7
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string idlist = this.Request.Form["checksel"];

            string[] ids = idlist.Split(',');
            for (int i = 0; i < ids.Length; i++)
            {
                WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(ids[i]);
                WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 7, "由(" + WX.CommonUtils.GetDeptNameListByDeptIdList(customer.DeptId.ToString()) + "--" + WX.CommonUtils.GetRealNameListByUserIdList(customer.EmployeeID.ToString()) + ")移交给(" + ddlUser.SelectedItem.Text + ")");
            }
            WX.Main.ExcuteUpdate("CRM_Customers", "EmployeeID='" + ddlUser.SelectedValue + "'", "ID in(" + idlist + ")");
            InitCustomerRepeater(true);
        }
        protected void btnDelete_Command(object sender, CommandEventArgs e)
        {
            string customerId = e.CommandArgument.ToString();

            WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(customerId);
            customer.State.value = -1;
            int row = customer.Update();

            WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 8, "");
            if (row > 0)
            {
                mes = "window.alert('客户信息已成功废弃!');"; InitCustomerRepeater(false);
            }
        }
Ejemplo n.º 9
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     WX.CRM.Customer.MODEL model = WX.CRM.Customer.NewDataModel(e.CommandArgument);
     if (e.CommandName == "state1")
     {
         model.State.value = -1;
     }
     else
     {
         model.State.value = 2;
     }
     model.UpTime.value = DateTime.Now;
     model.Update();
     WX.CRM.Customer.AddLog(model.ID.ToInt32(), model.CustomerName.ToString(), WX.Main.CurUser.UserID, 13, model.State.ToInt32() == 2?"不通过":"通过");
     InitRecycle();
 }
Ejemplo n.º 10
0
        protected void Gv_customer_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "del3")
            {
            }
            else
            {
                WX.CRM.Track.MODEL    track    = WX.CRM.Track.NewDataModel(e.CommandArgument.ToString());
                WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(track.CustomerID);

                track.Type.value = e.CommandName == "del" ? 1 : -1;

                track.Update();
                WX.CRM.Customer.AddLog(track.CustomerID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 14, WX.CRM.Track.ProcessState[track.ProcessState.ToInt32()] + "--" + e.CommandName == "del" ? "通过" : "未通过");

                InitTrack();
            }
        }
        protected void btnEdit_Command(object sender, CommandEventArgs e)
        {
            string customerId = e.CommandArgument.ToString();

            WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(customerId);
            customer.State.value      = 2;
            customer.DeptId.value     = WX.Main.CurUser.UserModel.DepartmentID.value;
            customer.EmployeeID.value = WX.Main.CurUser.UserID;
            customer.IsShare.value    = 0;
            customer.UpTime.value     = DateTime.Now;
            int row = customer.Update();

            WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 9, "");
            if (row > 0)
            {
                mes = "window.alert('客户信息已成功回收!');"; InitCustomerRepeater(false);
            }
        }
        protected void btnDelete_Command(object sender, CommandEventArgs e)
        {
            string id   = e.CommandArgument.ToString();
            string sSql = "DELETE FROM CRM_ContactTemp WHERE ID=" + id;
            int    row  = XSql.Execute(sSql);

            if (row > 0)
            {
                WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(WX.Request.rCustomerID);
                WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 10, "删除未审核的联系人");
                WX.Main.AddLog(WX.LogType.Default, "客户联系人信息删除成功!", null);
                ULCode.Debug.Alert("联系人信息删除成功!", "Crm_Single_AddContact.aspx?PageMode=" + Request["PageMode"] + "&Action=Add&CustomerID=" + WX.Request.rCustomerID);
            }
            else
            {
                ULCode.Debug.Alert("联系人信息删除失败!", "Crm_Single_AddContact.aspx?PageMode=" + Request["PageMode"] + "&Action=Add&CustomerID=" + WX.Request.rCustomerID);
            }
        }
Ejemplo n.º 13
0
 protected void Gv_customer_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "del")
     {
         WX.CRM.Track.MODEL    track    = WX.CRM.Track.NewDataModel(e.CommandArgument.ToString());
         WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(track.CustomerID.ToString());
         WX.Main.ExecuteDelete("CRM_CustomerProgram", "TrackID", track.id.ToString());
         track.Delete();
         WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 11, "删除“" + WX.CRM.Track.ProcessState[track.ProcessState.ToInt32()] + "”");
     }
     else
     {
         WX.CRM.Track.MODEL track = WX.CRM.Track.NewDataModel(e.CommandArgument.ToString());
         track.State.value     = 1;
         track.TrackTime.value = DateTime.Now;
         track.Update();
     }
     pageInit(false);
 }
Ejemplo n.º 14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         string mode = Request.QueryString["PageMode"];
         if (mode == "my")
         {
             this.lblTitle.Text = "我的客户";
             this.MenuBar1.Key  = "MyCustomer-Modi";
         }
         else if (mode == "manager")
         {
             this.lblTitle.Text = "我的管理";
             this.MenuBar1.Key  = "Customer-Modi";
         }
         else
         {
             this.lblTitle.Text = "我的管理";
             this.MenuBar1.Key  = "Customer-Modi-Maintain";
         }
         // Response.Write(Request["CustomerID"].Trim().Length); return;
         if (Request["CustomerID"] != null && Request["CustomerID"].Trim().Length > 0)
         {
             this.MenuBar1.Param1 = "{Q:CustomerID}";
             WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(WX.Request.rCustomerID);
             Literal1.Text = customer.CustomerID.ToString();
             Literal2.Text = customer.CustomerName.ToString();
             Literal3.Text = ULCode.QDA.XSql.GetDataTable("select StageName from CRM_Stage where ID=" + customer.StageID.ToString()).Rows[0][0].ToString();
         }
         else if (Request["UserID"] != null && Request["UserID"] != "")
         {
             div1.Visible   = false;
             div2.InnerHtml = "当前查看用户:<b>" + WX.CommonUtils.GetRealNameListByUserIdList(Request["UserID"]) + "</b>";
         }
         else
         {
             div1.Visible = false;
             div2.Visible = false;
         }
         pageInit(true);
     }
 }
        private void InitData()
        {
            WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel();
            string customerId = (string)XSql.GetValue("SELECT TOP 1 CustomerID FROM CRM_Customers ORDER BY ID DESC");

            this.txtCustomerID.Text = customer.CreateCustomerID(customerId);

            WX.Data.Dict.BindListCtrl_InnerCategory(this.ddlCustomerCategory, null, "#--请选择客户内部类型--", null);
            WX.Data.Dict.BindListCtrl_CompanyNature(this.ddlCompanyNature, null, "#--请选择客户性质--", null);
            WX.Data.Dict.BindListCtrl_Source(this.ddlSource, null, "#--请选择客户来源--", null);
            WX.Data.Dict.BindListCtrl_Industry(this.ddlIndustry, null, "#--请选择客户行业--", null);

            var province = XSql.GetDataTable("SELECT code,name FROM CRM_Province");

            this.ddlProvince.DataSource     = province;
            this.ddlProvince.DataTextField  = "name";
            this.ddlProvince.DataValueField = "code";
            this.ddlProvince.DataBind();
            this.ddlProvince.Items.Insert(0, new ListItem("--请选择--", "0"));
        }
Ejemplo n.º 16
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            WX.CRM.Customer.MODEL customer = getnew();
            customer.State.set(2);
            customer.CheckUserId.value = WX.Main.CurUser.UserID;
            customer.UpTime.value      = DateTime.Now;
            if (customer.ID.ToInt32() > 0)
            {
                customer.Update();
            }
            else
            {
                customer.Insert();
            }

            WX.CRM.CustomerTemp.MODEL customertemp = WX.Request.rCustomerTempToTempID;
            customertemp.Delete();
            mes = "butsumit();";
            WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), customer.CheckUserId.ToString(), 2, "通过");
        }
Ejemplo n.º 17
0
        public void PageInit()
        {
            System.Net.WebClient wc = new System.Net.WebClient();
            byte[] buff             = wc.DownloadData(Server.MapPath("AgreementTemp/Default.htm"));
            FORM_CONTENT.Value = System.Text.Encoding.GetEncoding("utf-8").GetString(buff);
            WX.CRM.Customer.MODEL customer = WX.CRM.Customer.GetModel("select * from CRM_Customers where ID=(select CustomerID from CRM_Track where ID=" + Request["TrackID"] + ")");
            if (customer != null)
            {
                FORM_CONTENT.Value = FORM_CONTENT.Value.Replace("$CustomerName", customer.CustomerName.ToString()).Replace("$jiafang", customer.CustomerName.ToString());
            }
            WX.Main.CurUser.LoadMyCompany();
            FORM_CONTENT.Value = FORM_CONTENT.Value.Replace("$yifang", WX.Main.CurUser.MyCompany.Name.ToString());
            string product = "";
            string allfee  = "";

            if (Request["TrackID"] != null && Request["TrackID"] != "")
            {
                WX.CRM.CustomerAgreement.MODEL agreement = WX.CRM.CustomerAgreement.GetModel("SELECT * FROM CRM_CustomerAgreement where TrackID=" + Request["TrackID"]);
                if (agreement != null)
                {
                    allfee = agreement.AllFee.ToString();
                    string sql = "SELECT * FROM CRM_CustomerProducts where PID=" + agreement.id.ToString() + " and Type=2";
                    System.Data.DataTable dt = ULCode.QDA.XSql.GetDataTable(sql);
                    if (dt.Rows.Count > 0)
                    {
                        product = "<table border='1' cellpadding=\"0\" cellspacing=\"0\" style='width:100%;'>\n <tr style=\"text-align: center;height:30px; font-weight: bold;\">\n<td>\n 合作形式\n</td>\n<td>\n服务内容\n</td>\n<td>\n报价\n</td>\n<td>\n 其它补充\n</td>\n </tr>";
                    }
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        product += "<tr>\n<td height='28' align=\"left\">\n" + dt.Rows[i]["ProductName"] + "</td>\n<td width=\"200\">\n" + dt.Rows[i]["Services"] + "</td>\n<td>\n" + dt.Rows[i]["ZDFee"] + "</td>\n<td>\n" + dt.Rows[i]["Remarks"] + "</td>\n</tr>";
                    }
                    product = product == "" ? "" : product + "</table>";
                }
            }
            FORM_CONTENT.Value = FORM_CONTENT.Value.Replace("$Products", product).Replace("$AllFee", allfee.ToString());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //1.验证当前用户页面权限
            if (!this.Master.A_Edit)
            {
                Response.Write("你没有权限访问此功能!");
                Response.End();

                return;
            }
            if (!IsPostBack)
            {
                string mode = Convert.ToString(Request.QueryString["PageMode"]);
                if (mode == "my")
                {
                    this.lblTitle.Text = "我的客户";
                    this.MenuBar1.Key  = "MyCustomer-Modi";
                }
                else
                {
                    this.lblTitle.Text = "我的管理";
                    this.MenuBar1.Key  = "Customer-Modi";
                }
                //2.取得用户变量
                InitData();
                string id = WX.Request.rCustomerID.ToString();

                WX.CRM.CustomerTemp.MODEL customer;
                if (Request["PageMode"] != null && Request["PageMode"] == "mycheck")
                {
                    customer = WX.Request.rCustomerTempToRCID;
                }
                else
                {
                    customer = WX.Request.rCustomerTempToCID;
                    if (customer == null)
                    {
                        customer = WX.Request.rCustomerTempToRCID;
                    }
                    if (customer == null)
                    {
                        customer = WX.Request.rCustomerTempToCustomer;
                    }
                }
                WX.CRM.Customer.MODEL customermodel = WX.Request.rCustomer;
                //---客户基本信息
                this.txtCustomerID.Text   = customer.CustomerID.ToString();
                Label0.Text               = txtCustomerID.Text != customermodel.CustomerID.ToString() ? "已修改未审核!" : "";
                this.txtCustomerName.Text = customer.CustomerName.ToString();
                Label1.Text               = txtCustomerName.Text != customermodel.CustomerName.ToString() ? "已修改未审核!" : "";
                this.txtCustomerZJM.Text  = customer.CustomerZJM.ToString();
                Label2.Text               = txtCustomerZJM.Text != customermodel.CustomerZJM.ToString() ? "已修改未审核!" : "";
                this.ddlCustomerCategory.SelectedValue = customer.CategoryID.ToString();
                Label5.Text = customer.CategoryID.ToString() != customermodel.CategoryID.ToString() ? "已修改未审核!" : "";
                this.ddlCompanyNature.SelectedValue = customer.NatureID.ToString();
                Label3.Text = customer.NatureID.ToString() != customermodel.NatureID.ToString() ? "已修改未审核!" : "";
                this.ddlSource.SelectedValue = customer.SourceID.ToString();
                Label6.Text = customer.SourceID.ToString() != customermodel.SourceID.ToString() ? "已修改未审核!" : "";
                this.ddlIndustry.SelectedValue = customer.IndustryID.ToString();
                Label4.Text = customer.IndustryID.ToString() != customermodel.IndustryID.ToString() ? "已修改未审核!" : "";
                //this.ddlProvince.SelectedValue = customer.Province.ToString();
                //this.hidden_city.Value = customer.City.ToString();
                //this.hidden_area.Value = customer.Area.ToString();
                //---添加地区
                if (customer.Province.ToString() != "0")
                {
                    this.ddlProvince.SelectedValue = customer.Province.ToString();
                }
                if (customer.City.ToString() != "0" && customer.City.ToString() != "" && customer.Province.ToString() != "0" && customer.Province.ToString() != "")
                {
                    this.hidden_city.Value = customer.City.ToString();
                    this.ddlCity.Attributes.Remove("disabled");
                    this.ddlCity.Items.Clear();
                    this.ddlCity.Items.Add(new ListItem("--请选择--", "0"));
                    DataTable cityData  = XSql.GetDataTable("SELECT code,name FROM CRM_City WHERE ProvinceId=" + customer.Province.ToString());
                    var       cityItems = cityData.AsEnumerable().Select(city => new ListItem
                    {
                        Text     = city.Field <string>("name"),
                        Value    = city.Field <string>("code"),
                        Selected = city.Field <string>("code").ToString() == customer.City.ToString() ? true : false
                    });
                    foreach (var item in cityItems)
                    {
                        this.ddlCity.Items.Add(item);
                    }
                }
                if (customer.City.ToString() != "0" && customer.Area.ToString() != "0" && customer.City.ToString() != "" && customer.Area.ToString() != "")
                {
                    this.hidden_area.Value = customer.Area.ToString();
                    this.ddlArea.Attributes.Remove("disabled");
                    this.ddlArea.Items.Clear();
                    this.ddlArea.Items.Add(new ListItem("--请选择--", "0"));
                    DataTable areaData  = XSql.GetDataTable("SELECT code,name FROM CRM_Area WHERE CityId=" + customer.City.ToString());
                    var       areaItems = areaData.AsEnumerable().Select(area => new ListItem
                    {
                        Text     = area.Field <string>("name"),
                        Value    = area.Field <string>("code"),
                        Selected = area.Field <string>("code").ToString() == customer.Area.ToString() ? true : false
                    });
                    foreach (var item in areaItems)
                    {
                        this.ddlArea.Items.Add(item);
                    }
                }
                this.txtAddress.Text = customer.Address.ToString();
                Label7.Text          = customer.Province.ToString() + customer.City.ToString() + customer.Area.ToString() + txtAddress.Text != customermodel.Province.ToString() + customermodel.City.ToString() + customermodel.Area.ToString() + customermodel.Address.ToString() ? "已修改未审核!" : "";
                this.txtWebSite.Text = customer.WebSite.ToString();
                Label8.Text          = txtWebSite.Text != customermodel.WebSite.ToString() ? "已修改未审核!" : "";
                //this.hidden_imagePath.Value = customer.ImagePath.ToString();
                //---客户营业信息
                this.txtEstablishmentDate.Text = customer.EstablishmentDate.ToString();
                Label9.Text                  = txtEstablishmentDate.Text != customermodel.EstablishmentDate.ToString() ? "已修改未审核!" : "";
                this.txtRealName.Text        = customer.RealName.ToString();
                Label10.Text                 = txtRealName.Text != customermodel.RealName.ToString() ? "已修改未审核!" : "";
                this.txtBankName.Text        = customer.BankName.ToString();
                Label11.Text                 = txtBankName.Text != customermodel.BankName.ToString() ? "已修改未审核!" : "";
                this.txtBankAccount.Text     = customer.BankAccount.ToString();
                Label12.Text                 = customer.BankAccount.ToString() != customermodel.BankAccount.ToString() ? "已修改未审核!" : "";
                this.txtBusinessCircles.Text = customer.BusinessCircles.ToString();
                Label13.Text                 = txtBusinessCircles.Text != customermodel.BusinessCircles.ToString() ? "已修改未审核!" : "";
                this.txtProducts.Text        = customer.Products.ToString();
                Label14.Text                 = txtProducts.Text != customermodel.Products.ToString() ? "已修改未审核!" : "";
                //---客户合作信息
                this.ddlCoop.SelectedValue = customer.BusinessLevel.ToString();
                Label15.Text = customer.BusinessLevel.ToString() != customermodel.BusinessLevel.ToString() ? "已修改未审核!" : "";
                //customer.CoopFlag.Read(this.cblCoop, 1);
                this.ddlStage.SelectedValue = customer.StageID.ToString();
                Label16.Text = customer.StageID.ToString() != customermodel.StageID.ToString() ? "已修改未审核!" : "";
                //customer.BuyHabbit.Read(this.cblStage, 1);
                this.txtLastConsumptionMoney1.Text = customer.LastConsumptionMoney.ToString() == "" ? "0" :customer.LastConsumptionMoney.ToString();

                Label17.Text = customer.LastConsumptionMoney.ToString() != customermodel.LastConsumptionMoney.ToString() ? "已修改未审核!" : "";
                this.txtLastMaintainMoney1.Text = customer.LastMaintainMoney.ToString() == "" ? "0" : customer.LastMaintainMoney.ToString();
                Label18.Text = customer.LastMaintainMoney.ToString() != customermodel.LastMaintainMoney.ToString() ? "已修改未审核!" : "";
                this.txtConsumptionMoney1.Text = customer.ConsumptionMoney.ToString() == "" ? "0" : customer.ConsumptionMoney.ToString();
                Label21.Text = customer.ConsumptionMoney.ToString() != customermodel.ConsumptionMoney.ToString() ? "已修改未审核!" : "";
                this.txtMaintainMoney1.Text = customer.MaintainMoney.ToString() == "" ? "0" : customer.MaintainMoney.ToString();
                Label22.Text = customer.MaintainMoney.ToString() != customermodel.MaintainMoney.ToString() ? "已修改未审核!" : "";

                this.tCoolRecentStart.Text = customer.LastBegin.ToString();
                this.tCoolRecentEnd.Text   = customer.LastEnd.ToString();
                Label19.Text = customer.LastBegin.ToString() + customer.LastEnd.ToString() != customermodel.LastBegin.ToString() + customermodel.LastEnd.ToString() ? "已修改未审核!" : "";
                this.tAskPreMoneyDate.Text = customer.UrgerDate.ToString();
                this.txtPreMoney1.Text     = customer.PreMoney.ToString() == "" ? "0" : customer.PreMoney.ToString();
                Label20.Text = customer.PreMoney.ToString() + customer.UrgerDate.ToString() != customermodel.PreMoney.ToString() + customermodel.UrgerDate.ToString() ? "已修改未审核!" : "";
                //---客户其它信息
                this.txtRemarks.Text     = customer.Remarks.ToString();
                Label23.Text             = txtRemarks.Text != customermodel.Remarks.ToString() ? "已修改未审核!" : "";
                this.txtSpecialDesc.Text = customer.SpecialDesc.ToString();
                Label24.Text             = txtSpecialDesc.Text != customermodel.SpecialDesc.ToString() ? "已修改未审核!" : "";
                //---OA维护信息
                //无
            }
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WX.CRM.ContactTemp.MODEL contacttemp = WX.CRM.ContactTemp.NewDataModel(Request["ContactTempID"]);
                if (contacttemp == null)
                {
                    ULCode.Debug.we("contacttemp获取失败!请联系管理!");
                    return;
                }
                WX.CRM.Contact.MODEL contact = WX.CRM.Contact.NewDataModel(contacttemp.ContactID.ToString());
                if (contact != null)
                {
                    WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(contact.CustomerID.ToString());
                    if (customer != null)
                    {
                        liCustomerName.Text = customer.CustomerName.ToString();
                    }

                    this.liContactName.Text   = contact.ContactName.ToString();
                    this.liDept.Text          = contact.Dept.ToString();
                    this.liDuty.Text          = contact.Duty.ToString();
                    this.liSex.Text           = contact.Sex.ToString();
                    this.liEmail.Text         = contact.Email.ToString();
                    this.liFamilyPhone.Text   = contact.FamilyPhone.ToString();
                    this.liWorkPhone.Text     = contact.WorkPhone.ToString();
                    this.liFax.Text           = contact.Fax.ToString();
                    this.liMobilePhone.Text   = contact.MobilePhone.ToString();
                    this.liBirthday.Text      = contact.Birthday.ToString();
                    this.liHobby.Text         = contact.Hobby.ToString();
                    this.liBabySex.Text       = contact.BabySex.ToString() + "--" + contact.BabyBirthday.ToString();
                    this.liWorkAddress.Text   = contact.WorkAddress.ToString();
                    this.liFamilyAddress.Text = contact.FamilyAddress.ToString();
                    this.liCardPath.Text      = "<img src='" + contact.CardPath.ToString() + "'/>";
                    this.liPhotoPath.Text     = "<img src='" + contact.PhotoPath.ToString() + "'/>";
                    this.liRemarks.Text       = contact.Remarks.ToString();
                }
                if (contacttemp != null)
                {
                    this.txtContactName.Text      = contacttemp.ContactName.ToString();
                    this.txtDept.Text             = contacttemp.Dept.ToString();
                    this.txtDuty.Text             = contacttemp.Duty.ToString();
                    this.radSex.SelectedValue     = contacttemp.Sex.ToString();
                    this.txtEmail.Text            = contacttemp.Email.ToString();
                    this.txtFamilyPhone.Text      = contacttemp.FamilyPhone.ToString();
                    this.txtWorkPhone.Text        = contacttemp.WorkPhone.ToString();
                    this.txtFax.Text              = contacttemp.Fax.ToString();
                    this.txtMobilePhone.Text      = contacttemp.MobilePhone.ToString();
                    this.txtBirthday.Text         = contacttemp.Birthday.ToString();
                    this.txtHobby.Text            = contacttemp.Hobby.ToString();
                    this.ddlBabySex.SelectedValue = contacttemp.BabySex.ToString();
                    this.txtBabyBirthday.Text     = contacttemp.BabyBirthday.ToString();
                    this.txtWorkAddress.Text      = contacttemp.WorkAddress.ToString();
                    this.txtFamilyAddress.Text    = contacttemp.FamilyAddress.ToString();
                    this.tempCardPath.Text        = "<img src='" + contacttemp.CardPath.ToString() + "'/>";
                    this.tempPhotoPath.Text       = "<img src='" + contacttemp.PhotoPath.ToString() + "'/>";
                    this.txtRemarks.Text          = contacttemp.Remarks.ToString();
                    this.txtContactName.Enabled   = contact.ContactName.ToString() != contacttemp.ContactName.ToString();
                    this.txtDept.Enabled          = contact.Dept.ToString() != contacttemp.Dept.ToString();
                    this.txtDuty.Enabled          = contact.Duty.ToString() != contacttemp.Duty.ToString();
                    this.radSex.Enabled           = contact.Sex.ToString() != contacttemp.Sex.ToString();
                    this.txtEmail.Enabled         = contact.Email.ToString() != contacttemp.Email.ToString();
                    this.txtFamilyPhone.Enabled   = contact.FamilyPhone.ToString() != contacttemp.FamilyPhone.ToString();
                    this.txtWorkPhone.Enabled     = contact.WorkPhone.ToString() != contacttemp.WorkPhone.ToString();
                    this.txtFax.Enabled           = contact.Fax.ToString() != contacttemp.Fax.ToString();
                    this.txtMobilePhone.Enabled   = contact.MobilePhone.ToString() != contacttemp.MobilePhone.ToString();
                    this.txtBirthday.Enabled      = contact.Birthday.ToString() != contacttemp.Birthday.ToString();
                    this.txtHobby.Enabled         = contact.Hobby.ToString() != contacttemp.Hobby.ToString();
                    this.ddlBabySex.Enabled       = contact.BabySex.ToString() != contacttemp.BabySex.ToString();
                    this.txtBabyBirthday.Enabled  = contact.BabyBirthday.ToString() != contacttemp.BabyBirthday.ToString();
                    this.txtWorkAddress.Enabled   = contact.WorkAddress.ToString() != contacttemp.WorkAddress.ToString();
                    this.txtFamilyAddress.Enabled = contact.FamilyAddress.ToString() != contacttemp.FamilyAddress.ToString();
                    this.txtRemarks.Enabled       = contact.Remarks.ToString() != contacttemp.Remarks.ToString();
                }
            }
        }
Ejemplo n.º 20
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (ddlProcessState.SelectedValue == "4")
            {
                ccp.Visible = true;
            }
            else
            {
                ccp.Visible = false;
            }
            WX.CRM.Track.MODEL track;
            if (Request["TrackID"] != null && Request["TrackID"] != "")
            {
                track = WX.CRM.Track.NewDataModel(Request["TrackID"]);
            }
            else
            {
                track = WX.CRM.Track.NewDataModel();
                track.UserID.value = WX.Main.CurUser.UserID;
            }
            track.ProcessState.value = ddlProcessState.SelectedValue;
            track.CustomerID.value   = WX.Request.rCustomerID;
            track.TrackNo.value      = txtTrackNo.Text;
            track.Fee.value          = txtFee.Text;
            track.Remarks.value      = txtremark.Text + "|" + txtremark2.Text + "|" + txtremark3.Text + "|" + txtremark4.Text;
            track.IP.value           = System.Web.HttpContext.Current.Request.UserHostAddress;
            track.LogParaments.value = txtLogParaments.Text;
            track.Type.value         = 0;
            if (txtTrackTime.Text.Trim() == "")
            {
                mess = "Messages('跟踪时间必填!')";
                return;
            }
            track.TrackTime.value = txtTrackTime.Text;
            track.State.value     = rblstate.SelectedValue; //track.TrackTime.ToDateTime() < DateTime.Now ? 1 : 0;

            if (Request["TrackID"] != null && Request["TrackID"] != "")
            {
                track.Update();
                if (track.ProcessState.ToInt32() == 4)
                {
                    WX.CRM.CustomerProgram.MODEL programmodel = WX.CRM.CustomerProgram.GetModel("SELECT * FROM CRM_CustomerProgram where TrackID=" + Request["TrackID"]);
                    if (programmodel != null)
                    {
                        SetProgram(programmodel, track.id.ToInt32());
                    }
                }
                else if (track.ProcessState.ToInt32() == 5)
                {
                    WX.CRM.CustomerAgreement.MODEL agreementmodel = WX.CRM.CustomerAgreement.GetModel("SELECT * FROM CRM_CustomerAgreement where TrackID=" + Request["TrackID"]);
                    SetAgreement(agreementmodel, track.id.ToInt32());
                }
            }
            else
            {
                int trackid = track.Insert(true);
                if (track.ProcessState.ToInt32() == 4)
                {
                    WX.CRM.CustomerProgram.MODEL programmodel = WX.CRM.CustomerProgram.NewDataModel();
                    SetProgram(programmodel, trackid);
                }
                else if (track.ProcessState.ToInt32() == 5)
                {
                    WX.CRM.CustomerAgreement.MODEL agreementmodel = WX.CRM.CustomerAgreement.NewDataModel();
                    SetAgreement(agreementmodel, trackid);
                }
            }
            //当签订协议后更改促成方案的状态
            if (track.ProcessState.ToInt32() == 5 && track.State.ToInt32() == 1 && DropProgram.SelectedValue != "0")
            {
                WX.CRM.CustomerProgram.MODEL cprogram = WX.CRM.CustomerProgram.NewDataModel(DropProgram.SelectedValue);
                cprogram.State.value      = 1;
                cprogram.Updatetime.value = DateTime.Now;
                cprogram.Update();
            }
            WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(track.CustomerID.value);
            if (customer.StageID.ToInt32() == 0 && (track.ProcessState.ToInt32() == 0 || track.ProcessState.ToInt32() == 1))
            {
                customer.StageID.value = 1;
            }
            else if (customer.StageID.ToInt32() == 1 && (track.ProcessState.ToInt32() == 2 || track.ProcessState.ToInt32() == 3 || track.ProcessState.ToInt32() == 4))
            {
                customer.StageID.value = 2;
            }
            else if (customer.StageID.ToInt32() == 2 && (track.ProcessState.ToInt32() == 5 || track.ProcessState.ToInt32() == 6 || track.ProcessState.ToInt32() == 7 || track.ProcessState.ToInt32() == 8))
            {
                customer.StageID.value = 3;
            }
            else if (customer.StageID.ToInt32() == 3 && track.ProcessState.ToInt32() > 8)
            {
                customer.StageID.value = 4;
            }
            if (rblstate.SelectedValue == "1" && Convert.ToDouble(track.Fee.value) > 0)
            {
                WX.CRM.CustomerTemp.MODEL temp = WX.Request.rCustomerTempToCID;
                if (temp != null)
                {
                    temp.LastMaintainMoney.value = track.Fee.value;
                    temp.MaintainMoney.value     = Convert.ToDouble(temp.MaintainMoney.value) + Convert.ToDouble(track.Fee.value);
                    temp.Update();
                    customer.LastMaintainMoney.value = temp.LastMaintainMoney.value;
                    customer.MaintainMoney.value     = temp.MaintainMoney.value;
                }
                else
                {
                    customer.LastMaintainMoney.value = track.Fee.value;
                    customer.MaintainMoney.value     = Convert.ToDouble(customer.MaintainMoney.value) + Convert.ToDouble(track.Fee.value);
                }
            }
            customer.Update();

            WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 11, ddlProcessState.SelectedItem.Text);
            if (track.ProcessState.ToInt32() == 5)
            {
                Response.Redirect("CRM_SingleM_EditAgreement.aspx?TrackID=" + track.id.ToString());
            }
            else
            {
                WX.Main.CloseDialog_In_EasyUIDialog(this, "提交成功!");
            }
        }
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            //1.验证用户权限
            if (!this.Master.A_Edit)
            {
                Response.Write("你没有权限访问此功能!");
                Response.End();
                return;
            }
            //2.取得用户变量
            WX.CRM.ContactTemp.MODEL contact;
            bool flag = true;

            if (Request["ContactTempID"] != null && Request["ContactTempID"] != "")
            {
                contact = WX.CRM.ContactTemp.GetModel("SELECT * FROM CRM_ContactTemp WHERE ID=" + Request["ContactTempID"]);
            }
            else
            {
                contact = WX.CRM.ContactTemp.GetModel("SELECT * FROM CRM_ContactTemp WHERE ContactID=" + WX.Request.rContactID);
                if (contact == null)
                {
                    contact = WX.CRM.ContactTemp.GetModel("SELECT * FROM CRM_Contact WHERE ID=" + WX.Request.rContactID);
                    contact.ContactID.value = WX.Request.rContactID;
                    flag = false;
                }
            }
            if (contact == null)
            {
                ULCode.Debug.Alert(this, "没有找到此联系!修改失败!此错误请联系管理员!");
                return;
            }
            contact.CustomerID.value  = this.lblCustomerID.Text;
            contact.Dept.value        = this.txtDept.Text.Trim();
            contact.Duty.value        = this.txtDuty.Text.Trim();
            contact.ContactName.value = this.txtContactName.Text.Trim();
            contact.IsMain.value      = Convert.ToInt32(this.cbIsMain.Checked);
            contact.Sex.value         = this.rblSex.SelectedItem.Value;
            contact.Email.value       = this.txtEmail.Text.Trim();
            contact.FamilyPhone.value = this.txtFamilyPhone.Text.Trim();
            contact.MobilePhone.value = this.txtMobilePhone.Text.Trim();
            contact.Fax.value         = this.txtFax.Text.Trim();
            contact.WorkPhone.value   = this.txtWorkPhone.Text.Trim();
            try
            {
                contact.Birthday.value = this.txtBirthday.Text.Trim();
            }
            catch { }
            contact.Hobby.value         = this.txtHobby.Text.Trim();
            contact.BabySex.value       = this.ddlBabySex.SelectedValue;
            contact.BabyBirthday.value  = this.txtBabyBirthday.Text.Trim();
            contact.WorkAddress.value   = this.txtWorkAddress.Text.Trim();
            contact.FamilyAddress.value = this.txtFamilyAddress.Text.Trim();
            contact.CardPath.value      = this.txtCardPath.Text.Trim();
            contact.PhotoPath.value     = this.txtPhotoPath.Text.Trim();
            contact.Remarks.value       = this.txtRemarks.Text.Trim();
            contact.State.value         = 1;
            //3.验证用户变量,包含Request.QueryString及Request.Form
            //4.业务处理过程

            contact.CheckState.value = 0;
            int row;

            if (flag)
            {
                row = contact.Update();
            }
            else
            {
                row = contact.Insert();
            }
            //填写主要业务逻辑代码
            //5.(用户及业务对象)统计与状态

            //6.登记日志
            if (row > 0)
            {
                WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel(WX.Request.rCustomerID);
                WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 4, contact.ContactName.ToString());
                if (Request["ContactTempID"] != null && Request["ContactTempID"] != "")
                {
                    ULCode.Debug.Alert("客户联系人信息提交成功!", "/Manage/CRM/Crm_My_CustomerToCheck.aspx");
                }
                else
                {
                    ULCode.Debug.Confirm("客户联系人信息提交成功!", "Crm_Single_AddContact.aspx?PageMode=" + Request["PageMode"] + "&Action=Add&CustomerID=" + WX.Request.rCustomerID, "Crm_CustomerList.aspx");
                }
            }
            else
            {
                ULCode.Debug.Alert("客户信息提交失败!", "Crm_Single_AddContact.aspx?PageMode=" + Request["PageMode"] + "&Action=Edit&&ContactID=" + WX.Request.rContactID + "&CustomerID=" + WX.Request.rCustomerID + "");
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //1.验证用户权限
            if (!this.Master.A_Edit)
            {
                Response.Write("你没有权限访问此功能!");
                Response.End();
                return;
            }

            WX.CRM.Customer.MODEL cmodel = WX.CRM.Customer.GetModel("select * from CRM_Customers where  CustomerName='" + this.txtCustomerName.Text.Trim() + "'");
            if (cmodel != null && cmodel.ID.ToInt32() > 0)
            {
                mess = "alert('客户名称已被" + WX.CommonUtils.GetRealNameListByUserIdList(cmodel.EmployeeID.ToString()) + "录入,提交失败!');";
                return;
            }
            //2.取得用户变量

            WX.CRM.Customer.MODEL customer = WX.CRM.Customer.NewDataModel();
            //---客户基本信息
            customer.CustomerID.value   = this.txtCustomerID.Text.Trim();
            customer.CustomerName.value = this.txtCustomerName.Text.Trim();
            customer.CustomerZJM.value  = this.txtCustomerZJM.Text.Trim();
            customer.CategoryID.value   = this.ddlCustomerCategory.SelectedItem.Value;
            customer.NatureID.value     = this.ddlCompanyNature.SelectedItem.Value;
            customer.SourceID.value     = this.ddlSource.SelectedItem.Value;
            customer.IndustryID.value   = this.ddlIndustry.SelectedItem.Value;
            customer.Province.value     = this.ddlProvince.SelectedItem.Value;
            customer.City.value         = this.hidden_city.Value;
            customer.Area.value         = this.hidden_area.Value;
            customer.Address.value      = this.txtAddress.Text.Trim();
            customer.WebSite.value      = this.txtWebSite.Text.Trim();
            //customer.ImagePath.value = this.hidden_imagePath.Value;
            //---客户营业信息
            if (ULCode.Validation.IsDateTime(this.txtEstablishmentDate.Text))
            {
                customer.EstablishmentDate.value = this.txtEstablishmentDate.Text.Trim();
            }
            customer.RealName.value        = this.txtRealName.Text.Trim();
            customer.BankName.value        = this.txtBankName.Text.Trim();
            customer.BankAccount.value     = this.txtBankAccount.Text.Trim();
            customer.BusinessCircles.value = this.txtBusinessCircles.Text.Trim();
            customer.Products.value        = this.txtProducts.Text.Trim();

            //---客户其它信息
            customer.Remarks.value     = this.txtRemarks.Text.Trim();
            customer.SpecialDesc.value = this.txtSpecialDesc.Text.Trim();
            //---OA维护信息
            customer.CreateUserId.value = WX.Main.CurUser.UserID;
            customer.CreateDate.value   = DateTime.Now;
            customer.EmployeeID.value   = WX.Main.CurUser.UserID;
            WX.Main.CurUser.LoadUserModel(false);
            customer.DeptId.value = WX.Main.CurUser.UserModel.DepartmentID.value;
            customer.State.set(0);
            //3.验证用户变量,包含Request.QueryString及Request.Form
            //4.业务处理过程
            int row = customer.Insert(true);

            WX.CRM.CustomerTemp.MODEL customertemp = WX.CRM.CustomerTemp.GetModel("select * from CRM_Customers where ID=" + row);
            customertemp.CustomersID.value = row;
            customertemp.Insert();
            //填写主要业务逻辑代码
            //5.(用户及业务对象)统计与状态

            //6.登记日志
            //7.返回处理结果或返回其它页面。
            if (row > 0)
            {
                WX.Main.AddLog(WX.LogType.Default, "客户信息添加成功!", null);
                WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), customer.CreateUserId.ToString(), 0, "");
                ULCode.Debug.Alert("客户添加成功,还没有联系人请完善联系人!", "/Manage/CRM/Crm_Single_AddContact.aspx?PageMode=my&Action=Add&CustomerID=" + row);
                //ULCode.Debug.Confirm("客户信息添加成功!,您还没有添加联系人信息,是否添加联系人信息?", "Crm_AddContact.aspx?Action=Add&CustomerID=" + WX.Request.rCustomerID, "Crm_CustomerList.aspx");
            }
            else
            {
                ULCode.Debug.Alert("客户信息添加失败!", null);
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //1.验证用户权限
            if (!this.Master.A_Edit)
            {
                Response.Write("你没有权限访问此功能!");
                Response.End();
                return;
            }
            WX.CRM.Customer.MODEL cmodel = WX.CRM.Customer.GetModel("select * from CRM_Customers where ID!=" + WX.Request.rCustomerID + " and CustomerName='" + this.txtCustomerName.Text.Trim() + "'");
            if (cmodel != null && cmodel.ID.ToInt32() > 0)
            {
                ULCode.Debug.Alert("客户名称已被" + WX.CommonUtils.GetRealNameListByUserIdList(cmodel.EmployeeID.ToString()) + "录入,提交失败!", "Crm_Single_EditCustomer.aspx?PageMode=" + Request.QueryString["PageMode"] + "&CustomerID=" + WX.Request.rCustomerID);
                return;
            }
            //2.取得用户变量
            bool   flag = true;
            string id   = WX.Request.rCustomerID.ToString();

            WX.CRM.CustomerTemp.MODEL customer;
            customer = WX.Request.rCustomerTempToCID;
            if (customer == null)
            {
                customer = WX.Request.rCustomerTempToCustomer;
                customer.CustomersID.value = WX.Request.rCustomerID;
                flag = false;
            }
            //---客户基本信息
            customer.CustomerID.value   = this.txtCustomerID.Text.Trim();
            customer.CustomerName.value = this.txtCustomerName.Text.Trim();

            customer.CustomerZJM.value = this.txtCustomerZJM.Text.Trim();
            customer.CategoryID.value  = this.ddlCustomerCategory.SelectedValue;
            customer.NatureID.value    = this.ddlCompanyNature.SelectedValue;
            customer.SourceID.value    = this.ddlSource.SelectedValue;
            customer.IndustryID.value  = this.ddlIndustry.SelectedValue;
            customer.Province.value    = this.ddlProvince.SelectedValue;
            customer.City.value        = this.hidden_city.Value;
            customer.Area.value        = this.hidden_area.Value;
            customer.Address.value     = this.txtAddress.Text.Trim();
            customer.WebSite.value     = this.txtWebSite.Text.Trim();
            //customer.ImagePath.value = this.hidden_imagePath.Value;
            //---客户营业信息
            if (ULCode.Validation.IsDateTime(this.txtEstablishmentDate.Text))
            {
                customer.EstablishmentDate.value = this.txtEstablishmentDate.Text.Trim();
            }
            customer.RealName.value        = this.txtRealName.Text.Trim();
            customer.BankName.value        = this.txtBankName.Text.Trim();
            customer.BankAccount.value     = this.txtBankAccount.Text.Trim();
            customer.BusinessCircles.value = this.txtBusinessCircles.Text.Trim();
            customer.Products.value        = this.txtProducts.Text.Trim();
            //---客户合作信息
            customer.BusinessLevel.value = this.ddlCoop.SelectedValue;
            //customer.CoopFlag.Read(this.cblCoop, 1);
            customer.StageID.value = this.ddlStage.SelectedValue;
            //customer.BuyHabbit.Read(this.cblStage, 1);
            if (GetDecimal(this.txtLastConsumptionMoney1.Text))
            {
                customer.LastConsumptionMoney.value = decimal.Parse(this.txtLastConsumptionMoney1.Text);
            }
            else
            {
                Setmes("近期消费总额非数字!");
                return;
            }
            if (GetDecimal(this.txtLastMaintainMoney1.Text))
            {
                customer.LastMaintainMoney.value = decimal.Parse(this.txtLastMaintainMoney1.Text);
            }
            else
            {
                Setmes("近期维护费用非数字!");
                return;
            }
            if (GetDecimal(this.txtConsumptionMoney1.Text))
            {
                customer.ConsumptionMoney.value = decimal.Parse(this.txtConsumptionMoney1.Text);
            }
            else
            {
                Setmes("累计消费总额非数字!");
                return;
            }
            if (GetDecimal(this.txtMaintainMoney1.Text))
            {
                customer.MaintainMoney.value = decimal.Parse(this.txtMaintainMoney1.Text);
            }
            else
            {
                Setmes("累计维护费用非数字!");
                return;
            }
            if (GetDecimal(this.txtPreMoney1.Text))
            {
                customer.PreMoney.value = decimal.Parse(this.txtPreMoney1.Text);
            }
            else
            {
                Setmes("应收账款非数字!");
                return;
            }
            if (ULCode.Validation.IsDateTime(this.tCoolRecentStart.Text))
            {
                customer.LastBegin.value = Convert.ToDateTime(this.tCoolRecentStart.Text);
            }
            if (ULCode.Validation.IsDateTime(this.tCoolRecentEnd.Text))
            {
                customer.LastEnd.value = Convert.ToDateTime(this.tCoolRecentEnd.Text);
            }
            if (ULCode.Validation.IsDateTime(this.tAskPreMoneyDate.Text))
            {
                customer.UrgerDate.value = Convert.ToDateTime(this.tAskPreMoneyDate.Text);
            }
            //---客户其它信息
            customer.Remarks.value     = this.txtRemarks.Text.Trim();
            customer.SpecialDesc.value = this.txtSpecialDesc.Text.Trim();
            //---OA维护信息
            //customer.StartDate.value = DateTime.Now.ToString();

            customer.State.set(0);
            //3.验证用户变量,包含Request.QueryString及Request.Form
            //3.验证用户变量,包含Request.QueryString及Request.Form
            //4.业务处理过程

            customer.CreateUserId.value = customer.CreateUserId.ToString() != ""?customer.CreateUserId.value: WX.Main.CurUser.UserID;

            customer.CreateDate.value = customer.CreateDate.ToString() != ""?customer.CreateDate.value: DateTime.Now;
            customer.EmployeeID.value = customer.EmployeeID.ToString() != ""?customer.EmployeeID.value: WX.Main.CurUser.UserID;
            WX.Main.CurUser.LoadUserModel(false);
            customer.DeptId.value = customer.DeptId.ToString() != ""?customer.DeptId.value: WX.Main.CurUser.UserModel.DepartmentID.value;
            int row = 0;

            if (flag)
            {
                row = customer.Update();
            }
            else
            {
                row = customer.Insert();
            }

            //填写主要业务逻辑代码
            //5.(用户及业务对象)统计与状态

            //6.登记日志
            if (row > 0)
            {
                WX.Main.AddLog(WX.LogType.Default, "客户信息修改!", null);
                WX.CRM.Customer.AddLog(customer.ID.ToInt32(), customer.CustomerName.ToString(), WX.Main.CurUser.UserID, 1, "");
            }
            //7.返回处理结果或返回其它页面。
            string redericturl = "Crm_My_CustomerList.aspx";

            if (customer.EmployeeID.ToString() != WX.Main.CurUser.UserID)
            {
                redericturl = "Crm_Manage_CustomerList.aspx";
            }
            if (Request["type"] != null && Request["type"] != "")
            {
                redericturl = "Crm_My_CustomerToCheck.aspx";
            }
            if (row > 0)
            {
                ULCode.Debug.Alert("客户信息修改成功!", redericturl);
            }
            else
            {
                ULCode.Debug.Alert("客户信息添加失败!", redericturl);
            }
        }
        private void LoadData()
        {
            string id = WX.Request.rCustomerID.ToString();

            WX.CRM.Customer.MODEL customer = WX.Request.rCustomer;
            //---客户基本信息
            this.txtCustomerID.Text   = customer.CustomerID.ToString();
            this.txtCustomerName.Text = customer.CustomerName.ToString();
            this.txtCustomerZJM.Text  = customer.CustomerZJM.ToString();
            if (!customer.CategoryID.isEmpty)
            {
                this.ddlCustomerCategory.Text = XSql.GetData(customer.CategoryID.f("Select CategoryName from CRM_InnerCategory Where ID={0}")).ToString();
            }
            if (!customer.NatureID.isEmpty)
            {
                this.ddlCompanyNature.Text = XSql.GetData(customer.NatureID.f("Select CompanyNature from CRM_CompanyNature Where ID={0}")).ToStr();
            }
            if (!customer.SourceID.isEmpty)
            {
                this.ddlSource.Text = XSql.GetData(customer.SourceID.f("Select SourceName from CRM_Source Where ID={0}")).ToStr();
            }
            if (!customer.IndustryID.isEmpty)
            {
                this.ddlIndustry.Text = XSql.GetData(customer.IndustryID.f("Select IndustryName from CRM_Industry Where ID={0}")).ToStr();
            }
            this.txtAddress.Text = String.Format("{0}{1}{2} {3}"
                                                 , this.GetProvinceName(customer.Province.ToString())
                                                 , this.GetCityName(customer.City.ToString())
                                                 , this.GetAreaName(customer.Area.ToString())
                                                 , customer.Address);
            this.txtWebSite.Text        = customer.WebSite.ToString();
            this.hidden_imagePath.Value = customer.ImagePath.ToString();
            //---客户营业信息
            this.txtEstablishmentDate.Text = customer.EstablishmentDate.ToString();
            this.txtRealName.Text          = customer.RealName.ToString();
            this.txtBankName.Text          = customer.BankName.ToString();
            this.txtBankAccount.Text       = customer.BankAccount.ToString();
            this.txtBusinessCircles.Text   = customer.BusinessCircles.ToString();
            this.txtProducts.Text          = customer.Products.ToString();
            string sSql = "SELECT ID,Dept,Duty,IsMain,ContactName,MobilePhone,WorkPhone,FamilyPhone FROM CRM_Contact WHERE CustomerID=" + WX.Request.rCustomerID + " order by IsMain desc";

            System.Data.DataTable dataTable = XSql.GetDataTable(sSql);
            this.rptContacts.DataSource = dataTable;
            this.rptContacts.DataBind();
            sSql = "select top 5 * from CRM_Track where CustomerID=" + WX.Request.rCustomerID + " order by TrackTime desc";
            this.Repeater1.DataSource = XSql.GetDataTable(sSql);
            this.Repeater1.DataBind();
            //---客户合作信息
            if (!customer.BusinessLevel.isEmpty)
            {
                this.ddlCoop.Text = "<a href=\"Crm_My_CustomerList.aspx?bl=" + customer.BusinessLevel.ToString() + "\">" + XSql.GetData(customer.BusinessLevel.f("Select LevelName from CRM_BusinessLevel Where Id={0}")).ToStr() + "</a>";
            }
            customer.CoopFlag.Read(this.cblCoop, 1);
            if (!customer.StageID.isEmpty)
            {
                this.ddlStage.Text = "<a href=\"Crm_My_CustomerList.aspx?StageID=" + customer.StageID.ToString() + "\">" + XSql.GetData(customer.StageID.f("Select StageName from CRM_Stage Where ID={0}")).ToStr() + "</a>";
            }
            customer.BuyHabbit.Read(this.cblStage, 1);
            this.txtLastConsumptionMoney.Text = string.Format("{0:C2}", customer.LastConsumptionMoney.value);
            this.txtLastMaintainMoney.Text    = "<a href=\"/Manage/CRM/Crm_SingleM_ShowCustomerBusiness.aspx?PageMode=" + Request["PageMode"] + "&CustomerID=" + customer.ID.ToString() + "&fee=1\">" + string.Format("{0:C2}", customer.LastMaintainMoney.value) + "</a>";
            this.txtConsumptionMoney.Text     = string.Format("{0:C2}", customer.ConsumptionMoney.value);
            this.txtMaintainMoney.Text        = "<a href=\"/Manage/CRM/Crm_SingleM_ShowCustomerBusiness.aspx?PageMode=" + Request["PageMode"] + "&CustomerID=" + customer.ID.ToString() + "&fee=1\">" + string.Format("{0:C2}", customer.MaintainMoney.value) + "</a>";
            this.txtPreMoney.Text             = string.Format("{0:C2}", customer.PreMoney.value);

            this.tCoolRecentStart.Text = customer.LastBegin.ToString();
            this.tCoolRecentEnd.Text   = customer.LastEnd.ToString();
            this.tAskPreMoneyDate.Text = customer.UrgerDate.ToString();
            //---客户其它信息
            this.txtRemarks.Text     = customer.Remarks.ToString();
            this.txtSpecialDesc.Text = customer.SpecialDesc.ToString();
            //---OA维护信息
        }