Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            number = Fn.EncodeHtml(Req.GetQueryString("number"));

            check();
            Response.Write(msgAjax.ReturnMessage);
            Response.End();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取数据及验证
        /// </summary>
        /// <returns></returns>
        public static User_ContactM GetData(ref string pMsg)
        {
            User_ContactM mod = new User_ContactM();

            string sName = Fn.EncodeHtml(Req.GetForm("cName").Trim());
            //string sSex = Req.GetForm("cSex").Trim();
            string sAddress = Fn.EncodeHtml(Req.GetForm("cAddress").Trim());
            string sFixTel  = Fn.EncodeHtml(Req.GetForm("cFixTel").Trim());
            string sTel     = Fn.EncodeHtml(Req.GetForm("cTel").Trim());
            string sArea    = Req.GetForm("cArea").Trim();

            if (sName.Length < 1 || sName.Length > 30)
            {
                pMsg = "请输入收货人,不超30个字;";
                return(mod);
            }

            if ((sTel.Length < 1 || sTel.Length > 25) && (sFixTel.Length < 1 || sFixTel.Length > 25))
            {
                pMsg = "手机,固定电话必填一个,不超25个位;";
                return(mod);
            }

            if (sAddress.Length < 1 || sAddress.Length > 300)
            {
                pMsg = "请输入详细地址,不超300个字;";
                return(mod);
            }

            if ((!Fn.IsIntBool(sArea)))
            {
                pMsg = "请选择地区;";
                return(mod);
            }
            else if (Convert.ToInt32(sArea) < 1)
            {
                pMsg = "请选择地区;";
                return(mod);
            }

            mod.Name    = sName;
            mod.Address = sAddress;
            mod.FixTel  = sFixTel;
            mod.Tel     = sTel;
            mod.FK_Area = Convert.ToInt32(sArea);
            return(mod);
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
        private void Reg()
        {
            if (Req.GetForm("cCode").Length == 0)
            {
                msgAjax.Error("code.input;");
            }
            else
            {
                if (!Fn.IsVerifyCode1("cCode", "uverify"))
                {
                    msgAjax.Error("code.wrong;");
                }
            }

            string sName     = Fn.EncodeHtml(Req.GetForm("cName").Trim());
            string sEmail    = Fn.EncodeHtml(Req.GetForm("cEmail").Trim());
            string sPwd      = Req.GetForm("cPwd").Trim();
            string sPwdSure  = Req.GetForm("cPwdSure").Trim();
            string sCard     = Fn.EncodeHtml(Req.GetForm("cCard").Trim());
            string sPromoter = Req.GetForm("cPromoter").Trim();

            //用户名
            if (sName.Length == 0)
            {
                msgAjax.Error("name.input;");//请输入用户名
            }
            else
            {
                if (sName.Length < 5 || sName.Length > 30)
                {
                    msgAjax.Error("name.above;");//用户名须在5-30个字符之间
                }
                else
                {
                    if (!Fn.IsRegex(sName, Fn.EnumRegex.用户名))
                    {
                        msgAjax.Error("name.format;");//用户名格式不正确
                    }
                    else
                    {
                        if (User_InfoL.IsUserName(sName))
                        {
                            msgAjax.Error("name.has;");//此用户名已被注册,请重新输入用户名
                        }
                    }
                }
            }

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

            //密码
            if (sPwd.Length == 0)
            {
                msgAjax.Error("pwd.input;");//请输入密码
            }
            else
            {
                if (sPwd.Length < 5 || sPwd.Length > 30)
                {
                    msgAjax.Error("pwd.above;");//密码不能小于5位数
                }
            }

            //确认密码
            if (sPwdSure.Length == 0)
            {
                msgAjax.Error("pwd1.input;");//请输入确认密码
            }
            else
            {
                if (sPwd != sPwdSure)
                {
                    msgAjax.Error("pwd1.notEqual;");//两次密码输入不一致
                }
            }

            //会员卡号
            int exp = 0;

            if (sCard.Length > 0)
            {
                if (!Activity_InfoL.IsOpen("user_card"))
                {
                    msgAjax.Error("card.clo;");
                    return;
                }

                if (!User_CardL.IsUse(sCard, out exp))
                {
                    msgAjax.Error("card.wrong;");
                    return;
                }

                if (exp <= 0)
                {
                    msgAjax.Error("card.wrong;");
                    return;
                }
            }

            //推广员号码
            int UserBTJ = 0;

            if (sPromoter.Length > 0)
            {
                int iPromoter;

                if (!int.TryParse(sPromoter, out iPromoter))
                {
                    msgAjax.Error("promoter.wrong;");
                    return;
                }

                if (!Activity_InfoL.IsOpen("user_promoter"))
                {
                    msgAjax.Error("promoter.clo;");
                    return;
                }

                if (!User_InfoL.IsUserPromoter(iPromoter))
                {
                    msgAjax.Error("promoter.wrong;");
                    return;
                }

                UserBTJ = iPromoter;
            }

            if (msgAjax.IsError)
            {
                return;
            }

            User_InfoM infoMod = new User_InfoM();

            infoMod.UserName      = sName;
            infoMod.UserPwd       = Fn.MD5(sPwd);
            infoMod.LastLoginIP   = Request.UserHostAddress;
            infoMod.OpenIdentity  = 1;//个人用户
            infoMod.FK_User_Level = User_LevelL.GetDefaultLevel();
            infoMod.Email         = sEmail;
            infoMod.UserCard      = sCard;
            infoMod.UserBTJ       = UserBTJ;

            User_PersonalM perMod = new User_PersonalM();

            User_InfoL.Reg_TransM lsTrans = new User_InfoL.Reg_TransM();
            lsTrans.infoMod = infoMod;
            lsTrans.perMod  = perMod;
            if (exp > 0)
            {
                lsTrans.IsUseCard = true;
                lsTrans.Exp       = exp;
            }

            DbHelp.ExecuteTrans(new DbHelpParam(), User_InfoL.Reg_Trans, lsTrans);

            if (lsTrans.returnValue == "1")
            {
                User_Info.Login(sName, sPwd);
                Session.Remove("uverify");
                int isSend = 0;
                try
                {
                    string url   = Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, "") + "/email/regSuccess.aspx?un=" + sName;
                    string sText = Fn.GetPageHtml(url);

                    User_InfoL.SendEmail(sEmail, sName + " 您好,您在搜菜网已成功注册会员", sText);
                    isSend = 1;
                }
                catch
                { }

                msgAjax.Success(isSend.ToString());
            }
            else
            {
                msgAjax.Error(lsTrans.returnValue);
            }
        }
