Esempio n. 1
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        int            id       = DataConverter.CLng(Request.QueryString["id"]);
        M_UserInfo     userinfo = Uinfo.GetUserByUserID(id);
        M_Uinfo        users    = Uinfo.GetUserBaseByuserid(id);
        B_Client_Basic bsc      = new B_Client_Basic();
        M_Client_Basic client   = new M_Client_Basic();
        //通过客户姓名获取客户信息
        DataTable dt = new DataTable();

        dt = bsc.SelByName(userinfo.UserName.Trim());
        if (dt == null || dt.Rows.Count <= 0) //如果找不到客户则升级
        {
            client.Flow          = 0;
            client.Client_Source = "在线注册";
            client.Client_Area   = users.Province;
            client.P_name        = userinfo.UserName;
            client.Add_Date      = DateTime.Now;
            client.Code          = DataSecurity.MakeFileRndName();
            client.Add_Name      = userinfo.TrueName;
            client.Title         = "在线注册";
            M_Client_Penson person  = new M_Client_Penson();
            B_Client_Penson bperson = new B_Client_Penson();
            person.Flow       = 0;
            person.Code       = client.Code;
            person.Birthday   = DataConverter.CDate(users.BirthDay);
            person.city       = users.County;
            person.country    = users.Country;
            person.Fax_phone  = users.Fax;
            person.Home_Phone = users.HomePhone;
            person.Homepage   = users.HomePage;
            person.ICQ_Code   = users.ICQ;
            person.Id_Code    = users.IDCard;
            person.MSN_Code   = users.MSN;
            person.Native     = users.Province;
            person.province   = users.County;
            person.QQ_Code    = users.QQ;
            person.Telephone  = users.Mobile;
            person.UC_Code    = users.UC;
            person.Work_Phone = users.OfficePhone;
            person.YaoHu_Code = users.Yahoo;
            person.ZipCodeW   = users.ZipCode;
            bsc.GetInsert(client);
            bperson.GetInsert(person);
            function.WriteSuccessMsg("升级成功,请进入客户管理系统管理客户信息!");
        }
        else  //否则就提示
        {
            Response.Redirect("EditCus.aspx?id=" + id);
        }
        if (dt != null)
        {
            dt.Dispose();
        }
    }
        //提交
        protected void Commit_Click(object sender, EventArgs e)
        {
            //mps.Name = Request.Form["TxtProjectName"];
            //mps.TypeID =Convert.ToInt32( Request.Form["DDList"]);
            //mps.Price = DataConverter.CDecimal(Request.Form["TxtProjectPrice"]);
            //mps.Requirements = Request.Form["TxtProjectRequire"];
            //mps.ApplicationTime =DataConverter.CDate( DateTime.Now.ToString());
            //mps.BeginTime = DateTime.MaxValue;
            //mps.CompletionTime = DateTime.MaxValue;
            //获取用户信息xml储存
            string str = "<Info>";

            str += "<item id=\"name\">" + this.TxtUserName.Text.Trim() + "</item>";
            str += "<item id=\"company\">" + this.TxtUserCompany.Text.Trim() + "</item>";
            str += "<item id=\"tel\">" + this.TxtUserTel.Text.Trim() + "</item>";
            str += "<item id=\"mobile\">" + this.TxtUserMobile.Text.Trim() + "</item>";
            str += "<item id=\"qq\">" + this.TxtUserQQ.Text.Trim() + "</item>";
            str += "<item id=\"msn\">" + this.TxtUserMSN.Text.Trim() + "</item>";
            str += "<item id=\"address\">" + this.TxtUserAddress.Text.Trim() + "</item>";
            str += "<item id=\"email\">" + this.TxtUserEmail.Text.Trim() + "</item>";
            str += "</Info>";
            //mps.AuditStatus = 1;
            //mps.UserInfo = str;
            //int id = bps.GetInsert(mps);

            if (this.TxtUserName.Text.Trim() != "")
            {
                B_Client_Basic  bll   = new B_Client_Basic();
                B_Client_Penson pll   = new B_Client_Penson();
                DataTable       tbles = bll.SelByName(this.TxtUserName.Text.Trim());
                if (tbles.Rows.Count == 0)
                {
                    string         Code     = function.GetFileName();
                    M_Client_Basic baseinfo = new M_Client_Basic();
                    baseinfo.P_name      = this.TxtUserName.Text.Trim();
                    baseinfo.Client_Type = "0";
                    baseinfo.Add_Date    = DateTime.Now;
                    baseinfo.Code        = Code;
                    //baseinfo.Unit_Address = this.TxtUserCompany.Text.Trim();
                    bll.GetInsert(baseinfo);

                    M_Client_Penson pinfo = new M_Client_Penson();
                    pinfo.Fax_phone       = this.TxtUserTel.Text.Trim();
                    pinfo.Email_Address   = this.TxtUserEmail.Text.Trim();
                    pinfo.MSN_Code        = this.TxtUserMSN.Text.Trim();
                    pinfo.Message_Address = this.TxtUserAddress.Text.Trim();
                    pinfo.QQ_Code         = this.TxtUserQQ.Text.Trim();
                    pinfo.Work_Phone      = this.TxtUserMobile.Text.Trim();
                    pinfo.Code            = Code;
                    pinfo.Birthday        = DateTime.Now;


                    pll.GetInsert(pinfo);
                }
            }

            //DataTable dt = bpf.Select_All();
            DataTable table = new DataTable();

            table.Columns.Add(new DataColumn("FieldName", typeof(string)));
            table.Columns.Add(new DataColumn("FieldType", typeof(string)));
            table.Columns.Add(new DataColumn("FieldValue", typeof(string)));
            //if (dt != null)
            //{
            //    //获取自定义字段的列表
            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        if (DataConverter.CBool(dr["IsNotNull"].ToString()))
            //        {
            //            if (string.IsNullOrEmpty(this.Page.Request.Form["txt_" + dr["FieldName"].ToString()]))
            //            {
            //                function.WriteErrMsg(dr["FieldAlias"].ToString() + "不能为空!");
            //            }
            //        }

            //        if (dr["FieldType"].ToString() == "FileType")
            //        {
            //            string[] Sett = dr["Content"].ToString().Split(new char[] { ',' });
            //            bool chksize = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]);
            //            string sizefield = Sett[1].Split(new char[] { '=' })[1];
            //            if (chksize && sizefield != "")
            //            {
            //                DataRow row2 = table.NewRow();
            //                row2[0] = sizefield;
            //                row2[1] = "FileSize";
            //                row2[2] = this.Page.Request.Form["txt_" + sizefield];
            //                table.Rows.Add(row2);
            //            }
            //        }

            //        if (dr["FieldType"].ToString() == "MultiPicType")
            //        {
            //            string[] Sett = dr["Content"].ToString().Split(new char[] { ',' });
            //            bool chksize = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]);
            //            string sizefield = Sett[1].Split(new char[] { '=' })[1];
            //            if (chksize && sizefield != "")
            //            {
            //                if (string.IsNullOrEmpty(this.Page.Request.Form["txt_" + sizefield]))
            //                {
            //                    function.WriteErrMsg(dr["FieldAlias"].ToString() + "的缩略图不能为空!");
            //                }
            //                DataRow row1 = table.NewRow();
            //                row1[0] = sizefield;
            //                row1[1] = "ThumbField";
            //                row1[2] = this.Page.Request.Form["txt_" + sizefield];
            //                table.Rows.Add(row1);
            //            }
            //        }
            //        DataRow row = table.NewRow();
            //        row[0] = dr["FieldName"].ToString();
            //        string ftype = dr["FieldType"].ToString();
            //        row[1] = ftype;
            //        string fvalue = this.Page.Request.Form["txt_" + dr["FieldName"].ToString()];
            //        if (ftype == "TextType" || ftype == "MultipleTextType" || ftype == "MultipleHtmlType")
            //        {
            //            fvalue = sll.ProcessSen(fvalue);
            //        }
            //        row[2] = fvalue;
            //        table.Rows.Add(row);
            //    }
            //}
            //显示自定义字段
            if (table != null)
            {
                if (table.Rows.Count > 0)
                {
                    //int id = bps.GetInsert(mps);
                    //bps.InsertModel(table, "ZL_ProjectsBase",id);
                }
            }

            if (Request.Form["project"] != null)
            {
                string project     = Request.Form["project"];
                string projectname = Request.Form["projectname"];

                if (project.IndexOf(",") > -1)
                {
                    string[] arrlist  = project.Split(new string[] { "," }, StringSplitOptions.None);     //value
                    string[] namelist = projectname.Split(new string[] { "," }, StringSplitOptions.None); //name

                    for (int i = 0; i < arrlist.Length; i++)
                    {
                        //arrlist[i];
                        //M_Processes processesinfo = new M_Processes();
                        //processesinfo.Info = "";
                        //processesinfo.IsComplete = 0;
                        //processesinfo.CompleteTime = DateTime.Now;
                        //processesinfo.Name = namelist[i].ToString();
                        ////processesinfo.OpjectID = id;
                        //processesinfo.Progress = DataConverter.CLng(arrlist[i]);
                        //pll.GetInsert(processesinfo);
                    }
                }
            }
            function.WriteSuccessMsg("操作成功!", "Projects.aspx");
        }
