public string GetUserGorupModel(string value) { int gid = DataConverter.CLng(value); int UserModelID = DataConverter.CLng(gpBll.GetGroupModel(gid)); ///UserModelID!=0说明绑定了户模型,用要从模型中读取字段,没有绑定就不需要读取字段 //if (UserModelID != 0) //{ // return fieldBll.InputallHtml(UserModelID, 0, new ModelConfig() // { // Source = ModelConfig.SType.UserBase // }); //} return(""); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { M_UserInfo mu = buser.GetLogin(false); this.LblUser.Text = mu.UserName; this.LblEmail.Text = mu.Email; this.LblGroup.Text = bgp.GetByID(mu.GroupID).GroupName; this.LblJoinTime.Text = mu.JoinTime.ToString(); this.LblRegTime.Text = mu.RegTime.ToString(); this.LblLoginTimes.Text = mu.LoginTimes.ToString(); this.LblLastLogin.Text = mu.LastLoginTimes.ToString(); this.LblLastIP.Text = IPScaner.IPLocation(mu.LastLoginIP); this.LblLastModify.Text = (mu.LastPwdChangeTime == mu.RegTime) ? "" : mu.LastPwdChangeTime.ToString(); this.LblLastLock.Text = (mu.LastLockTime == mu.RegTime) ? "" : mu.LastLockTime.ToString(); this.Purse_L.Text = mu.Purse.ToString(); this.Point_L.Text = mu.UserExp.ToString(); Sicon_L.Text = mu.SilverCoin.ToString(); UserPoint_L.Text = mu.UserPoint.ToString(); this.LblboffExp.Text = mu.boffExp.ToString(); this.LblConsumeExp.Text = mu.ConsumeExp.ToString(); this.DummyPurse_L.Text = mu.DummyPurse.ToString(); M_PointGrounp pointmod = pointBll.SelectPintGroup(mu.UserExp); gradeTxt.Text = ""; if (pointmod != null) { gradeTxt.Text = pointmod.GroupName; LvIcon_Span.Attributes["class"] = pointmod.ImgUrl; } if (DataConvert.CLng(mu.ParentUserID) > 0) { M_UserInfo usinfo = buser.GetSelect(Convert.ToInt32(mu.ParentUserID)); LblParentUserID.Text = string.IsNullOrEmpty(usinfo.UserName) ? "" : usinfo.UserName; } int UserModelID = DataConverter.CLng(bgp.GetGroupModel(mu.GroupID)); if (UserModelID > 0) { GroupModelField_Li.Text = Fll.InputallHtml(UserModelID, 0, new ModelConfig() { ValueDT = bmodel.SelUserModelField(UserModelID, mu.UserID) }); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { M_UserInfo uinfo = buser.GetLogin(false); this.LblUser.Text = uinfo.UserName; this.LblEmail.Text = uinfo.Email; this.LblGroup.Text = bgp.GetByID(uinfo.GroupID).GroupName; this.LblJoinTime.Text = uinfo.JoinTime.ToString(); this.LblRegTime.Text = uinfo.RegTime.ToString(); this.LblLoginTimes.Text = uinfo.LoginTimes.ToString(); this.LblLastLogin.Text = uinfo.LastLoginTimes.ToString(); this.LblLastIP.Text = uinfo.LastLoginIP; this.LblLastModify.Text = (uinfo.LastPwdChangeTime == uinfo.RegTime) ? "" : uinfo.LastPwdChangeTime.ToString(); this.LblLastLock.Text = (uinfo.LastLockTime == uinfo.RegTime) ? "" : uinfo.LastLockTime.ToString(); this.Purse_L.Text = uinfo.Purse.ToString(); this.Point_L.Text = uinfo.UserExp.ToString(); Sicon_L.Text = uinfo.SilverCoin.ToString(); UserPoint_L.Text = uinfo.UserPoint.ToString(); this.LblboffExp.Text = uinfo.boffExp.ToString(); this.LblConsumeExp.Text = uinfo.ConsumeExp.ToString(); this.DummyPurse_L.Text = uinfo.DummyPurse.ToString(); M_PointGrounp pointmod = pointBll.SelectPintGroup(uinfo.UserExp); gradeTxt.Text = ""; if (pointmod != null) { gradeTxt.Text = pointmod.GroupName; LvIcon_Span.Attributes["class"] = pointmod.ImgUrl; } if (DataConvert.CLng(uinfo.ParentUserID) > 0) { M_UserInfo usinfo = buser.GetSelect(Convert.ToInt32(uinfo.ParentUserID)); LblParentUserID.Text = string.IsNullOrEmpty(uinfo.UserName) ? "" : uinfo.UserName; } int UserModelID = DataConverter.CLng(bgp.GetGroupModel(uinfo.GroupID)); if (UserModelID > 0) { GroupModelField_Li.Text = Fll.GetUpdateHtmlUser(UserModelID, 0, bmodel.SelUserModelField(UserModelID, uinfo.UserID)); } } }
public ActionResult Register_Submit() { B_UserBaseField bmf = new B_UserBaseField(); string siteurls = SiteConfig.SiteInfo.SiteUrl.TrimEnd('/'); if (!SiteConfig.UserConfig.EnableUserReg) { function.WriteErrMsg("服务器已关闭用户注册"); return(null); } //----------------------------------- M_UserInfo info = new M_UserInfo(); info.UserBase = new M_Uinfo(); info.UserName = Request.Form["TxtUserName"].Replace(" ", ""); info.UserPwd = Request.Form["TxtPassword"]; info.Question = Request.Form["Question_DP"]; info.Answer = Request.Form["TxtAnswer"]; info.Email = Request.Form["TxtEmail"].Replace(" ", ""); info.CheckNum = function.GetRandomString(10); info.GroupID = DataConverter.CLng(Request.Form["UserGroup"]); info.RegisterIP = EnviorHelper.GetUserIP(); info.LastLoginIP = info.RegisterIP; //info.Purse = SiteConfig.UserConfig.PresentMoney;//注册赠送的余额,积分等 //info.UserPoint = SiteConfig.UserConfig.PresentPoint; //info.UserExp = DataConverter.CLng(SiteConfig.UserConfig.PresentExp); info.TrueName = Request.Form["TxtTrueName"]; info.UserPwd = StringHelper.MD5(info.UserPwd);; //----------------------------------------------------- //会员基本信息 info.UserBase.Address = Request.Form["TxtAddress"]; info.UserBase.BirthDay = Request.Form["TxtBirthday"]; info.UserFace = Request.Form["TxtUserFace"]; info.UserBase.Fax = Request.Form["TxtFax"]; info.UserBase.HomePage = Request.Form["TxtHomepage"]; info.UserBase.HomePhone = Request.Form["TxtHomePhone"]; info.UserBase.IDCard = Request.Form["TxtIDCard"]; info.UserBase.Mobile = Request.Form["TxtMobile"]; info.UserBase.OfficePhone = Request.Form["TxtOfficePhone"]; info.UserBase.Privating = DataConvert.CLng(Request.Form["DropPrivacy"]); info.UserBase.PHS = Request.Form["TxtPHS"]; info.UserBase.QQ = Request.Form["TxtQQ"]; info.UserBase.Sign = Request.Form["TxtSign"]; info.UserBase.UserSex = DataConverter.CBool(Request.Form["DropSex"]); info.UserBase.ZipCode = Request.Form["TxtZipCode"]; info.UserBase.HoneyName = ""; info.UserBase.CardType = ""; info.UserBase.Province = Request["selprovince"]; info.UserBase.City = Request["selcity"]; info.UserBase.County = Request["selcoutry"]; if (!string.IsNullOrEmpty(RegisterMobile)) { info.UserBase.Mobile = RegisterMobile; RegisterMobile = null; } //----------------------------------------------------- #region 信息检测 string err = ""; if (SiteConfig.UserConfig.EnableCheckCodeOfReg) { if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"])) { function.WriteErrMsg("您输入的验证码和系统产生的不一致,请重新输入", "javascript:history.go(-1);"); return(null); } } if (!CheckUserName(info.UserName, ref err)) { function.WriteErrMsg(err); return(null); } else if (!CheckUserInfo(info.UserBase)) { return(null); } else if (string.IsNullOrEmpty(info.Answer)) { function.WriteErrMsg("问题答案不能为空!"); return(null); } else if (!CheckEmail(info.Email, ref err)) { function.WriteErrMsg(err); return(null); } #endregion //推荐人处理 M_User_InviteCode utMod = null; { //支持使用用户名和用户ID info.ParentUserID = CheckParentUser(Request.Form["TxtParentUser"]).UserID.ToString(); //邀请码推荐用户,高于填写的推荐人 string inviteCode = Request.Form["TxtInvitCode"]; if (!string.IsNullOrEmpty(inviteCode)) { utMod = utBll.Code_SelModel(inviteCode); if (utMod != null) { if (utMod.ZStatus != 0) { function.WriteErrMsg("该邀请码已被使用"); return(null); } info.ParentUserID = utMod.UserID.ToString(); info.GroupID = utMod.JoinGroup; } } //计算深度 if (DataConvert.CLng(info.ParentUserID) > 0)//从1开始 { info.RoomID = (buser.SelParentTree(DataConvert.CLng(info.ParentUserID)).Split(',').Length + 1); } } //用于初始状态 if (SiteConfig.UserConfig.EmailCheckReg) { info.Status = 4; } //邮件认证 else if (SiteConfig.UserConfig.AdminCheckReg) { info.Status = 2; } //管理员认证 else if (SiteConfig.UserConfig.EmailCheckReg && SiteConfig.UserConfig.AdminCheckReg) { info.Status = 3; } //邮件认证及管理员认证 else if (!SiteConfig.UserConfig.UserValidateType) { info.Status = 5; } else { info.Status = 0; } //自定义字段信息 DataTable table; try { table = new Call().GetDTFromMVC(bmf.Select_All(), Request); } catch (Exception e) { function.WriteErrMsg(e.Message); return(Content("")); } string[] strArray2 = string.IsNullOrEmpty(SiteConfig.UserConfig.RegFieldsMustFill) ? new string[0] : SiteConfig.UserConfig.RegFieldsMustFill.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); foreach (string str2 in strArray2) { if (Request.Form["txt_" + str2] == null || Request.Form["txt_" + str2] == "") { DataTable tbles = bmf.SelByFieldName(str2); } } //------------添加新用户 info.UserID = buser.AddModel(info); info.UserBase.UserId = info.UserID; buser.AddBase(info.UserBase); if (table != null && table.Rows.Count > 0) { buser.UpdateUserFile(info.UserID, table); } buser.SetLoginState(info); if (info.UserID < 1) { function.WriteErrMsg("注册失败"); return(null); } //邀请码状态变更 if (utMod != null) { utBll.Code_Used(utMod.ID, info); } //---------------------------------------------------------------------------- string ReturnUrl = Request.Form["ReturnUrl_Hid"]; string RegMessage = ""; string RegRUrl = ""; bool isok = false; //关联绑定微信用户 //if (!string.IsNullOrEmpty(WXOpenID)) //{ // B_User_Token tokenBll = new B_User_Token(); // M_User_Token tokenMod = tokenBll.SelModelByUid(info.UserID); // if (tokenMod == null) { tokenMod = new M_User_Token(); } // tokenMod.uid = info.UserID; // tokenMod.WXOpenID = WXOpenID; // tokenBll.Insert(tokenMod); //} #region 自定义模型 int ModelID = DataConverter.CLng(gpBll.GetGroupModel(info.GroupID)); string usertablename = modBll.GetModelById(ModelID).TableName; if (ModelID > 0 && usertablename != "" && usertablename != null) { DataTable groupset = fieldBll.GetModelFieldListall(ModelID); DataTable tablereg = new DataTable(); tablereg.Columns.Add(new DataColumn("FieldName", typeof(string))); tablereg.Columns.Add(new DataColumn("FieldType", typeof(string))); tablereg.Columns.Add(new DataColumn("FieldValue", typeof(string))); if (groupset != null && groupset.Rows.Count > 0) { foreach (DataRow dr in groupset.Rows) { 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 = tablereg.NewRow(); row2[0] = sizefield; row2[1] = "FileSize"; row2[2] = Request.Form["txt_" + sizefield]; tablereg.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(Request.Form["txt_" + sizefield])) { function.WriteErrMsg(dr["FieldAlias"].ToString() + "的缩略图不能为空!"); } DataRow row1 = tablereg.NewRow(); row1[0] = sizefield; row1[1] = "ThumbField"; row1[2] = Request.Form["txt_" + sizefield]; tablereg.Rows.Add(row1); } } DataRow row = tablereg.NewRow(); row[0] = dr["FieldName"].ToString(); string ftype = dr["FieldType"].ToString(); row[1] = ftype; string fvalue = Request.Form["txt_" + dr["FieldName"].ToString()]; if (ftype == "TextType" || ftype == "MultipleTextType" || ftype == "MultipleHtmlType") { if (dr["IsNotNull"].Equals("True") && string.IsNullOrEmpty(fvalue)) { function.WriteErrMsg(dr["FieldAlias"] + ":不能为空!"); } } row[2] = fvalue; tablereg.Rows.Add(row); } try { if (tablereg.Select("FieldName='UserID'").Length == 0) { DataRow rowsd1 = tablereg.NewRow(); rowsd1[0] = "UserID"; rowsd1[1] = "int"; rowsd1[2] = info.UserID; tablereg.Rows.Add(rowsd1); } else { tablereg.Rows[0]["UserID"] = info.UserID; } } catch (Exception) { } try { if (tablereg.Select("FieldName='UserName'").Length == 0) { DataRow rowsd2 = tablereg.NewRow(); rowsd2[0] = "UserName"; rowsd2[1] = "TextType"; rowsd2[2] = info.UserName; tablereg.Rows.Add(rowsd2); } else { tablereg.Rows[0]["UserName"] = info.UserName; } } catch (Exception) { } try { if (tablereg.Select("FieldName='Styleid'").Length == 0) { DataRow rowsd3 = tablereg.NewRow(); rowsd3[0] = "Styleid"; rowsd3[1] = "int"; rowsd3[2] = 0; tablereg.Rows.Add(rowsd3); } else { tablereg.Rows[0]["UserName"] = 0; } } catch (Exception) { } try { if (tablereg.Select("FieldName='Recycler'").Length == 0) { DataRow rowsd4 = tablereg.NewRow(); rowsd4[0] = "Recycler"; rowsd4[1] = "int"; rowsd4[2] = 0; tablereg.Rows.Add(rowsd4); } else { tablereg.Rows[0]["Recycler"] = 0; } } catch (Exception) { } try { if (tablereg.Select("FieldName='IsCreate'").Length == 0) { DataRow rowsd5 = tablereg.NewRow(); rowsd5[0] = "IsCreate"; rowsd5[1] = "int"; rowsd5[2] = 0; tablereg.Rows.Add(rowsd5); } else { tablereg.Rows[0]["IsCreate"] = 0; } } catch (Exception) { } try { if (tablereg.Select("FieldName='NewTime'").Length == 0) { DataRow rs6 = tablereg.NewRow(); rs6[0] = "NewTime"; rs6[1] = "DateType"; rs6[2] = DateTime.Now; tablereg.Rows.Add(rs6); } else { tablereg.Rows[0]["NewTime"] = DateTime.Now; } } catch (Exception) { } } if (tablereg != null && tablereg.Rows.Count > 0) { buser.InsertModel(tablereg, usertablename); } } #endregion if (SiteConfig.UserConfig.EmailCheckReg && !string.IsNullOrEmpty(info.Email))//发送认证邮件,当需要邮件认证时 { MailInfo mailInfo = new MailInfo(); mailInfo.IsBodyHtml = true; mailInfo.FromName = SiteConfig.SiteInfo.SiteName; MailAddress address = new MailAddress(info.Email); mailInfo.ToAddress = address; string regurl = siteurls + "/User/RegisterCheck?UserName="******"&CheckNum=" + info.CheckNum; string mailcontent = mailBll.SelByType(B_MailManage.MailType.NewUserReg); mailInfo.MailBody = new OrderCommon().TlpDeal(mailcontent, GetRegEmailDt(info.UserName, info.CheckNum, regurl)); mailInfo.Subject = SiteConfig.SiteInfo.SiteName + "网站会员注册验证码"; if (SendMail.Send(mailInfo) == SendMail.MailState.Ok) { RegMessage = "注册验证码已成功发送到你的注册邮箱,请到邮箱查收并验证!"; RegMessage = RegMessage + "<a href=\"/\">返回首页</a>"; } else { RegMessage = "注册成功,但发送验证邮件失败,请检查邮件地址是否正确,或与网站管理员联系!"; RegMessage = RegMessage + "<a href=\"/\">返回首页</a>"; } } switch (info.Status) { case 0: #region 直接注册成功 if (!string.IsNullOrEmpty(info.Email) && SiteConfig.UserConfig.EmailTell) { MailInfo mailInfo = new MailInfo(); mailInfo.IsBodyHtml = true; mailInfo.FromName = SiteConfig.SiteInfo.SiteName; MailAddress address = new MailAddress(info.Email); mailInfo.ToAddress = address; //SiteConfig.UserConfig.EmailOfRegCheck string regurl = siteurls + "/User/RegisterCheck?UserName="******"&CheckNum=" + info.CheckNum; mailInfo.MailBody = new OrderCommon().TlpDeal(mailBll.SelByType(B_MailManage.MailType.NewUserReg), GetRegEmailDt(info.UserName, info.CheckNum, regurl)); //mailInfo.MailBody = mailInfo.MailBody.Replace("{$UserName}", info.UserName).Replace("{$UserPwd}", TxtPassword.Text); mailInfo.Subject = SiteConfig.SiteInfo.SiteName + "_注册成功提醒"; if (SendMail.Send(mailInfo) == SendMail.MailState.Ok) { RegMessage = "注册基本信息已成功发送到你的注册邮箱!"; RegMessage = RegMessage + "<a href=\"/\">返回首页</a>"; } else { RegMessage = "注册成功,但发送注册基本信息邮件失败,请检查邮件地址是否正确,或与网站管理员联系!"; RegMessage = RegMessage + "<a href=\"/\">返回首页</a>"; } } else { RegMessage = "注册成功!"; if (string.IsNullOrEmpty(ReturnUrl)) { RegMessage = RegMessage + "<a href=\"/\">返回首页</a> <a href=\"/User/Index\">进入会员中心</a>,5秒后系统自动跳转到会员中心!"; RegRUrl = "/User/Index"; } else { RegMessage = RegMessage + "<a href=\"/\">返回首页</a> <a href=\"" + ReturnUrl + "\">进入默认页面</a>,5秒后系统自动跳转到默认页面!"; RegRUrl = ReturnUrl; } isok = true; } #endregion break; case 2: //等待管理员认证 RegMessage = "注册成功!新注册会员需管理员认证才能有效,请耐心等待!"; RegMessage = RegMessage + "若长期没有通过管理员认证,请及时和管理员联系!"; RegMessage = RegMessage + "<a href=\"/\">返回首页</a>"; break; default: //未开启邮箱验证,则可以登录 if (!SiteConfig.UserConfig.EmailCheckReg) { RegMessage = "注册成功!"; } if (string.IsNullOrEmpty(ReturnUrl)) { RegMessage = RegMessage + "<a href=\"/\">返回首页</a> <a href=\"/User/Index\">进入会员中心</a>,5秒后系统自动跳转到会员中心!"; RegRUrl = "default"; } else { RegMessage = RegMessage + "<a href=\"/\">返回首页</a> <a href=\"" + ReturnUrl + "\">进入默认页面</a>,5秒后系统自动跳转到默认页面!"; RegRUrl = ReturnUrl; } isok = true; break; } if (SiteConfig.UserConfig.EmailCheckReg) { RegMessage = "<div class='emptyDiv'><br/>注册成功! <a href='http://mail." + info.Email.Substring(info.Email.LastIndexOf('@') + 1) + "' target='_blank'>立即登录邮箱进行验证>></a><br/></div>"; isok = false; } ViewBag.RegMessage = RegMessage; ViewBag.RegRUrl = RegRUrl; ViewBag.isok = isok;//为true则自动跳转 ViewBag.pwd = Request.Form["TxtPassword"]; return(View("Register_Finish", info)); }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { switchID.Value = HttpUtility.HtmlEncode(Request.QueryString["sel"]); if (!buser.CheckLogin()) { function.WriteErrMsg("请先<a href=/User/Login.aspx>登录</a>!", "/User/Login.aspx"); } else { M_UserInfo uinfo = buser.GetLogin(); //CompanyGroup是否为企业用户组0-否 1-是 if (bgp.GetByID(Convert.ToInt32(uinfo.GroupID)).CompanyGroup == 1) { this.DivCompany.Visible = true; this.txtCompanyName.Text = uinfo.CompanyName; this.txtCompanyDescribe.Text = uinfo.CompanyDescribe; } string modellist = bgp.GetGroupModel(uinfo.GroupID); M_Uinfo binfo = buser.GetUserBaseByuserid(uinfo.UserID); if (!binfo.IsNull) { tbTrueName.Text = uinfo.TrueName; txtHonName.Text = uinfo.HoneyName; tbUserSex.SelectedValue = binfo.UserSex ? "1" : "0"; address.Value = binfo.Province + "," + binfo.City + "," + binfo.County; tbAddress.Text = binfo.Address; tbBirthday.Text = binfo.BirthDay; tbFaceWidth.Text = binfo.FaceWidth.ToString(); tbFaceHeight.Text = binfo.FaceHeight.ToString(); tbFax.Text = binfo.Fax; tbHomepage.Text = binfo.HomePage; tbHomePhone.Text = binfo.HomePhone; //tbICQ.Text = binfo.ICQ; tbIDCard.Text = binfo.IDCard; tbMobile.Text = binfo.Mobile; tbMSN.Text = binfo.MSN; tbOfficePhone.Text = binfo.OfficePhone; //tbPHS.Text = binfo.PHS; tbPrivacy.SelectedValue = binfo.Privating.ToString(); tbQQ.Text = binfo.QQ; tbSign.Text = binfo.Sign; tbUC.Text = binfo.UC; UserFace_Hid.Value = Path.GetFileName(uinfo.UserFace); tbUserFace.Text = uinfo.UserFace; face.ImageUrl = uinfo.UserFace; //tbYahoo.Text = binfo.Yahoo; tbZipCode.Text = binfo.ZipCode; //公司信息与职务 this.Position.Text = binfo.Position; this.CompanyName.Text = binfo.CompanyName; this.face.ImageUrl = string.IsNullOrEmpty(binfo.UserFace) ? "/Images/userface/noface.gif" : binfo.UserFace; } lblHtml.Text = ubfbll.GetUpdateHtml(uinfo.UserID); //lblHtml.Text = lblHtml.Text.Replace("tdbg", ""); } //-----权限块 if (SiteConfig.UserConfig.UserMobilAuth.Equals("0")) { tbMobile.Enabled = false; } }//IsPostBack }