Exemplo n.º 5
0
        protected void bOK_Click(object sender, EventArgs e)
        {
            string sName = Fn.EncodeHtml(Req.GetForm("cName").Trim());
            string sMail = Fn.EncodeHtml(Req.GetForm("cMail").Trim());

            if (sName.Length == 0 || sMail.Length == 0 || sName.Length > 30 || sMail.Length > 30)
            {
                Js.Alert("请输入用户名和邮箱,且用户名,邮箱不能超过30个字");
            }

            if (!Fn.IsRegex(sName, Fn.EnumRegex.用户名))
            {
                Js.Alert("用户名有非法字符");
            }

            if (!Fn.IsRegex(sMail, Fn.EnumRegex.电子邮件))
            {
                Js.Alert("邮箱格式不正确");
            }

            string sql = "select UserSN from User_Info where UserName=@UserName and Email=@Email";

            IDataParameter[] param =
            {
                DbHelp.Def.AddParam("@UserName", sName),
                DbHelp.Def.AddParam("@Email",    sMail),
            };

            string str = DbHelp.First(sql, param, "0");

            if (str == "0")
            {
                Js.Alert("不存在此账号");
            }
            else
            {
                string Key = Guid.NewGuid().ToString();
                Key = Key.Substring(0, 8) + Key.Substring(24, 12);
                sql = "insert into User_FindPwdEmail(FK_User,FPEmail,FPKey)values(@FK_User,@FPEmail,@FPKey)";
                IDataParameter[] param2 =
                {
                    DbHelp.Def.AddParam("@FK_User", str),
                    DbHelp.Def.AddParam("@FPEmail", sMail),
                    DbHelp.Def.AddParam("@FPKey",   Key),
                };

                if (DbHelp.Update(sql, param2) > 0)
                {
                    string p = string.Format("{0}-{1}", sMail, Key);

                    //发送邮件
                    string url   = Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, "") + "/email/findPwd.aspx?s=" + p;
                    string sText = Fn.GetPageHtml(url);

                    User_InfoL.SendEmail(sMail, "找回密码", sText);

                    //sendEmail(sMail, " 找回密码", p);
                    Js.Write("alert('电子邮件已发送,请登入邮箱按照邮件提示操作。');top.open('http://mail." + sMail.Split('@')[1] + "');top.history.go(-1)");
                }
            }
        }
