public ActionResult AddTUser() { TUserDto dto = new TUserDto(); dto.UserName = "******"; dto.UserPwd = "123123"; dto.BankPwd = "123123"; dto.NickName = "123"; dto.UserJb = 100; dto.TrueName = "中文"; dto.IdentityNum = "111111111111111111"; dto.Phone = "18020637512"; dto.RegIP = CommonManager.WebObj.GetWebClientIp(); dto.TxUrl = ""; dto.State = 1; dto.Addtime = DateTime.Now; _bll.AddTUser(dto); return JsonFormat(new ExtJson { success = true, msg = "添加成功!" }); }
public void AddTUser(TUserDto dto) { if (dto == null) throw new ArgumentNullException(); var _unitOfWork = _repostory.UnitOfWork; var _build = TUserFactory.Create( dto.UserName, dto.UserPwd, dto.BankPwd, dto.NickName, dto.UserJb, dto.TrueName, dto.IdentityNum, dto.Phone, dto.RegIP, dto.TxUrl, dto.State, dto.Addtime ); _repostory.Add(_build); _unitOfWork.Commit(); }
/// <summary> /// 完整注册 /// </summary> /// <returns></returns> public ActionResult FullRegTUser() { TUserDto dto = new TUserDto(); dto.UserName = CommonManager.WebObj.RequestForm("UserName", ""); dto.UserPwd = CommonManager.WebObj.RequestForm("UserPwd", "").MD5(); dto.BankPwd = CommonManager.WebObj.RequestForm("BankPwd", "").MD5(); dto.NickName = CommonManager.WebObj.RequestForm("NickName", ""); dto.TrueName = CommonManager.WebObj.RequestForm("TrueName", ""); dto.IdentityNum = CommonManager.WebObj.RequestForm("IdentityNum", ""); dto.Phone = CommonManager.WebObj.RequestForm("Phone", ""); dto.RegIP = CommonManager.WebObj.GetWebClientIp(); dto.TxUrl= CommonManager.WebObj.RequestForm("TxUrl", ""); Dictionary<string, object> list = new Dictionary<string, object>(); int result = -1; //注册结果 string msg = "注册成功!"; if (!string.IsNullOrEmpty(dto.UserName) || !string.IsNullOrEmpty(dto.UserPwd)) { _bll.RegTUser(dto, out list); if (list.Count > 0) { result = Convert.ToInt32(list["@ReturnValue"]); switch (result) { case 1: Session["Userid"] = list["@Userid"].ToString(); break; default: msg = "注册失败!"; break; } } } if (result == 1) return JsonFormat(new ExtJson { success = true, msg = msg }); else return JsonFormat(new ExtJson { success = false, msg = msg }); }
public int VerifyTUsers(TUserDto dto) { int result = _dal.VerifyUserByUnamePwd(dto.UserName, dto.UserPwd); return result; }
public void RegTUser(TUserDto dto, out Dictionary<string, object> list) { _dal.AddTUserByProce(dto.UserName, dto.UserPwd, dto.BankPwd, dto.NickName, dto.TrueName, dto.IdentityNum, dto.Phone, dto.RegIP, dto.TxUrl, out list); }
public ActionResult TestLogin() { string UserName = CommonManager.WebObj.RequestForm("login", ""); string Pwd = CommonManager.WebObj.RequestForm("password", ""); if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(Pwd)) { return JsonFormat(new ExtJson { success = false, msg = "账户和密码不能为空" }); } TUserDto dto = new TUserDto(); dto.UserName = UserName; dto.UserPwd = Pwd.MD5(); int userid = _bll.VerifyTUsers(dto); //CommonManager.WebObj.AddCookie("user", UserName, 1); //CommonManager.WebObj.AddCookie("pwd", Pwd, 1); if (userid != -1) { Session["uid"] = userid; //添加cookie,30天 CommonManager.WebObj.AddCookie("user", UserName, 60 * 24 * 30); CommonManager.WebObj.AddCookie("pwd", Pwd, 60 * 24 * 30); return JsonFormat(new ExtJson { success = true, msg = "登入成功" }); } return JsonFormat(new ExtJson { success = false, msg = "登入失败" }); }