public ActionResult Insert(ExtrenalUser entity, int count) { if (ModelState.IsValid) { string quHao = _xinZhengQuYuService.GetByAreaName(GetOrganizationAreaPath()).QuHao; string city = GetOrganizationAreaPath();//.Substring(GetOrganizationAreaPath().LastIndexOf("/"); var userNames = GetAllUserName(); for (var i = 0; i < count; i++) { entity.CreatedBy = GetCurrentUserName(); entity.CreatedDate = DateTime.Now; string xuLieHao = GetRandomNumber(quHao, 5, userNames); entity.Account = xuLieHao; entity.Name = xuLieHao; entity.City = city; entity.Password = entity.Password ?? "123"; entity.DeviceId = ""; _extrenalUserService.AddExtrenalUser(entity); _extrenalUserService.Save(); } this.GetCmp <Window>("windowExtrenalUser").Hide(); this.GetCmp <Store>("storeExtrenalUser").Reload(); return(this.Direct()); } return(this.Direct()); }
public ActionResult LoginWeb(UserModel userModel) { if (ModelState.IsValid) { var securityService = new SecurityService(); var user = new ExtrenalUser { Name = userModel.Name, Password = userModel.Password }; var authenticatedUser = securityService.GetExtrenalUser(user.Name, user.Password); if (authenticatedUser != null) { Response.SetAuthCookie(authenticatedUser.Name, false, //authenticatedUser.City); string.Format("{0}{1}", authenticatedUser.City, "|false")); SetCookie("CurrentCity", HttpUtility.UrlEncode(authenticatedUser.City.Split('/').LastOrDefault(), Encoding.GetEncoding("UTF-8"))); SetCookie("UserType", authenticatedUser.UserType); return(RedirectToAction("Index", "ZhiDiZhuZhaiSearch")); //return RedirectToAction("Index", "TianYuanDataCenter"); } ViewBag.UserName = "******"; ModelState.AddModelError("", "The user name or password provided is incorrect."); return(View(userModel)); } return(View(userModel)); }
public ActionResult Update(ExtrenalUser entity) { if (ModelState.IsValid) { entity.LastModifiedBy = GetCurrentUserName(); //entity.LastModifiedDate = DateTime.Now; //entity.Account = entity.Name; _extrenalUserService.UpdateExtrenalUser(entity); _extrenalUserService.Save(); var window = this.GetCmp <Window>("windowExtrenalUser"); window.Hide(); this.GetCmp <Store>("storeExtrenalUser").Reload(); return(this.Direct()); } return(this.Direct()); }