public ActionResult Delete(int id) { //Get Item From Database ClientFeeItem clientFeeItem = new ClientFeeItem(); clientFeeItem = clientFeeItemRepository.GetItem(id); //Check Exists if (clientFeeItem == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientFeeGroup(clientFeeItem.ClientFeeGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientFeeItemVM clientFeeItemVM = new ClientFeeItemVM(); clientFeeItemVM.ClientFeeItem = clientFeeItem; FeeTypeRepository feeTypeRepository = new FeeTypeRepository(); FeeType feeType = new FeeType(); feeType = feeTypeRepository.GetFeeType(clientFeeItem.ClientFee.FeeTypeId); if (feeType.FeeTypeDescription == "Client Fee") { feeType.FeeTypeDescription = "Transaction Fee"; } clientFeeItemVM.FeeType = feeType; SelectList clientFees = new SelectList(clientFeeRepository.GetClientFeesByType(clientFeeItem.ClientFee.FeeTypeId).ToList(), "ClientFeeId", "ClientFeeDescription"); clientFeeItemVM.ClientFees = clientFees; return(View(clientFeeItemVM)); }
// GET: /View public ActionResult View(int id) { //Check Exists ClientFeeItem clientFeeItem = new ClientFeeItem(); clientFeeItem = clientFeeItemRepository.GetItem(id); if (clientFeeItem == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } FeeTypeRepository feeTypeRepository = new FeeTypeRepository(); FeeType feeType = new FeeType(); feeType = feeTypeRepository.GetFeeType(clientFeeItem.ClientFee.FeeTypeId); ViewData["FeeTypeDescription"] = feeType.FeeTypeDescription; ViewData["ClientFeeGroupName"] = clientFeeItem.ClientFeeGroup.ClientFeeGroupName; ViewData["ClientFeeGroupId"] = clientFeeItem.ClientFeeGroup.ClientFeeGroupId; return(View(clientFeeItem)); }
public ActionResult List(int id, string filter, int?page, string sortField, int?sortOrder) { //Get Item From Database ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(id); //Check Exists if (clientFeeGroup == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } //SortField if (sortField != "OutputFormat" && sortField != "OutputDescription") { sortField = "ClientFeeDescription"; } ViewData["CurrentSortField"] = sortField; //SortOrder if (sortOrder == 1) { ViewData["NewSortOrder"] = 0; ViewData["CurrentSortOrder"] = 1; } else { ViewData["NewSortOrder"] = 1; ViewData["CurrentSortOrder"] = 0; sortOrder = 0; } ClientFeeItemsVM clientFeeItemsVM = new ClientFeeItemsVM(); clientFeeItemsVM.ClientFeeGroup = clientFeeGroup; if (clientFeeGroup.FeeTypeId == 1) { clientFeeItemsVM.FeeTypeDisplayName = "Supplemental Fee Group"; } else { clientFeeItemsVM.FeeTypeDisplayName = "Transaction Fee Group"; } FeeTypeRepository feeTypeRepository = new FeeTypeRepository(); FeeType feeType = new FeeType(); feeType = feeTypeRepository.GetFeeType((int)clientFeeGroup.FeeTypeId); clientFeeItemsVM.FeeType = feeType; clientFeeItemsVM.ClientFeeItems = clientFeeItemRepository.PageClientFeeItems(id, page ?? 1, sortField, sortOrder ?? 0); //Check Access Rights RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToClientFeeGroup(clientFeeGroup.ClientFeeGroupId)) { clientFeeItemsVM.HasWriteAccess = true; } return(View(clientFeeItemsVM)); }