Exemplo n.º 6
0
        private void Exchange()
        {
            //验证文本框输入
            if (!double.TryParse(Req.GetQueryString("excount"), out excount))
            {
                msgAjax.Error("errnumber");
                return;
            }
            else
            {
                if (excount <= 0)
                {
                    msgAjax.Error("errnumber");
                    return;
                }
            }

            string g_GiftName;
            int    g_Integral      = 0;
            int    g_UserIntegral  = 0;
            int    g_TotalIntegral = 0;
            string sql             = "select GiftName,Integral from Gift_Info where GiftSN=" + id;

            using (IDataReader dr = DbHelp.Read(sql))
            {
                if (dr.Read())
                {
                    g_GiftName      = dr["GiftName"].ToString();
                    g_Integral      = int.Parse(dr["Integral"].ToString());
                    g_TotalIntegral = (int)excount * g_Integral;//总积分
                }
                else
                {
                    msgAjax.Error("nogift");
                    return;
                }
            }

            sql = "select UserIntegral from User_Info where UserSN=" + userID;
            using (IDataReader dr = DbHelp.Read(sql))
            {
                if (dr.Read())
                {
                    g_UserIntegral = int.Parse(dr["UserIntegral"].ToString());
                }
                else
                {
                    msgAjax.Error("不存在用户");
                    return;
                }
            }

            if (g_UserIntegral < g_TotalIntegral)
            {
                msgAjax.Error("nointegral");
                //msgAjax.Error("您的积分不足,还差" + (g_TotalIntegral - g_UserIntegral));
                return;
            }

            int t = Req.GetID("t");

            if (t == 1)//判断
            {
                msgAjax.Success("1");
                return;
            }

            if (t == 2)//兑换
            {
                string sName    = Req.GetForm("cName").Trim();
                string sSex     = Req.GetForm("cSex").Trim();
                string sAddress = Req.GetForm("cAddress").Trim();
                string sFixTel  = Req.GetForm("cFixTel").Trim();
                string sTel     = Req.GetForm("cTel").Trim();
                string sArea    = Req.GetForm("cArea").Trim();
                string sInfo    = Fn.EncodeHtml(Req.GetForm("cInfo").Trim());

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

                if ((sTel.Length < 1 || sTel.Length > 25) && (sFixTel.Length < 1 || sFixTel.Length > 25))
                {
                    msgAjax.Error("手机,固定电话必填一个,不超25个位;");
                    return;
                }

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

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

                if (sInfo.Length > 600)
                {
                    msgAjax.Error("符加信息不能超过600字;");
                    return;
                }

                Gift_ExchangeLogM mod = new Gift_ExchangeLogM();
                mod.FK_User = userID;
                mod.FK_Gift = id;

                mod.gift_UserName = LoginInfo.UserName;
                mod.gift_RealName = sName;
                mod.gift_Address  = sAddress;
                mod.gift_FixTel   = sFixTel;
                mod.gift_Tel      = sTel;
                mod.gift_Area     = Convert.ToInt32(sArea);
                mod.gift_Caption  = sInfo;

                mod.GiftName        = g_GiftName;
                mod.ExIntegral      = g_Integral;
                mod.ExTotalIntegral = g_TotalIntegral;
                mod.Num             = excount;

                Gift_TransM trans_mod = new Gift_TransM();
                trans_mod.mod = mod;

                DbHelp.ExecuteTrans(new DbHelpParam(), this.Gift_Trans, trans_mod);

                if (trans_mod.returnValue == "1")
                {
                    msgAjax.Success("1");
                }
                else
                {
                    msgAjax.Error(trans_mod.returnValue);
                }
            }
        }
