Esempio n. 1
0
        protected void EditInfo()
        {
            string sName    = Fn.EncodeHtml(Req.GetForm("cName"));
            string sTel     = Fn.EncodeHtml(Req.GetForm("cTel"));
            string sFixTel  = Fn.EncodeHtml(Req.GetForm("cFixTel"));
            string sAddress = Fn.EncodeHtml(Req.GetForm("cAddress"));
            string sArea    = Req.GetForm("cArea");
            string sSex     = Req.GetForm("cSex");
            string sEmail   = Fn.EncodeHtml(Req.GetForm("cEmail"));

            string birDate    = Fn.EncodeHtml(Req.GetForm("cBirDate"));
            string familyN    = Fn.EncodeHtml(Req.GetForm("cFamilyN"));
            string trades     = Req.GetForm("cTrades");
            string income     = Req.GetForm("cIncome");
            string cuisine    = Req.GetForm("cCuisine");
            string vegetables = Req.GetForm("cVegetables");
            string taste      = Req.GetForm("cTaste");
            string factor     = Req.GetForm("cFactor");
            string proposal   = Fn.EncodeHtml(Req.GetForm("cProposal"));

            if (sName.Length < 1 || sName.Length > 30)
            {
                msgAjax.Error("请输入姓名,不超30个字;");
            }

            if (sTel.Length == 0 && sFixTel.Length == 0)
            {
                msgAjax.Error("手机/电话必填一项;");
            }
            else
            {
                if (sTel.Length > 25)
                {
                    msgAjax.Error("手机不超25个字符;");
                }

                if (sFixTel.Length > 25)
                {
                    msgAjax.Error("电话不超25个字符;");
                }
            }

            if (sAddress.Length < 1 || sAddress.Length > 250)
            {
                msgAjax.Error("请输入详细地址,不超250个字;");
            }

            if (!Fn.IsIntBool(sSex))
            {
                msgAjax.Error("请选择性别;");
            }

            if ((!Fn.IsIntBool(sArea)))
            {
                msgAjax.Error("请选择地区;");
            }
            else if (Convert.ToInt32(sArea) < 1)
            {
                msgAjax.Error("请选择地区;");
            }

            if (msgAjax.IsError)
            {
                return;
            }

            //邮箱
            if (sEmail.Length == 0)
            {
                msgAjax.Error("请输入邮箱;");//请输入邮箱
            }
            else
            {
                if (sEmail.Length < 5 || sEmail.Length > 30)
                {
                    msgAjax.Error("邮箱须在5-30个字符之间;");//邮箱须在5-30个字符之间
                }
                else
                {
                    if (!Fn.IsRegex(sEmail, Fn.EnumRegex.电子邮件))
                    {
                        msgAjax.Error("邮箱格式不正确;");//邮箱格式不正确
                    }
                    else
                    {
                        if (User_InfoL.IsEmailEdit(sEmail, userID))
                        {
                            msgAjax.Error("此邮箱名已被注册,请重新输入;");//此邮箱名已被注册,请更换一个邮箱试试
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(birDate) && !Fn.IsDateBool(birDate))
            {
                msgAjax.Error("出生日期格式错误,请重新输入!;");
            }

            if (!string.IsNullOrEmpty(familyN) && !Fn.IsIntBool(familyN))
            {
                msgAjax.Error("家庭成员人数格式错误,请重新输入!;");
            }


            if (msgAjax.IsError)
            {
                return;
            }

            //调查
            int iVegetables = 0;

            if (vegetables.Length > 0)
            {
                if (Fn.IsIntArrBool(vegetables))
                {
                    iVegetables = Fn.IntArrToBit(Fn.StrToIntArr(vegetables));
                }
            }

            int iTaste = 0;

            if (taste.Length > 0)
            {
                if (Fn.IsIntArrBool(taste))
                {
                    iTaste = Fn.IntArrToBit(Fn.StrToIntArr(taste));
                }
            }

            int iFactor = 0;

            if (factor.Length > 0)
            {
                if (Fn.IsIntArrBool(factor))
                {
                    iFactor = Fn.IntArrToBit(Fn.StrToIntArr(factor));
                }
            }

            //调查信息
            SurveyM surMod = new SurveyM();

            surMod.FK_User    = userID;
            surMod.BirDate    = birDate;
            surMod.FamilyN    = familyN;
            surMod.Trades     = Fn.IsInt(trades, 0);
            surMod.Income     = Fn.IsInt(income, 0);
            surMod.Cuisine    = Fn.IsInt(cuisine, 0);
            surMod.Vegetables = iVegetables;
            surMod.Taste      = iTaste;
            surMod.Factor     = iFactor;
            surMod.Proposal   = proposal;

            //个人用户信息
            User_PersonalM perMod = new User_PersonalM();

            perMod.RealName = sName;
            perMod.Sex      = byte.Parse(sSex);
            perMod.Area     = int.Parse(sArea);
            perMod.Address  = sAddress;
            perMod.Tel      = sTel;
            perMod.FixTel   = sFixTel;

            //账户信息
            User_InfoM infoMod = new User_InfoM();

            infoMod.Email = sEmail;

            EditInfo_TransM tmod = new EditInfo_TransM();

            tmod.infoMod = infoMod;
            tmod.perMod  = perMod;
            tmod.surMod  = surMod;

            DbHelp.ExecuteTrans(new DbHelpParam(), EditInfo_Trans, tmod);

            if (tmod.returnValue == "1")
            {
                msgAjax.Success("1");
            }
            else
            {
                msgAjax.Error(tmod.returnValue);
            }
        }
Esempio n. 2
0
        protected void EditInfo()
        {
            string sName1   = Fn.EncodeHtml(Req.GetForm("cName1"));
            string sName    = Fn.EncodeHtml(Req.GetForm("cName"));
            string sTel     = Fn.EncodeHtml(Req.GetForm("cTel"));
            string sFixTel  = Fn.EncodeHtml(Req.GetForm("cFixTel"));
            string sAddress = Fn.EncodeHtml(Req.GetForm("cAddress"));
            string sArea    = Req.GetForm("cArea");
            string sEmail   = Fn.EncodeHtml(Req.GetForm("cEmail"));
            string sDetail  = Fn.EncodeHtml(Req.GetForm("cInfo"));

            if (sName1.Length < 1 || sName1.Length > 100)
            {
                msgAjax.Error("请输入公司名称,不超100个字;");
            }

            if (sName.Length < 1 || sName.Length > 30)
            {
                msgAjax.Error("请输入姓名,不超30个字;");
            }

            if (sTel.Length == 0 && sFixTel.Length == 0)
            {
                msgAjax.Error("手机/电话必填一项;");
            }
            else
            {
                if (sTel.Length > 25)
                {
                    msgAjax.Error("手机不超25个字符;");
                }

                if (sFixTel.Length > 25)
                {
                    msgAjax.Error("电话不超25个字符;");
                }
            }

            if (sAddress.Length < 1 || sAddress.Length > 250)
            {
                msgAjax.Error("请输入详细地址,不超250个字;");
            }

            if ((!Fn.IsIntBool(sArea)))
            {
                msgAjax.Error("请选择地区;");
            }
            else if (Convert.ToInt32(sArea) < 1)
            {
                msgAjax.Error("请选择地区;");
            }

            if (sDetail.Length > 2000)
            {
                msgAjax.Error("公司介绍不超过2000字符;");
            }

            if (msgAjax.IsError)
            {
                return;
            }

            //邮箱
            if (sEmail.Length == 0)
            {
                msgAjax.Error("请输入邮箱;");//请输入邮箱
            }
            else
            {
                if (sEmail.Length < 5 || sEmail.Length > 30)
                {
                    msgAjax.Error("邮箱须在5-30个字符之间;");//邮箱须在5-30个字符之间
                }
                else
                {
                    if (!Fn.IsRegex(sEmail, Fn.EnumRegex.电子邮件))
                    {
                        msgAjax.Error("邮箱格式不正确;");//邮箱格式不正确
                    }
                    else
                    {
                        if (User_InfoL.IsEmailEdit(sEmail, userID))
                        {
                            msgAjax.Error("此邮箱名已被注册,请重新输入;");//此邮箱名已被注册,请更换一个邮箱试试
                        }
                    }
                }
            }

            if (msgAjax.IsError)
            {
                return;
            }

            //团体用户信息
            User_TeamM teamMod = new User_TeamM();

            teamMod.TeamName = sName1;
            teamMod.RealName = sName;
            teamMod.Area     = int.Parse(sArea);
            teamMod.Address  = sAddress;
            teamMod.Tel      = sTel;
            teamMod.FixTel   = sFixTel;
            teamMod.Detail   = sDetail;

            //账户信息
            User_InfoM infoMod = new User_InfoM();

            infoMod.Email = sEmail;

            EditInfo_TransM tmod = new EditInfo_TransM();

            tmod.infoMod = infoMod;
            tmod.teamMod = teamMod;

            DbHelp.ExecuteTrans(new DbHelpParam(), EditInfo_Trans, tmod);

            if (tmod.returnValue == "1")
            {
                msgAjax.Success("1");
            }
            else
            {
                msgAjax.Error(tmod.returnValue);
            }
        }