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 InsertStaff(SA_User entity, int count) { string quHao = _xinZhengQuYuService.GetByAreaName(entity.City).QuHao;//).QuHao; string city = GetOrganizationAreaPath().Substring(GetOrganizationAreaPath().LastIndexOf("/") + 1); if (ModelState.IsValid) { for (int i = 0; i < count; i++) { entity.CreatedBy = GetCurrentUserName(); entity.CreatedDate = DateTime.Today; string xuLieHao = quHao + RandomNumber.GetRnd(5, true, true, false, false); entity.Account = xuLieHao; entity.Name = xuLieHao; entity.City = city; entity.Password = entity.Password ?? "123456"; _service.AddUser(entity); _service.Save(); } var parentNode = this.GetCmp <TreePanel>("treePanelSAOrganization").GetNodeById(entity.MainOrgId); parentNode.Set("leaf", false); parentNode.Reload(); parentNode.ExpandChildren(true); this.GetCmp <Window>("windowSA_User").Hide(); //this.GetCmp<Window>("windowSA_Organization").Hide(); //this.GetCmp<Store>("storeSAOrganization").Reload(); return(this.Direct()); } return(this.Direct()); }