Exemplo n.º 7
0
        private void cb_ok()
        {
            #region
            string name        = Fn.EncodeHtml(Req.GetForm("name").Trim());
            string sex         = Req.GetForm("sex").Trim();
            string address     = Fn.EncodeHtml(Req.GetForm("address").Trim());
            string tel         = Fn.EncodeHtml(Req.GetForm("tel").Trim());
            string fixtel      = Fn.EncodeHtml(Req.GetForm("fixtel").Trim());
            string bank        = Fn.EncodeHtml(Req.GetForm("bank").Trim());
            string bankaccount = Fn.EncodeHtml(Req.GetForm("bankaccount").Trim());
            string remark      = Fn.EncodeHtml(Req.GetForm("remark").Trim());

            //姓名
            if (name.Length == 0)
            {
                msgAjax.Error("请输入姓名;");
            }
            else if (name.Length > 30)
            {
                msgAjax.Error("姓名不超过30个字;");
            }

            //性别
            if (!Fn.IsByteBool(sex))
            {
                msgAjax.Error("请选择性别;");
            }


            //地址
            if (address.Length == 0)
            {
                msgAjax.Error("请输入地址;");
            }
            else if (address.Length > 300)
            {
                msgAjax.Error("地址不超过300个字;");
            }

            //手机 电话
            if (tel.Length == 0 && fixtel.Length == 0)
            {
                msgAjax.Error("手机和电话必填一个;");
            }
            else
            {
                if (tel.Length > 50)
                {
                    msgAjax.Error("手机不超过50个字;");
                }

                if (fixtel.Length > 50)
                {
                    msgAjax.Error("电话不超过50个字;");
                }
            }

            //开户行
            if (bank.Length == 0)
            {
                msgAjax.Error("请输入开户银行;");
            }
            else if (bank.Length > 50)
            {
                msgAjax.Error("开户银行不超过50个字;");
            }

            //银行账号
            if (bankaccount.Length == 0)
            {
                msgAjax.Error("请输入银行账号;");
            }
            else if (bankaccount.Length > 50)
            {
                msgAjax.Error("银行账号不超过50个字;");
            }

            //备注
            if (remark.Length > 600)
            {
                msgAjax.Error("备注不超过600个字;");
            }

            if (msgAjax.IsError)
            {
                return;
            }

            User_ApplyFor_1M mod = new User_ApplyFor_1M();
            mod.FK_User      = LoginInfo.UserID;
            mod.RealName     = name;
            mod.Sex          = byte.Parse(sex);
            mod.Address      = address;
            mod.Tel          = tel;
            mod.FixTel       = fixtel;
            mod.Bank_Name    = bank;
            mod.Bank_Account = bankaccount;
            mod.Remark       = remark;
            #endregion

            string sql = "FK_User,FK_AdminID,RealName,Sex,Address,Tel,FixTel,Bank_Name,Bank_Account,Remark";
            if (SqlData.Add(mod, sql))
            {
                msgAjax.Success("1");
            }
            else
            {
                msgAjax.Error("申请失败");
            }
        }