Esempio n. 3
0
        //确定按钮
        protected void btnTrue_Click(object sender, EventArgs e)
        {
            int            id       = DataConverter.CLng(Request.QueryString["id"]);
            M_UserInfo     userinfo = Uinfo.GetUserByUserID(id);
            M_Uinfo        users    = Uinfo.GetUserBaseByuserid(id);
            B_Client_Basic bsc      = new B_Client_Basic();
            M_Client_Basic client   = new M_Client_Basic();

            if (rbSelect.SelectedValue.Trim().Equals("3"))  //取消升级
            {
                Response.Redirect("Userinfo.aspx?id=" + id);
            }
            if (rbSelect.SelectedValue.Trim().Equals("2")) //覆盖客户
            {
                //通过客户姓名获取客户信息
                DataTable dt = bsc.SelByName(userinfo.UserName.Trim());
                if (dt != null) //如果找不到客户则升级
                {
                    client.Flow = DataConverter.CLng(dt.Rows[0]["Flow"]);
                    //client.Client_Source = "在线注册";
                    //client.Client_Area = users.Province;
                    client.P_name   = userinfo.UserName;
                    client.Add_Date = DateTime.Now;
                    client.Code     = dt.Rows[0]["Code"].ToString();
                    //client.Add_Name = users.TrueName;
                    client.Title = "在线注册";
                    M_Client_Penson person  = new M_Client_Penson();
                    B_Client_Penson bperson = new B_Client_Penson();
                    person = bperson.GetPenSonByCode(client.Code.Trim());
                    if (person == null || person.Flow == 0)
                    {
                        person.Code = client.Code;
                    }
                    person.Birthday   = DataConverter.CDate(users.BirthDay);
                    person.city       = users.County;
                    person.country    = users.Country;
                    person.Fax_phone  = users.Fax;
                    person.Home_Phone = users.HomePhone;
                    person.Homepage   = users.HomePage;
                    person.ICQ_Code   = users.ICQ;
                    person.Id_Code    = users.IDCard;
                    person.MSN_Code   = users.MSN;
                    person.Native     = users.Province;
                    person.province   = users.County;
                    person.QQ_Code    = users.QQ;
                    person.Telephone  = users.Mobile;
                    person.UC_Code    = users.UC;
                    person.Work_Phone = users.OfficePhone;
                    person.YaoHu_Code = users.Yahoo;
                    person.ZipCodeW   = users.ZipCode;
                    person.Code       = client.Code.Trim();
                    if (person.Flow == 0)
                    {
                        if (bsc.GetUpdate(client) && bperson.GetInsert(person))
                        {
                            function.WriteSuccessMsg("覆盖升级成功,请进入客户管理系统管理客户信息!", "../user/Userinfo.aspx?id=" + id);
                        }
                        else
                        {
                            function.WriteErrMsg("操作失败,请重试或检查操作错误!");
                        }
                    }
                    else
                    {
                        if (bsc.GetUpdate(client) && bperson.GetUpdate(person))
                        {
                            function.WriteSuccessMsg("覆盖升级成功,请进入客户管理系统管理客户信息!", "../user/Userinfo.aspx?id=" + id);
                        }
                        else
                        {
                            function.WriteErrMsg("操作失败,请重试或检查操作错误!");
                        }
                    }
                }
                if (dt != null)
                {
                    dt.Dispose();
                }
            }
            if (rbSelect.SelectedValue.Trim().Equals("1"))//系统修改姓名,随机生成数字
            {
                //client.Client_Source = "在线注册";
                //client.Client_Area = users.Province;
                Random ro   = new Random();
                int    resu = ro.Next(100000);
                client.P_name   = userinfo.UserName + resu.ToString();
                client.Add_Date = DateTime.Now;
                client.Code     = DataSecurity.MakeFileRndName().ToString();
                //client.Add_Name = users.TrueName;
                client.Title = "在线注册";
                M_Client_Penson person  = new M_Client_Penson();
                B_Client_Penson bperson = new B_Client_Penson();
                person.Code       = client.Code.Trim();
                person.Birthday   = DataConverter.CDate(users.BirthDay);
                person.city       = users.County;
                person.country    = users.Country;
                person.Fax_phone  = users.Fax;
                person.Home_Phone = users.HomePhone;
                person.Homepage   = users.HomePage;
                person.ICQ_Code   = users.ICQ;
                person.Id_Code    = users.IDCard;
                person.MSN_Code   = users.MSN;
                person.Native     = users.Province;
                person.province   = users.County;
                person.QQ_Code    = users.QQ;
                person.Telephone  = users.Mobile;
                person.UC_Code    = users.UC;
                person.Work_Phone = users.OfficePhone;
                person.YaoHu_Code = users.Yahoo;
                person.ZipCodeW   = users.ZipCode;
                if (bsc.GetInsert(client) && bperson.GetInsert(person))
                {
                    function.WriteSuccessMsg("升级成功,您的名称为:" + client.P_name + ",请进入客户管理系统查看客户信息!", "../user/Userinfo.aspx?id=" + id);
                }
                else
                {
                    function.WriteErrMsg("操作失败,请重试或检查操作错误!");
                }
            }
        }