protected void btnRegister_Click(object sender, EventArgs e) { string UserName = Utils.GetFormValue("username"); string Password = Utils.GetFormValue("userpwd"); string Email = Utils.GetFormValue("usermail"); string Province = "0"; string City = "0"; string HomeTown = "0"; //判断用户是否被占用 if (BMember.IsEmailExist(Email) == true) { MessageBox.ShowAndReturnBack("此Email已经被注册,请重新填写Email信息"); return; } var IsExist = BMember.IsExist(UserName); if (IsExist == false) { var model = new MbmemberDTO() { id = System.Guid.NewGuid().ToString(), user_name = UserName, password = Password, nickname = UserName, mail = Email, khqy1 = Province, khqy2 = City, khqy3 = HomeTown, publishtarget = Target, create_date = DateTime.Now }; var Result = BMember.Add(model); if (Result) { MessageBox.ShowAndRedirect("用户注册成功!", "Login.aspx"); return; } else { MessageBox.ShowAndReturnBack("用户注册失败!"); return; } } else { MessageBox.ShowAndReturnBack("用户名被占用,请重新选择新的用户名!"); return; } }
/// <summary> /// 会员注册 /// </summary> public static bool Update(MbmemberDTO model) { var result = APIOP<MbmemberDTO>.Update(RemoteDomain + "/Mbmember/Update", model); return result.flag; }
/// <summary> /// 会员注册 /// </summary> public static bool Add(MbmemberDTO model) { var result = APIOP<MbmemberDTO>.Add(RemoteDomain + "/Mbmember/Add", model); return result.flag; }
protected void btnSave_Click(object sender, EventArgs e) { string UserName = Utils.GetFormValue("username"); string Password = Utils.GetFormValue("userpwd"); string Email = Utils.GetFormValue("usermail"); string Province = Utils.GetFormValue("seachprov"); string City = Utils.GetFormValue("homecity"); string HomeTown = Utils.GetFormValue("seachdistrict"); if (string.IsNullOrWhiteSpace(UserName)) { MessageBox.ShowAndReturnBack("用户名不可为空"); return; } if (string.IsNullOrWhiteSpace(Password)) { MessageBox.ShowAndReturnBack("密码不可为空"); return; } if (string.IsNullOrWhiteSpace(Email)) { MessageBox.ShowAndReturnBack("邮箱不可为空"); return; } if (string.IsNullOrWhiteSpace(Province)) { MessageBox.ShowAndReturnBack("请选择所在省份"); return; } if (string.IsNullOrWhiteSpace(City)) { MessageBox.ShowAndReturnBack("请选择所在城市"); return; } if (BMember.IsEmailExist(Email)==true) { MessageBox.ShowAndReturnBack("此Email已经被注册,请重新填写Email信息"); return; } //判断用户是否被占用 var IsExist = BMember.IsExist(UserName); if (IsExist == false) { var model = new MbmemberDTO() { id = System.Guid.NewGuid().ToString(), user_name = UserName, password = Password, nickname = UserName, mail = Email, khqy1 = Province, khqy2 = City, khqy3 = HomeTown, publishtarget = Target, create_date = DateTime.Now }; var Result = BMember.Add(model); if (Result) { MessageBox.ShowAndRedirect("用户注册成功!","/Default.aspx"); return; } else { MessageBox.ShowAndReturnBack("用户注册失败!"); return; } } else { MessageBox.ShowAndReturnBack("用户名被占用,请重新选择新的用户名!"); return; } }
public void ProcessRequest(HttpContext context) { bool IsResult = false; string msg = "登陆失败!"; int Target = Utils.GetInt(Utils.GetQueryStringValue("Target")); string LoginType = Utils.GetQueryStringValue("LoginType"); string openId = Utils.GetQueryStringValue("openId"); string accessToken = Utils.GetQueryStringValue("accessToken"); string head = Utils.GetQueryStringValue("head"); string nickname = Utils.GetQueryStringValue("nickname"); context.Response.ContentType = "text/plain"; context.Response.Expires = 0; context.Response.CacheControl = "no-cache"; context.Response.Cache.SetNoStore(); switch (LoginType) { case "QQ": if (!String.IsNullOrWhiteSpace(openId)) { var IsExist = BMember.IsExist(第三方登陆类型.QQ, openId); if (IsExist == false) { var model = new MbmemberDTO() { id = System.Guid.NewGuid().ToString(), user_name = openId, password = "******", nickname = nickname, mail = "", khqy1 = "0", khqy2 = "0", khqy3 = "0", head = head, hzwzlx = 第三方登陆类型.QQ.ToString(), wzid = openId, publishtarget = Target, create_date = DateTime.Now }; var Result = BMember.Add(model); if (Result) { var result = BMember.Login(第三方登陆类型.QQ, openId); if (result != null) { HttpCookie Hc = new HttpCookie(BasePage._AuthorName); Hc.Values.Add("Id", result.id); Hc.Values.Add("UserName", result.user_name); Hc.Values.Add("nickname", result.nickname); HttpContext.Current.Response.Cookies.Add(Hc); msg = "用户登陆成功!"; IsResult = true; } else { msg = "用户登陆失败!"; } } else { msg = "添加用户失败!"; } } else { var result = BMember.Login(第三方登陆类型.QQ, openId); if (result != null) { HttpCookie Hc = new HttpCookie(BasePage._AuthorName); Hc.Values.Add("Id", result.id); Hc.Values.Add("UserName", result.user_name); Hc.Values.Add("nickname", result.nickname); HttpContext.Current.Response.Cookies.Add(Hc); msg = "用户登陆成功!"; IsResult = true; } else { msg = "用户登陆失败!"; } } } else { msg = "取得用户标识失败!"; } break; } Utils.RCWE(UtilsCommons.AjaxReturnJson(IsResult ? "1" : "0", msg)); }