public ActionResult DepartmentUserAddOrEdit(int?currentPageNum, int?pageSize, Guid?id, FormCollection collection) { if (!currentPageNum.HasValue) { currentPageNum = 1; } if (!pageSize.HasValue) { pageSize = PagedResult <User> .DefaultPageSize; } Guid depId = Guid.Empty; string depIdstr = LRequest.GetString("depId"); if (!string.IsNullOrWhiteSpace(depIdstr)) { depId = Guid.Parse(depIdstr); } SetPageRoleNames(); if (!id.HasValue) { return(View(new UserAddOrEditViewModel { Added = true, DepId = depId, Entity = new User(), LstRoles = new string[] { }, CurrentPageNum = currentPageNum.Value, PageSize = pageSize.Value })); } else { var repo = RF.FindRepo <User>(); var village = repo.GetByKey(id.Value); var list = RF.Concrete <IRoleRepository>().GetRoleByUserId(id.Value); string[] arrRole = list.Select(p => p.Name).ToArray(); return(View(new UserAddOrEditViewModel { Added = false, DepId = depId, Entity = village, LstRoles = arrRole, CurrentPageNum = currentPageNum.Value, PageSize = pageSize.Value })); } }
public virtual ActionResult AddOrEdit(int?currentPageNum, int?pageSize, Guid?id, FormCollection collection) { if (!currentPageNum.HasValue) { currentPageNum = 1; } if (!pageSize.HasValue) { pageSize = PagedResult <TAggregateRoot> .DefaultPageSize; } int pageNum = currentPageNum.Value; if (!id.HasValue) { if (!Check("Add")) { return(NoPermissionView()); } ViewBag.Action = "Add"; return(View(new AddOrEditViewModel <TAggregateRoot> { Added = true, Entity = null, CurrentPageNum = currentPageNum.Value, PageSize = pageSize.Value })); } else { if (!Check("Edit")) { return(NoPermissionView()); } ViewBag.Action = "Edit"; var repo = RF.FindRepo <TAggregateRoot>(); var village = repo.GetByKey(id.Value); return(View(new AddOrEditViewModel <TAggregateRoot> { Added = false, Entity = village, CurrentPageNum = currentPageNum.Value, PageSize = pageSize.Value })); } }
public void ddlDictionary(Guid dtId) { var repo = RF.FindRepo <DictType>(); var list = repo.FindAll(); List <SelectListItem> selitem = new List <SelectListItem>(); if (list.Count() > 0) { var roots = list; foreach (var item in roots) { selitem.Add(new SelectListItem { Text = item.DicDes + "(" + item.Name + ")", Value = item.ID.ToString() }); } } selitem.Insert(0, new SelectListItem { Text = "==字典类型==", Value = "-1" }); ViewData["ddlDictionary"] = selitem; }
public void ddlUser_User(Guid dtId) { var repo = RF.FindRepo <User>(); var list = repo.FindAll(); List <SelectListItem> selitem = new List <SelectListItem>(); if (list.Count() > 0) { var roots = list; foreach (var item in roots) { selitem.Add(new SelectListItem { Text = item.Name, Value = item.ID.ToString() }); } } selitem.Insert(0, new SelectListItem { Text = "==学生==", Value = "-1" }); ViewData["ddlUser_Student"] = selitem; }
public void ddlUser_Employee(Guid dtId) { var repo = RF.FindRepo <CompanyInfo>(); var list = repo.FindAll(); List <SelectListItem> selitem = new List <SelectListItem>(); if (list.Count() > 0) { var roots = list; foreach (var item in roots) { selitem.Add(new SelectListItem { Text = item.UnitInfo.Name, Value = item.UnitInfo.ID.ToString() }); } } selitem.Insert(0, new SelectListItem { Text = "==企业员工==", Value = "-1" }); ViewData["ddlUser_Employee"] = selitem; }
public override ActionResult AddOrEdit(int?currentPageNum, int?pageSize, Guid?id, FormCollection collection) { if (!currentPageNum.HasValue) { currentPageNum = 1; } if (!pageSize.HasValue) { pageSize = PagedListViewModel <Dictionary> .DefaultPageSize; } Guid guid = Guid.Parse(LRequest.GetString("dicTypeId")); if (!id.HasValue) { return(View(new DictionaryAddOrEditViewModel { Added = true, Entity = null, DicTypeId = guid, CurrentPageNum = currentPageNum.Value, PageSize = pageSize.Value })); } else { var repo = RF.FindRepo <Dictionary>(); var village = repo.GetByKey(id.Value); return(View(new DictionaryAddOrEditViewModel { Added = false, Entity = village, DicTypeId = guid, CurrentPageNum = currentPageNum.Value, PageSize = pageSize.Value })); } }
public void TestIOCRFFindRepo() { var repo = RF.FindRepo <User>(); Assert.IsNotNull(repo); }