private int EditInfo_Trans(IDbHelp thelp, DbHelp.ITransM pMod) { EditInfo_TransM tmod = (EditInfo_TransM)pMod; User_InfoM infoMod = tmod.infoMod; User_TeamM teamMod = tmod.teamMod; #region 保存个人信息 string sql_pre = "update User_Team set TeamName=@TeamName,RealName=@RealName,Area=@Area,Address=@Address,Tel=@Tel,FixTel=@FixTel,Detail=@Detail where FK_User="******"@TeamName", teamMod.TeamName), DbHelp.Def.AddParam("@RealName", teamMod.RealName), DbHelp.Def.AddParam("@Area", teamMod.Area), DbHelp.Def.AddParam("@Address", teamMod.Address), DbHelp.Def.AddParam("@Tel", teamMod.Tel), DbHelp.Def.AddParam("@FixTel", teamMod.FixTel), DbHelp.Def.AddParam("@Detail", teamMod.Detail), }; if (thelp.Update(sql_pre, dp_pre) <= 0) { tmod.returnValue = "您的账号信息可能已损坏,请重新注册账号或通过客服帮助";//个人用户信息保存失败 return(0); } #endregion #region 保存账户信息 string sql_info = "update User_Info set Email=@Email where UserSN=" + userID + " and OpenIdentity&8=8"; IDataParameter[] dp_info = { DbHelp.Def.AddParam("@Email", infoMod.Email), }; if (thelp.Update(sql_info, dp_info) <= 0) { tmod.returnValue = "c";//账户信息保存失败 return(0); } #endregion tmod.returnValue = "1"; return(1); }
private int EditInfo_Trans(IDbHelp thelp, DbHelp.ITransM pMod) { EditInfo_TransM tmod = (EditInfo_TransM)pMod; User_InfoM infoMod = tmod.infoMod; User_PersonalM perMod = tmod.perMod; SurveyM surMod = tmod.surMod; #region 保存调查信息 string sql_sur = "if exists(select 1 from Survey where FK_User=@FK_User) " + "update Survey set BirDate=@BirDate,FamilyN=@FamilyN,Trades=@Trades,Income=@Income,Cuisine=@Cuisine,Vegetables=@Vegetables,Taste=@Taste,Factor=@Factor,Proposal=@Proposal where FK_User=@FK_User " + "else " + "insert into Survey(FK_User,BirDate,FamilyN,Trades,Income,Cuisine,Vegetables,Taste,Factor,Proposal) values(@FK_User,@BirDate,@FamilyN,@Trades,@Income,@Cuisine,@Vegetables,@Taste,@Factor,@Proposal)"; IDataParameter[] dp_sur = { DbHelp.Def.AddParam("@FK_User", surMod.FK_User), DbHelp.Def.AddParam("@BirDate", surMod.BirDate), DbHelp.Def.AddParam("@FamilyN", surMod.FamilyN), DbHelp.Def.AddParam("@Trades", surMod.Trades), DbHelp.Def.AddParam("@Income", surMod.Income), DbHelp.Def.AddParam("@Cuisine", surMod.Cuisine), DbHelp.Def.AddParam("@Vegetables", surMod.Vegetables), DbHelp.Def.AddParam("@Taste", surMod.Taste), DbHelp.Def.AddParam("@Factor", surMod.Factor), DbHelp.Def.AddParam("@Proposal", surMod.Proposal), }; if (thelp.Update(sql_sur, dp_sur) <= 0) { tmod.returnValue = "a";//调查信息保存失败 return(0); } #endregion #region 保存个人信息 string sql_pre = "update User_Personal set RealName=@RealName,Sex=@Sex,Area=@Area,Address=@Address,Tel=@Tel,FixTel=@FixTel where FK_User="******"@RealName", perMod.RealName), DbHelp.Def.AddParam("@Sex", perMod.Sex), DbHelp.Def.AddParam("@Area", perMod.Area), DbHelp.Def.AddParam("@Address", perMod.Address), DbHelp.Def.AddParam("@Tel", perMod.Tel), DbHelp.Def.AddParam("@FixTel", perMod.FixTel), }; if (thelp.Update(sql_pre, dp_pre) <= 0) { tmod.returnValue = "您的账号信息可能已损坏,请重新注册账号或通过客服帮助";//个人用户信息保存失败 return(0); } #endregion #region 保存账户信息 string sql_info = "update User_Info set Email=@Email where UserSN=" + userID; IDataParameter[] dp_info = { DbHelp.Def.AddParam("@Email", infoMod.Email), }; if (thelp.Update(sql_info, dp_info) <= 0) { tmod.returnValue = "c";//账户信息保存失败 return(0); } #endregion tmod.returnValue = "1"; return(1); }
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); } }
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); } }
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); } }
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); } }
protected void bOK_Click(object sender, EventArgs e) { string sName = Req.GetForm("cName"); string sEMail = Req.GetForm("cEMail"); string sTel = Req.GetForm("cTel"); string sAddress = Req.GetForm("cAddress"); string sArea = Req.GetForm("cArea"); string sSex = Req.GetForm("cSex"); string sMsg = string.Empty; if (sName.Length < 1 || sName.Length > 20) { sMsg += "请输入姓名,不超20个字;"; } if (sEMail.Length < 1 || sEMail.Length > 50) { sMsg += "请输入邮箱,不超50个字;"; } if (sTel.Length < 1 || sTel.Length > 25) { sMsg += "请输入手机,不超25个位;"; } if (sAddress.Length < 1 || sAddress.Length > 250) { sMsg += "请输入详细地址,不超250个字;"; } if (!Fn.IsIntBool(sSex)) { sMsg += "请选择性别;"; } if ((!Fn.IsIntBool(sArea))) { sMsg += "请选择地区;"; } else if (Convert.ToInt32(sArea) < 1) { sMsg += "请选择地区;"; } Message.Error(sMsg); User_InfoM mod = new User_InfoM(); mod.RealName = sName; mod.EMail = sEMail; mod.Tel = sTel; mod.Address = sAddress; mod.Area = Convert.ToInt32(sArea); mod.Sex = Convert.ToByte(sSex); if (User_Info.Edit(mod, LoginInfo.UserID)) { Js.Alert("修改成功", Request.Url.AbsolutePath + "?r=" + Fn.SCNumber()); } else { Message.Error("修改失败"); } }
public static int Reg1_Trans(IDbHelp tHelp, object obj) { Reg1_TransM lsTrans = (Reg1_TransM)obj; User_InfoM infoMod = lsTrans.infoMod; User_PersonalM perMod = lsTrans.perMod; User_ContactM conMod = lsTrans.conMod; if (lsTrans.IsUseCard) { if (new User_InfoL(tHelp).IsUserCard(infoMod.UserCard)) { lsTrans.returnValue = "此会员卡卡号已被人注册"; return(0); } } string sql = "insert into User_Info(FK_User_Level,UserName,UserPwd,OpenIdentity,Email,UserCard,UserBTJ) values(@FK_User_Level,@UserName,@UserPwd,@OpenIdentity,@Email,@UserCard,@UserBTJ);select SCOPE_IDENTITY()"; IDataParameter[] dp = { DbHelp.Def.AddParam("@FK_User_Level", infoMod.FK_User_Level), DbHelp.Def.AddParam("@UserName", infoMod.UserName), DbHelp.Def.AddParam("@UserPwd", infoMod.UserPwd), DbHelp.Def.AddParam("@OpenIdentity", infoMod.OpenIdentity), DbHelp.Def.AddParam("@Email", infoMod.Email), DbHelp.Def.AddParam("@UserCard", infoMod.UserCard), DbHelp.Def.AddParam("@UserBTJ", infoMod.UserBTJ), }; int uid = int.Parse(tHelp.First(sql, dp, "0").ToString()); //try //{ //uid = int.Parse(tHelp.First(sql, dp, "0").ToString()); //} //catch (Exception ex) //{ // lsTrans.returnValue = "注册失败:" + ex.Message; // return 0; //} if (uid <= 0) { lsTrans.returnValue = "注册失败2"; return(0); } sql = "insert into User_Personal(FK_User,RealName,Sex,Area,Address,Tel,FixTel) values(@FK_User,@RealName,@Sex,@Area,@Address,@Tel,@FixTel)"; IDataParameter[] dp1 = { DbHelp.Def.AddParam("@FK_User", uid), DbHelp.Def.AddParam("@RealName", perMod.RealName), DbHelp.Def.AddParam("@Sex", perMod.Sex), DbHelp.Def.AddParam("@Area", perMod.Area), DbHelp.Def.AddParam("@Address", perMod.Address), DbHelp.Def.AddParam("@Tel", perMod.Tel), DbHelp.Def.AddParam("@FixTel", perMod.FixTel), }; //User_Personal if (tHelp.Update(sql, dp1) <= 0) { lsTrans.returnValue = "注册失败1"; return(0); } //是否添加收货地址 if (conMod.Name.Length > 0 && conMod.Address.Length > 0 && (conMod.Tel.Length > 0 || conMod.FixTel.Length > 0) && conMod.FK_Area > 0) { User_ContactL uc = new User_ContactL(tHelp); conMod.FK_User = uid; string sMsg = string.Empty; if (uc.Add(conMod, ref sMsg))//添加收货地址 { } else { lsTrans.returnValue = "注册失败:" + sMsg; return(0); } } //if (uid > 0)//账号添加成功 //{ // //sql = "insert into User_Personal(FK_User,RealName,Sex,Area,Address,Tel,FixTel) values(@FK_User,@RealName,@Sex,@Area,@Address,@Tel,@FixTel)"; // //IDataParameter[] dp1 = { // // DbHelp.Def.AddParam("@FK_User",uid), // // DbHelp.Def.AddParam("@RealName",perMod.RealName), // // DbHelp.Def.AddParam("@Sex",perMod.Sex), // // DbHelp.Def.AddParam("@Area",perMod.Area), // // DbHelp.Def.AddParam("@Address",perMod.Address), // // DbHelp.Def.AddParam("@Tel",perMod.Tel), // // DbHelp.Def.AddParam("@FixTel",perMod.FixTel), // // }; // //bool isUser_Personal; // //try // //{ // // isUser_Personal = tHelp.Update(sql, dp1) > 0; // //} // //catch (Exception ex) // //{ // // lsTrans.returnValue = "注册失败:" + ex.Message; // // return 0; // //} // if (isUser_Personal)//个人用户信息添加成功 // { // //是否添加收货地址 // //if (conMod.Name.Length > 0 && conMod.Address.Length > 0 && (conMod.Tel.Length > 0 || conMod.FixTel.Length > 0) && conMod.FK_Area > 0) // //{ // // User_ContactL uc = new User_ContactL(tHelp); // // conMod.FK_User = uid; // // string sMsg = string.Empty; // // if (uc.Add(conMod, ref sMsg))//添加收货地址 // // { // // } // // else // // { // // lsTrans.returnValue = "注册失败:" + sMsg; // // return 0; // // } // //} // //else // //{ // //} // } // else // { // //lsTrans.returnValue = "注册失败1"; // //return 0; // } //} //else //{ // //lsTrans.returnValue = "注册失败2"; // //return 0; //} //增加积分或经验 User_FractHandler.FractHandlerParam ufParam = new User_FractHandler.FractHandlerParam(uid, "system", 1, "reg", "reg", "注册成功 \"" + infoMod.UserName + "\""); string slog = new User_FractHandler(tHelp).SetFract(ufParam); if (slog != "1") { lsTrans.returnValue = slog; return(0); } //是否使用会员卡 if (lsTrans.IsUseCard) { //设置会员卡状态 sql = "update User_Card set FK_User=@FK_User,card_Status=1 where card_Number=@card_Number"; IDataParameter[] dp_usercard = { DbHelp.Def.AddParam("@FK_User", uid), DbHelp.Def.AddParam("@card_Number", infoMod.UserCard), }; if (tHelp.Update(sql, dp_usercard) <= 0) { lsTrans.returnValue = "注册失败2"; return(0); } slog = new User_InfoL(tHelp).SetUserExp(uid, uid, "reg_card", lsTrans.Exp, "system", "注册使用会员卡 \"" + infoMod.UserCard + "\" 赠送" + lsTrans.Exp + "经验"); if (slog != "1") { lsTrans.returnValue = slog; return(0); } } lsTrans.returnValue = "1"; return(1); }
public static int Reg_Trans(IDbHelp tHelp, object obj) { Reg_TransM lsTrans = (Reg_TransM)obj; User_InfoM infoMod = lsTrans.infoMod; User_PersonalM perMod = lsTrans.perMod; if (lsTrans.IsUseCard) { if (new User_InfoL(tHelp).IsUserCard(infoMod.UserCard)) { lsTrans.returnValue = "此会员卡卡号已被人注册"; return(0); } } string sql = "insert into User_Info(FK_User_Level,UserName,UserPwd,OpenIdentity,Email,UserCard,UserBTJ) values(@FK_User_Level,@UserName,@UserPwd,@OpenIdentity,@Email,@UserCard,@UserBTJ);select SCOPE_IDENTITY()"; IDataParameter[] dp = { DbHelp.Def.AddParam("@FK_User_Level", infoMod.FK_User_Level), DbHelp.Def.AddParam("@UserName", infoMod.UserName), DbHelp.Def.AddParam("@UserPwd", infoMod.UserPwd), DbHelp.Def.AddParam("@OpenIdentity", infoMod.OpenIdentity), DbHelp.Def.AddParam("@Email", infoMod.Email), DbHelp.Def.AddParam("@UserCard", infoMod.UserCard), DbHelp.Def.AddParam("@UserBTJ", infoMod.UserBTJ), }; //User_Info int uid = int.Parse(tHelp.First(sql, dp, "0").ToString()); if (uid <= 0) { lsTrans.returnValue = "注册失败1"; return(0); } sql = "insert into User_Personal(FK_User) values(@FK_User)"; IDataParameter[] dp1 = { DbHelp.Def.AddParam("@FK_User", uid), }; //User_Personal if (tHelp.Update(sql, dp1) <= 0) { lsTrans.returnValue = "注册失败"; return(0); } User_FractHandler.FractHandlerParam ufParam = new User_FractHandler.FractHandlerParam(uid, "system", 1, "reg", "reg", "注册成功 \"" + infoMod.UserName + "\""); string slog = new User_FractHandler(tHelp).SetFract(ufParam); if (slog != "1") { lsTrans.returnValue = slog; return(0); } //是否使用会员卡 if (lsTrans.IsUseCard) { //设置会员卡状态 sql = "update User_Card set FK_User=@FK_User,card_Status=1 where card_Number=@card_Number"; IDataParameter[] dp_usercard = { DbHelp.Def.AddParam("@FK_User", uid), DbHelp.Def.AddParam("@card_Number", infoMod.UserCard), }; if (tHelp.Update(sql, dp_usercard) <= 0) { lsTrans.returnValue = "注册失败2"; return(0); } //赠送经验 slog = new User_InfoL(tHelp).SetUserExp(uid, uid, "reg_card", lsTrans.Exp, "system", "注册使用会员卡 \"" + infoMod.UserCard + "\" 赠送" + lsTrans.Exp + "经验"); if (slog != "1") { lsTrans.returnValue = slog; return(0); } } lsTrans.returnValue = "1"; return(1); }