示例#1
0
 public bool InsertUpdate(M_Client_Enterprise model)
 {
     if (model.Flow > 0)
     {
         UpdateByID(model);
     }
     else
     {
         insert(model);
     }
     return(true);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Call.HideBread(Master);
         if (Request.QueryString["menu"] != null && Request.QueryString["menu"] == "select")
         {
             int            id        = DataConverter.CLng(Request.QueryString["id"]);
             M_Client_Basic Binfo     = bll.GetSelect(id);
             string         types     = Binfo.Client_Type;
             string         Code      = Binfo.Code;
             string         scripttxt = "setvalue('TxtUserName','" + Binfo.P_name + "');";
             if (types == "0")
             {
                 DataTable ptable = pll.SelByCode(Binfo.Code);
                 if (ptable != null && ptable.Rows.Count > 0)
                 {
                     M_Client_Penson pinfo = pll.GetSelect(DataConverter.CLng(ptable.Rows[0]["Flow"]));
                     scripttxt += "setvalue('TxtUserTel','" + pinfo.Fax_phone + "');";
                     scripttxt += "setvalue('TxtUserMobile','" + pinfo.Work_Phone + "');";
                     scripttxt += "setvalue('TxtUserQQ','" + pinfo.QQ_Code + "');";
                     scripttxt += "setvalue('TxtUserMSN','" + pinfo.MSN_Code + "');";
                     scripttxt += "setvalue('TxtUserAddress','" + pinfo.Message_Address + "');";
                     scripttxt += "setvalue('TxtUserEmail','" + pinfo.Email_Address + "');";
                 }
                 function.Script(this, scripttxt + ";onstr();");
                 Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script", "<script>" + scripttxt + ";onstr();</script>");
             }
             else
             {
                 DataTable pstable = ell.SelByCode(Binfo.Code);
                 if (pstable != null && pstable.Rows.Count > 0)
                 {
                     M_Client_Enterprise einfo = ell.GetSelect(DataConverter.CLng(pstable.Rows[0]["Flow"]));
                     scripttxt += "setvalue('TxtUserTel','" + einfo.Phone + "');";
                     scripttxt += "setvalue('TxtUserMobile','" + einfo.Phone + "');";
                     scripttxt += "setvalue('TxtUserAddress','" + einfo.Message_Address + "');";
                 }
                 function.Script(this, scripttxt + ";onstr();");
             }
         }
         DataTable tables = bll.Select_All();
         tables.DefaultView.Sort = "Flow desc";
         Page_list(tables);
     }
 }
示例#3
0
 public bool GetInsert(M_Client_Enterprise model)
 {
     return(insert(model) > 0);
 }
示例#4
0
 public int insert(M_Client_Enterprise model)
 {
     return(Sql.insert(strTableName, model.GetParameters(model), BLLCommon.GetParas(model), BLLCommon.GetFields(model)));
 }
示例#5
0
 public bool UpdateByID(M_Client_Enterprise model)
 {
     return(Sql.UpdateByIDs(strTableName, PK, model.Flow.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters(model)));
 }