Exemplo n.º 8
0
        private void Reg()
        {
            if (Req.GetForm("cIsAgree") != "1")
            {
                msgAjax.Error("必需同意[搜菜网用户注册协议]才能注册;");
                return;
            }

            if (!Fn.IsVerifyCode1("cCode", "uverify"))
            {
                msgAjax.Error("code.wrong;");
                return;
            }

            string cname     = Fn.EncodeHtml(Req.GetForm("cname").Trim());
            string email     = Fn.EncodeHtml(Req.GetForm("email").Trim());
            string pwd       = Req.GetForm("pwd").Trim();
            string pwd1      = Req.GetForm("pwd1").Trim();
            string realname  = Fn.EncodeHtml(Req.GetForm("realname").Trim());
            string sSex      = Req.GetForm("cSex").Trim();
            string sArea     = Req.GetForm("cArea").Trim();
            string address   = Fn.EncodeHtml(Req.GetForm("address").Trim());
            string tel       = Fn.EncodeHtml(Req.GetForm("tel").Trim());
            string telfix    = Fn.EncodeHtml(Req.GetForm("telfix").Trim());
            string sCard     = Fn.EncodeHtml(Req.GetForm("card").Trim());
            string sPromoter = Req.GetForm("cPromoter").Trim();

            //用户名
            if (cname.Length == 0)
            {
                msgAjax.Error("请输入用户名;");
            }
            else
            {
                if (cname.Length < 5 || cname.Length > 30)
                {
                    msgAjax.Error("用户名需在5-30个字符之间;");
                }
                else
                {
                    if (!Fn.IsRegex(cname, Fn.EnumRegex.用户名))
                    {
                        msgAjax.Error("用户名中有非法字条;");
                    }
                    else
                    {
                        if (User_InfoL.IsUserName(cname))
                        {
                            msgAjax.Error("此用户名已被注册,请重新输入;");
                        }
                    }
                }
            }

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

            if (pwd.Length == 0)
            {
                msgAjax.Error("请输入密码;");
            }
            else
            {
                if (pwd.Length < 5 || pwd.Length > 30)
                {
                    msgAjax.Error("密码需在5-30位数之间;");
                }
                else
                {
                    if (pwd1.Length == 0)
                    {
                        msgAjax.Error("请输入确认密码;");
                    }
                    else
                    {
                        if (pwd != pwd1)
                        {
                            msgAjax.Error("两次密码输入不一致;");
                        }
                    }
                }
            }

            //会员卡号
            int exp = 0;

            if (sCard.Length > 0)
            {
                if (!Activity_InfoL.IsOpen("user_card"))
                {
                    msgAjax.Error("会员卡活动已关闭;");
                    return;
                }

                if (!User_CardL.IsUse(sCard, out exp))
                {
                    msgAjax.Error("会员卡错误或不存在此卡号;");
                    return;
                }

                if (exp <= 0)
                {
                    msgAjax.Error("会员卡错误或不存在此卡号;");
                    return;
                }
            }

            //推广员号码
            int UserBTJ = 0;

            if (sPromoter.Length > 0)
            {
                int iPromoter;

                if (!int.TryParse(sPromoter, out iPromoter))
                {
                    msgAjax.Error("推广员号码错误或不存在此推广员;");
                    return;
                }

                if (!Activity_InfoL.IsOpen("user_promoter"))
                {
                    msgAjax.Error("注册推广员活动已关闭;");
                    return;
                }

                if (!User_InfoL.IsUserPromoter(iPromoter))
                {
                    msgAjax.Error("推广员号码错误或不存在此推广员;");
                    return;
                }

                UserBTJ = iPromoter;
            }

            if (realname.Length > 30)
            {
                msgAjax.Error("联系人不超过30个字;");
            }

            if (tel.Length > 25)
            {
                msgAjax.Error("手机不超过25字;");
            }

            if (telfix.Length > 25)
            {
                msgAjax.Error("固定电话不超过25字;");
            }

            if (address.Length > 300)
            {
                msgAjax.Error("地址不超过300字;");
            }

            int iArea = Fn.IsInt(sArea, 0);

            if (iArea < 0)
            {
                msgAjax.Error("非法操作;");
            }
            else if (iArea > 0)
            {
                if (ClassData.HasNext("Pub_Area", iArea))
                {
                    msgAjax.Error("请选择最后一级分类;");
                }
            }

            //if (tel.Length == 0 && telfix.Length == 0)
            //{
            //    msgAjax.Error("手机和固定电话必填一个;");
            //}

            if (msgAjax.IsError)
            {
                return;
            }

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

            infoMod.FK_User_Level = User_LevelL.GetDefaultLevel();
            infoMod.UserName      = cname;
            infoMod.UserPwd       = Fn.MD5(pwd);
            infoMod.LastLoginIP   = Request.UserHostAddress;
            infoMod.OpenIdentity  = 1;//个人用户
            infoMod.Email         = email;
            infoMod.UserCard      = sCard;
            infoMod.UserBTJ       = UserBTJ;

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

            perMod.RealName = realname;
            perMod.Sex      = byte.Parse(sSex);
            perMod.Area     = iArea;
            perMod.Address  = address;
            perMod.FixTel   = telfix;
            perMod.Tel      = tel;

            //收货信息
            User_ContactM conMod = new User_ContactM();

            conMod.FK_Area = iArea;
            conMod.Name    = realname;
            conMod.Address = address;
            conMod.FixTel  = telfix;
            conMod.Tel     = tel;

            //事务类
            User_InfoL.Reg1_TransM lsTrans = new User_InfoL.Reg1_TransM();
            lsTrans.infoMod = infoMod;
            lsTrans.perMod  = perMod;
            lsTrans.conMod  = conMod;

            if (exp > 0)
            {
                lsTrans.IsUseCard = true;
                lsTrans.Exp       = exp;
            }
            DbHelp.ExecuteTrans(new DbHelpParam(), User_InfoL.Reg1_Trans, lsTrans);

            if (lsTrans.returnValue == "1")
            {
                Session.Remove("uverify");
                User_Info.Login(cname, pwd);

                int isSend = 0;
                try
                {
                    string url   = Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, "") + "/email/regSuccess.aspx?un=" + cname;
                    string sText = Fn.GetPageHtml(url);

                    User_InfoL.SendEmail(email, cname + " 您好,您在搜菜网已成功注册会员", sText);
                    isSend = 1;
                }
                catch
                { }

                msgAjax.Success(isSend.ToString());
            }
            else
            {
                msgAjax.Error(lsTrans.returnValue);
            }
        }
Exemplo n.º 9
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);
            }
        }