public static MemberInfo GetFullInfo(string userId, MemberType userType) { MemberInfo model = null; MemberInfo mbll = null; switch (userType) { case MemberType.Personal: mbll = new PersonMemberInfo(); break; case MemberType.Famly: mbll = new FamlyMemberInfo(); break; case MemberType.Company: mbll = new CompanyMemberInfo(); break; case MemberType.School: mbll = new SchoolMemberInfo(); break; } if (mbll != null) { model = mbll.GetFullUserInfo(userId); } return(model); }
private CompanyMemberInfo ReaderBind(IDataReader dataReader) { CompanyMemberInfo model = new CompanyMemberInfo(); object ojb; model.UserId = dataReader["UserId"].ToString(); model.UserEmail = dataReader["UserEmail"].ToString(); model.Password = dataReader["Password"].ToString(); model.UserName = dataReader["UserName"].ToString(); ojb = dataReader["AllScore"]; if (ojb != null && ojb != DBNull.Value) { model.AllScore = (int)ojb; } ojb = dataReader["CurScore"]; if (ojb != null && ojb != DBNull.Value) { model.CurScore = (int)ojb; } ojb = dataReader["LastLogin"]; if (ojb != null && ojb != DBNull.Value) { model.LastLogin = (DateTime)ojb; } model.LoginIp = dataReader["LoginIP"].ToString(); ojb = dataReader["RegisterTime"]; if (ojb != null && ojb != DBNull.Value) { model.RegisterTime = (DateTime)ojb; } ojb = dataReader["ModifyTime"]; if (ojb != null && ojb != DBNull.Value) { model.ModifyTime = (DateTime)ojb; } ojb = dataReader["UserType"]; if (ojb != null && ojb != DBNull.Value) { model.UserType = (MemberType)(Convert.ToInt32(ojb)); } ojb = dataReader["status"]; if (ojb != null && ojb != DBNull.Value) { model.Status = (MemberStatus)(Convert.ToInt32(ojb)); } ojb = dataReader["UserLevel"]; if (ojb != null && ojb != DBNull.Value) { model.UserLevel = (UserLevel)(Convert.ToInt32(ojb)); } model.IdCard = dataReader["IdCard"].ToString(); model.CompanyName = dataReader["companyname"].ToString(); model.Address = dataReader["Address"].ToString(); model.Country = dataReader["country"].ToString(); model.Province = dataReader["province"].ToString(); model.City = dataReader["city"].ToString(); model.County = dataReader["county"].ToString(); model.RegionPath = dataReader["regionPath"].ToString(); model.Mobile = dataReader["Mobile"].ToString(); model.Telephone = dataReader["TelePhone"].ToString(); model.Fax = dataReader["fax"].ToString(); return model; }
private CompanyMemberInfo ReaderBind(IDataReader dataReader) { CompanyMemberInfo model = new CompanyMemberInfo(); object ojb; model.UserId = dataReader["UserId"].ToString(); model.UserEmail = dataReader["UserEmail"].ToString(); model.Password = dataReader["Password"].ToString(); model.UserName = dataReader["UserName"].ToString(); ojb = dataReader["AllScore"]; if (ojb != null && ojb != DBNull.Value) { model.AllScore = (int)ojb; } ojb = dataReader["CurScore"]; if (ojb != null && ojb != DBNull.Value) { model.CurScore = (int)ojb; } ojb = dataReader["LastLogin"]; if (ojb != null && ojb != DBNull.Value) { model.LastLogin = (DateTime)ojb; } model.LoginIp = dataReader["LoginIP"].ToString(); ojb = dataReader["RegisterTime"]; if (ojb != null && ojb != DBNull.Value) { model.RegisterTime = (DateTime)ojb; } ojb = dataReader["ModifyTime"]; if (ojb != null && ojb != DBNull.Value) { model.ModifyTime = (DateTime)ojb; } ojb = dataReader["UserType"]; if (ojb != null && ojb != DBNull.Value) { model.UserType = (MemberType)(Convert.ToInt32(ojb)); } ojb = dataReader["status"]; if (ojb != null && ojb != DBNull.Value) { model.Status = (MemberStatus)(Convert.ToInt32(ojb)); } ojb = dataReader["UserLevel"]; if (ojb != null && ojb != DBNull.Value) { model.UserLevel = (UserLevel)(Convert.ToInt32(ojb)); } model.IdCard = dataReader["IdCard"].ToString(); model.CompanyName = dataReader["companyname"].ToString(); model.Address = dataReader["Address"].ToString(); model.Country = dataReader["country"].ToString(); model.Province = dataReader["province"].ToString(); model.City = dataReader["city"].ToString(); model.County = dataReader["county"].ToString(); model.RegionPath = dataReader["regionPath"].ToString(); model.Mobile = dataReader["Mobile"].ToString(); model.Telephone = dataReader["TelePhone"].ToString(); model.Fax = dataReader["fax"].ToString(); return(model); }
public static MemberInfo GetFullInfo(string userId, MemberType userType) { MemberInfo model = null; MemberInfo mbll = null; switch (userType) { case MemberType.Personal: mbll = new PersonMemberInfo(); break; case MemberType.Famly: mbll = new FamlyMemberInfo(); break; case MemberType.Company: mbll = new CompanyMemberInfo(); break; case MemberType.School: mbll = new SchoolMemberInfo(); break; } if (mbll != null) { model = mbll.GetFullUserInfo(userId); } return model; }
protected void btnRegister_Click(object sender, EventArgs e) { string userId = txtUserId.Text.Trim(); string useremail = txtUserEmail.Text.Trim(); string userName = txtUserName.Text.Trim(); string password1 = txtPassword1.Text; string password2 = txtPassword2.Text; string vcode = txtValidCode.Text; ValidateHelper vhelper = new ValidateHelper(); if (!String.IsNullOrEmpty(password1) && (password1 == password2) && vhelper.Validate(vcode, true)) { if (!MemberInfo.Exists(userId, useremail)) { CompanyMemberInfo memberModel = new CompanyMemberInfo(); memberModel.UserEmail = useremail; memberModel.UserId = userId; memberModel.UserType = MemberType.Company; memberModel.UserName = userName; memberModel.Password = password1; memberModel.Status = MemberStatus.Initiation; memberModel.LoginIp = Request.UserHostAddress; memberModel.CompanyName = txtCompanyName.Text.Trim(); memberModel.IdCard = txtIdCard.Text.Trim(); memberModel.Telephone = txtTelephone.Text.Trim(); memberModel.Mobile = txtMobile.Text.Trim(); memberModel.Fax = txtFax.Text.Trim(); RegionInfo regionInfo = ucRegion.GetSelectedRegionInfo(); memberModel.RegionPath = regionInfo.RegionPath; memberModel.Country = regionInfo.Country; memberModel.Province = regionInfo.Province; memberModel.City = regionInfo.City; memberModel.County = regionInfo.County; memberModel.Address = txtAddress.Text.Trim(); memberModel.Save(); panReg.Visible = false; panRegOk.Visible = true; ClientAlert("亲爱的" + userName + ",您已成功注册鼎鼎会员,欢迎继续进行其他操作"); IMMessage.NotifyHelper.SendMessage(userId, "欢迎您注册为鼎鼎会员", "欢迎您注册为鼎鼎会员"); string userData = String.Format("{0}:{1}:{2}:{3}:{4}", memberModel.UserEmail, memberModel.UserName, (int)memberModel.Status, (int)memberModel.UserType, (int)memberModel.UserLevel); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, userId, DateTime.Now, DateTime.Now.AddMinutes(30), true, userData, FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ticket); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); if (!String.IsNullOrEmpty(Request.QueryString["returnUrl"])) { //Response.AddHeader("REFRESH", "3;URL='" + Request.QueryString["returnUrl"] + "'"); Response.Redirect(Request.QueryString["returnUrl"], true); } else { Response.Redirect("~/member/myProfile.aspx", true); } } else { lblPrompt.Text = "用户已存在!"; } } else { lblPrompt.Text = "验证失败,请检查你的密码是否一致!"; } }