public ActionResult DoEdit(int? roleId, Func<object,ActionResult> View) { var roleSearch = new SearchRoleCriteria() { RoleID = roleId.HasValue ? roleId.Value : -1 }; RoleListModel viewModel = new RoleListModel() { RoleModel = BusinessPortal.Load<Role>(roleSearch) }; return View(viewModel); }
public ActionResult RoleFunc(int? roleId, bool? adminFlag) { var roleFuncSearch = new SearchRoleFuncCriteria() { RoleID = roleId.HasValue ? roleId.Value : -1, AdminFlag = adminFlag.HasValue ? adminFlag.Value : false }; var roleSearch = new SearchRoleCriteria() { RoleID = roleId.HasValue ? roleId.Value : -1 }; RoleListModel viewModel = new RoleListModel() { RoleModel = BusinessPortal.Load<Role>(roleSearch) }; if (viewModel.RoleModel != null) { viewModel.RoleModel.RoleFuncList = BusinessPortal.Search<RoleFunc>(roleFuncSearch); } return View(viewModel); }
public ActionResult UserRole(int? roleId) { var userRoleSearch = new SearchUserRoleCriteria() { RoleID = roleId.HasValue ? roleId.Value : -1 }; var roleSearch = new SearchRoleCriteria() { RoleID = roleId.HasValue ? roleId.Value : -1 }; RoleListModel viewModel = new RoleListModel() { RoleModel = BusinessPortal.Load<Role>(roleSearch) }; if (viewModel.RoleModel != null) { viewModel.RoleModel.UserRoleList = BusinessPortal.Search<UserRole>(userRoleSearch); } //added by jason in 20121219 for TSYF02010#06.doc List<Comparison<UserRole>> compList = new List<Comparison<UserRole>>(); compList.Add((x, y) => x.ShopCode.CompareTo(y.ShopCode)); compList.Add((x, y) => x.UserType.CompareTo(y.UserType)); compList.Add((x, y) => x.UserCode.CompareTo(y.UserCode)); return ViewList(viewModel, (pageparams) => { int recordCount; viewModel.RoleModel.UserRoleList = viewModel.RoleModel.UserRoleList.Page(pageparams, out recordCount, compList); return recordCount; }); //end added by jason in 20121219 for TSYF02010#06.doc //commented by jason in 20121219 for TSYF02010#06.doc //return View(viewModel); //end commented by jason in 20121219 for TSYF02010#06.doc }
public ActionResult List(RoleListModel model) { model = model ?? new RoleListModel(); model.RoleSearch = model.RoleSearch ?? new SearchRoleCriteria(); var search = new SearchRoleCriteria() { //RoleDescFrom = model.RoleSearch.RoleDescFrom, //RoleDescTo = model.RoleSearch.RoleDescTo, ROLE_CODE = model.RoleSearch.ROLE_CODE, RoleType = model.RoleSearch.RoleType, AdminFlag = model.RoleSearch.AdminFlag }; List<Comparison<Role>> compList = new List<Comparison<Role>>(); compList.Add((x, y) => x.RoleCode.CompareTo(y.RoleCode)); //commented by jason in 20121219 for TSYF02010#06.doc //compList.Add((x, y) => x.RoleDsc.CompareTo(y.RoleDsc)); //end commented by jason in 20121219 for TSYF02010#06.doc //compList.Add((x, y) => x.RoleType.CompareTo(y.RoleType)); //commented by jason in 20121219 for TSYF02010#06.doc //compList.Add((x, y) => x.SystemScope.CompareTo(y.SystemScope)); //end commented by jason in 20121219 for TSYF02010#06.doc //compList.Add((x, y) => x.AdminFlag.CompareTo(y.AdminFlag)); compList.Add((x, y) => x.CreationDate.CompareTo(y.CreationDate)); //commented by jason in 20121219 for TSYF02010#06.doc //compList.Add((x, y) => x.FrozenFlag.CompareTo(y.FrozenFlag)); //compList.Add((x, y) => (x.FrozenDate.HasValue ? x.FrozenDate.Value.Format() : "").CompareTo(y.FrozenDate.HasValue ? y.FrozenDate.Value.Format() : "")); //commented by jason in 20121219 for TSYF02010#06.doc model.RoleList = SessionCache.Instance.GetOrSetCache<BusinessList<Role>>("roleSearch", () => BusinessPortal.Search<Role>(search), !this.IsSortingOrPageing()); PagerHelper.SetSortParamsToViewData(ViewData, new PageParams() { SortField = 0, sortDirection = SortDirectionEnum.Asc }); return ViewList(model, (pageparams) => { model.RoleForDropDownList = BusinessPortal.Search<Role>(new SearchRoleForDDLCriteria()); int recordCount; model.RoleList = model.RoleList.Page(pageparams, out recordCount, compList); return recordCount; }); }