示例#6
0
 public bool GetUpdate(M_Client_Enterprise model)
 {
     return(UpdateByID(model));
 }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string node_id = Request.QueryString["FieldName"].ToString();
                if (node_id == "Client_All")
                {
                    Response.Write("<script>javascript:document.title='客户组别'</script>");
                    this.Label1.Text = "客户组别";
                }
                else if (node_id == "Phase_Trace")
                {
                    Response.Write("<script>javascript:document.title='客户阶段'</script>");
                    this.Label1.Text = "客户阶段";
                }


                DataSet table = new DataSet();
                table.ReadXml(Server.MapPath("/Config/CRM_Dictionary.xml"));
                DataTable AreaTable       = table.Tables["Client_Area"];
                DataTable StatusTable     = table.Tables["Co_Status"];
                DataTable CallingTable    = table.Tables["Client_Calling"];
                DataTable ValueTable      = table.Tables["Client_Value"];
                DataTable CreditTable     = table.Tables["Client_Credit"];
                DataTable ImportanceTable = table.Tables["Client_Importance"];
                DataTable ConnectionTable = table.Tables["Client_Connection"];
                DataTable SourceTable     = table.Tables["Client_Source"];
                DataTable PhaseTable      = table.Tables["Client_Phase"];
                DataTable GroupTable      = table.Tables["Client_Group"];
                DataTable SizeTable       = table.Tables["Co_Size"];//Co_Size
                DataTable ManagementTable = table.Tables["Co_Management"];
                DataTable EducationTable  = table.Tables["Linkman_Education"];
                DataTable IncomeTable     = table.Tables["Linkman_Income"];

                #region 定义选项默认值的变量及初始值
                string Areatxt       = "";
                string Statustxt     = "";
                string Callingtxt    = "";
                string Valuetxt      = "";
                string Credittxt     = "";
                string Importancetxt = "";
                string Connectiontxt = "";
                string Sourcetxt     = "";
                string Phasetxt      = "";
                string Grouptxt      = "";
                string Sizetxt       = "";
                string Managementtxt = "";
                string Educationtxt  = "";
                string Incometxt     = "";
                #endregion

                #region 赋予选项的默认值
                if (AreaTable != null && AreaTable.Rows.Count > 0)
                {
                    for (int o = 0; o < AreaTable.Rows.Count; o++)
                    {
                        if (AreaTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Areatxt = AreaTable.Rows[o]["sort"].ToString();
                        }
                    }
                }

                if (StatusTable != null && StatusTable.Rows.Count > 0)
                {
                    for (int o = 0; o < StatusTable.Rows.Count; o++)
                    {
                        if (StatusTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Statustxt = StatusTable.Rows[o]["sort"].ToString();
                        }
                    }
                }

                if (CallingTable != null && CallingTable.Rows.Count > 0)
                {
                    for (int o = 0; o < CallingTable.Rows.Count; o++)
                    {
                        if (CallingTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Callingtxt = CallingTable.Rows[o]["sort"].ToString();
                        }
                    }
                }

                if (ValueTable != null && ValueTable.Rows.Count > 0)
                {
                    for (int o = 0; o < ValueTable.Rows.Count; o++)
                    {
                        if (ValueTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Valuetxt = ValueTable.Rows[o]["sort"].ToString();
                        }
                    }
                }

                if (CreditTable != null && CreditTable.Rows.Count > 0)
                {
                    for (int o = 0; o < CreditTable.Rows.Count; o++)
                    {
                        if (CreditTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Credittxt = CreditTable.Rows[o]["sort"].ToString();
                        }
                    }
                }

                if (ImportanceTable != null && ImportanceTable.Rows.Count > 0)
                {
                    for (int o = 0; o < ImportanceTable.Rows.Count; o++)
                    {
                        if (ImportanceTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Importancetxt = ImportanceTable.Rows[o]["sort"].ToString();
                        }
                    }
                }

                if (ConnectionTable != null && ConnectionTable.Rows.Count > 0)
                {
                    for (int o = 0; o < ConnectionTable.Rows.Count; o++)
                    {
                        if (ConnectionTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Connectiontxt = ConnectionTable.Rows[o]["sort"].ToString();
                        }
                    }
                }

                if (SourceTable != null && SourceTable.Rows.Count > 0)
                {
                    for (int o = 0; o < SourceTable.Rows.Count; o++)
                    {
                        if (SourceTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Sourcetxt = SourceTable.Rows[o]["sort"].ToString();
                        }
                    }
                }

                if (PhaseTable != null && PhaseTable.Rows.Count > 0)
                {
                    for (int o = 0; o < PhaseTable.Rows.Count; o++)
                    {
                        if (PhaseTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Phasetxt = PhaseTable.Rows[o]["sort"].ToString();
                        }
                    }
                }

                if (GroupTable != null && GroupTable.Rows.Count > 0)
                {
                    for (int o = 0; o < GroupTable.Rows.Count; o++)
                    {
                        if (GroupTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Grouptxt = GroupTable.Rows[o]["sort"].ToString();
                        }
                    }
                }

                if (SizeTable != null && SizeTable.Rows.Count > 0)
                {
                    for (int o = 0; o < SizeTable.Rows.Count; o++)
                    {
                        if (SizeTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Sizetxt = SizeTable.Rows[o]["sort"].ToString();
                        }
                    }
                }

                if (ManagementTable != null && ManagementTable.Rows.Count > 0)
                {
                    for (int o = 0; o < ManagementTable.Rows.Count; o++)
                    {
                        if (ManagementTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Managementtxt = ManagementTable.Rows[o]["sort"].ToString();
                        }
                    }
                }
                if (EducationTable != null && EducationTable.Rows.Count > 0)
                {
                    for (int o = 0; o < EducationTable.Rows.Count; o++)
                    {
                        if (EducationTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Educationtxt = EducationTable.Rows[o]["sort"].ToString();
                        }
                    }
                }
                if (IncomeTable != null && IncomeTable.Rows.Count > 0)
                {
                    for (int o = 0; o < IncomeTable.Rows.Count; o++)
                    {
                        if (IncomeTable.Rows[o]["default_"].ToString() == "True")
                        {
                            Incometxt = IncomeTable.Rows[o]["sort"].ToString();
                        }
                    }
                }

                #endregion

                //DropArea.Text = "";// DataConverter.CLng(Areatxt);
                //DropStatusInField.Text = "";// DataConverter.CLng(Statustxt);
                //DropClientField.Text = "";//DataConverter.CLng(Callingtxt);
                //DropValueLevel.Text = "";//DataConverter.CLng(Valuetxt);
                //DropCreditLevel.Text = "";//DataConverter.CLng(Credittxt);
                //DropImportance.Text = "";//DataConverter.CLng(Importancetxt);
                //DropConnectionLevel.Text = "";//DataConverter.CLng(Connectiontxt);
                //DropSourceType.Text = "";//DataConverter.CLng(Sourcetxt);
                //DropPhaseType.Text = "";//DataConverter.CLng(Phasetxt);
                //DropGroupID.Text = "";//DataConverter.CLng(Grouptxt);
                DropCompanySize.Text     = ""; //DataConverter.CLng(Sizetxt);
                DropManagementForms.Text = ""; //DataConverter.CLng(Managementtxt);
                DropEducation.Text       = ""; //DataConverter.CLng(Educationtxt);
                DropIncome.Text          = ""; // DataConverter.CLng(Incometxt);


                int id = DataConverter.CLng(Request.QueryString["id"]);
                this.pid = id;
                M_Client_Basic binfo = basicBll.GetSelect(id);
                //htmlStr.Text = CreateHtml(selectedDT, true);
                //-----
                this.TxtClientName.Text  = binfo.P_name;
                this.Pro_name            = binfo.P_name;
                User_Title.InnerHtml     = binfo.P_name;
                this.TxtClientNum.Text   = binfo.Code;
                this.TxtShortedForm.Text = binfo.P_alias;
                this.ClientSelect.Text   = binfo.Client_Upper;
                //this.DropArea.Text = binfo.Client_Area;
                DataTable Calling = GetTableList("Client_Calling");
                try
                {
                    // this.DropClientField.Text = Calling.Rows[DataConverter.CLng(binfo.Client_Calling)]["content"].ToString();
                }
                catch
                { }
                //this.DropValueLevel.Text = binfo.Client_Value;
                //this.DropCreditLevel.Text = binfo.Client_Credit;
                //this.DropImportance.Text = binfo.Client_Importance;
                //this.DropConnectionLevel.Text = binfo.Client_Connection;
                //this.DropSourceType.Text = binfo.Client_Source;
                //this.DropPhaseType.Text = binfo.Client_Phase;
                //this.DropGroupID.Text = binfo.Client_Group;
                this.TxtRemark.Text = binfo.Title;

                //this.TxtCompany.Text = binfo.Unit_Name;
                //this.TxtDepartment.Text = binfo.Unit_Class;
                //this.TxtPosition.Text = binfo.Unit_Post;
                //this.TxtOperation.Text = binfo.Unit_Operation;
                //this.TxtCompanyAddress.Text = binfo.Unit_Address;
                //this.TxtTitle.Text = binfo.Unit_Title;

                ModelHtml.Text = "";
                //--模型字段处理
                var modelMod = modelBll.GetModelById(ModelID);
                if (modelMod != null && !string.IsNullOrEmpty(modelMod.TableName))
                {
                    DataTable contentDt = basicBll.GetContent(modelMod.TableName, binfo.ItemID);
                    ModelHtml.Text = fieldBll.InputallHtml(ModelID, 0, new ModelConfig()
                    {
                        Source  = ModelConfig.SType.Admin,
                        ValueDT = contentDt,
                        Mode    = ModelConfig.SMode.PreView
                    });
                }

                //binfo.Add_Name = ull.GetLogin().UserName;
                binfo.Add_Date = DateTime.Today;
                binfo.Title    = this.TxtRemark.Text;

                string scriptname = "";

                if (binfo.Client_Type == "1")
                {
                    this.Label1.Text     = "查看企业客户";
                    this.ClientType.Text = "企业客户";
                    function.Script(this, "window.onload=function(){isPerson('Enterprise_Add');}");
                    DataTable tablesd = bce.SelByCode(binfo.Code);
                    if (tablesd != null && tablesd.Rows.Count > 0)
                    {
                        int flowid = DataConverter.CLng(tablesd.Rows[0]["Flow"].ToString());
                        M_Client_Enterprise enterprise = bce.GetEnterpriseByCode(binfo.Code);
                        this.TxtBankAccount.Text       = enterprise.Bank_Code;
                        this.TxtBankOfDeposit.Text     = enterprise.Bank_Open;
                        this.DropManagementForms.Text  = enterprise.Co_Management;
                        this.DropCompanySize.Text      = enterprise.Co_Size;
                        this.DropStatusInField.Text    = enterprise.Co_Status;
                        this.TxtClientNum.Text         = enterprise.Code;
                        this.TxtTaxNum.Text            = enterprise.Tax_Code;
                        this.TxtAnnualSales.Text       = enterprise.Sales.ToString();
                        this.TxtRegisteredCapital.Text = enterprise.Reg_Capital.ToString();
                        this.TxtBusinessScope.Text     = enterprise.Operation_Bound;
                        this.TxtHomepage1.Text         = enterprise.Homepage;
                        this.TxtFax1.Text     = enterprise.Fax_phone;
                        this.TxtPhone.Text    = enterprise.Phone;
                        this.TxtAddress.Text  = enterprise.Message_Address;
                        this.TxtZipCodeW.Text = enterprise.ZipCodeW;// //enterprise.ZipCodeW = Request.Form["TxtZipCodeW"];

                        this.country.Text  = enterprise.country;
                        this.province.Text = enterprise.province;
                        this.city.Text     = enterprise.city;
                        scriptname         = "document.getElementById(\"country\").value = \"" + enterprise.country + "\";";
                        scriptname        += "document.getElementById(\"province\").value = \"" + enterprise.province + "\";province_onchange(province,city);";
                        scriptname        += "document.getElementById(\"city\").value = \"" + enterprise.city + "\";";
                    }
                }
                else
                {
                    this.Label1.Text     = "查看个人客户";
                    this.ClientType.Text = "个人客户";
                    function.Script(this, "window.onload=function(){isPerson('Person_Add');}");
                    DataTable tables = bcp.SelByCode(binfo.Code.Trim());
                    if (tables != null && tables.Rows.Count > 0)
                    {
                        int             flowid = DataConverter.CLng(tables.Rows[0]["Flow"].ToString());
                        M_Client_Penson penson = bcp.GetSelect(flowid);
                        this.TxtClientNum.Text = penson.Code;

                        if (penson.Sex == "1")
                        {
                            this.RadlSex.Text = "男";
                        }
                        else if (penson.Sex == "1")
                        {
                            this.RadlSex.Text = "女";
                        }
                        else
                        {
                            this.RadlSex.Text = "保密";
                        }

                        switch (penson.Marriage.Trim())
                        {
                        case "":
                            this.RadlMarriage.Text = "保密";
                            break;

                        case "0":
                            this.RadlMarriage.Text = "保密";
                            break;

                        case "1":
                            this.RadlMarriage.Text = "离婚";
                            break;

                        case "2":
                            this.RadlMarriage.Text = "已婚";
                            break;

                        case "3":
                            this.RadlMarriage.Text = "离异";
                            break;
                        }
                        this.DpkBirthday.Text             = penson.Birthday.ToString();
                        this.TxtIDCard.Text               = penson.Id_Code;
                        this.TxtNativePlace.Text          = penson.Native;
                        this.TxtNation.Text               = penson.Nation;
                        this.DropEducation.Text           = penson.Education;
                        this.TxtGraduateFrom.Text         = penson.Finish_School;
                        this.TxtInterestsOfLife.Text      = penson.Life_Love;
                        this.TxtInterestsOfCulture.Text   = penson.Cultrue_Love;
                        this.TxtInterestsOfOther.Text     = penson.Other_Love;
                        this.TxtInterestsOfSport.Text     = penson.Sport_Love;
                        this.TxtInterestsOfAmusement.Text = penson.FUN_Love;
                        this.DropIncome.Text              = penson.Income.ToString();
                        this.TxtFamily.Text               = penson.Home_Circs;
                        this.TxtAim.Text         = penson.Aim_Code;
                        this.TxtFax.Text         = penson.Fax_phone;
                        this.TxtAddress.Text     = penson.Message_Address;
                        this.TxtOfficePhone.Text = penson.Work_Phone;
                        this.TxtHomePhone.Text   = penson.Home_Phone;
                        this.TxtMobile.Text      = penson.Telephone;
                        this.TxtPHS.Text         = penson.Little_Smart;
                        this.TxtHomepage.Text    = penson.Homepage;
                        this.TxtEmail.Text       = penson.Email_Address;
                        this.TxtQQ.Text          = penson.QQ_Code;
                        this.TxtMSN.Text         = penson.MSN_Code;
                        this.TxtUC.Text          = penson.UC_Code;
                        this.TxtYahoo.Text       = penson.YaoHu_Code;
                        this.TxtICQ.Text         = penson.ICQ_Code;
                        this.TxtZipCodeW.Text    = penson.ZipCodeW;

                        this.country.Text  = penson.country;
                        this.province.Text = penson.province;
                        this.city.Text     = penson.city;

                        scriptname  = "document.getElementById(\"country\").value = \"" + penson.country + "\";";
                        scriptname += "document.getElementById(\"province\").value = \"" + penson.province + "\";province_onchange(province,city);";
                        scriptname += "document.getElementById(\"city\").value = \"" + penson.city + "\";";
                    }
                }
            }


            //DataTable tt = bpt.SelectByName(this.Pro_name);
            int typeid = DataConverter.CLng(Request.QueryString["type"]);
            if (typeid != 0)
            {
                //tt = bpt.SelectByName(this.Pro_name);
            }
            //if (tt != null)
            //{
            //    tt.DefaultView.Sort = "ID desc";
            //    Bind(tt);
            //}
            Call.SetBreadCrumb(Master, "<li>CRM管理</li><li><a href='CustomerList.aspx?usertype=0'>客户管理</a></li><li>" + Label1.Text + "</li>");
        }