public ActionResult Delete(int id, int mId) { //Get Item From Database MerchantFeeClientFeeGroup merchantFeeClientFeeGroup = new MerchantFeeClientFeeGroup(); merchantFeeClientFeeGroup = merchantFeeClientFeeGroupRepository.GetItem(id, mId); //Check Exists if (merchantFeeClientFeeGroup == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } ClientFeeGroupMerchantFeeVM clientFeeGroupMerchantFeeVM = new ClientFeeGroupMerchantFeeVM(); clientFeeGroupMerchantFeeVM.MerchantFeeClientFeeGroup = merchantFeeClientFeeGroup; MerchantFee merchantFee = new MerchantFee(); merchantFee = merchantFeeRepository.GetItem(mId); merchantFeeRepository.EditForDisplay(merchantFee); clientFeeGroupMerchantFeeVM.MerchantFee = merchantFee; ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(id); clientFeeGroupMerchantFeeVM.ClientFeeGroup = clientFeeGroup; return(View(clientFeeGroupMerchantFeeVM)); }
//Edit Group public void Edit(ClientFeeGroup group) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_UpdateClientFeeGroup_v1( group.ClientFeeGroupId, group.ClientFeeGroupName, group.DisplayName, group.EnabledFlag, group.EnabledDate, group.ExpiryDate, group.TripTypeId, group.Mandatory, group.HierarchyType, group.HierarchyCode, group.TravelerTypeGuid, group.ClientSubUnitGuid, group.SourceSystemCode, group.IsMultipleHierarchy, adminUserGuid, group.VersionNumber ); }
public ActionResult Delete(int cid, int tid) { //Get Item From Database TransactionFeeClientFeeGroup transactionFeeClientFeeGroup = new TransactionFeeClientFeeGroup(); transactionFeeClientFeeGroup = transactionFeeClientFeeGroupRepository.GetItem(cid, tid); //Check Exists if (transactionFeeClientFeeGroup == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } ClientFeeGroupTransactionFeeCarHotelVM clientFeeGroupTransactionFeeCarHotelVM = new ClientFeeGroupTransactionFeeCarHotelVM(); clientFeeGroupTransactionFeeCarHotelVM.TransactionFeeClientFeeGroup = transactionFeeClientFeeGroup; ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(cid); clientFeeGroupTransactionFeeCarHotelVM.ClientFeeGroup = clientFeeGroup; TransactionFeeCarHotel transactionFeeCarHotel = new TransactionFeeCarHotel(); transactionFeeCarHotel = transactionFeeCarHotelRepository.GetItem(tid); transactionFeeCarHotelRepository.EditForDisplay(transactionFeeCarHotel); clientFeeGroupTransactionFeeCarHotelVM.TransactionFeeCarHotel = transactionFeeCarHotel; return(View(clientFeeGroupTransactionFeeCarHotelVM)); }
// GET: /Create public ActionResult Create(int ft) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientFeeGroupVM clientFeeGroupVM = new ClientFeeGroupVM(); clientFeeGroupVM.FeeTypeId = ft; clientFeeGroupVM.FeeTypeDisplayName = clientFeeGroupRepository.FeeTypeDisplayName(ft); clientFeeGroupVM.FeeTypeDisplayNameShort = clientFeeGroupRepository.FeeTypeDisplayNameShort(ft); TripTypeRepository tripTypeRepository = new TripTypeRepository(); SelectList tripTypesList = new SelectList(tripTypeRepository.GetAllTripTypes().ToList(), "TripTypeId", "TripTypeDescription"); clientFeeGroupVM.TripTypes = tripTypesList; TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository(); SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchies(groupName).ToList(), "HierarchyLevelTableName", "HierarchyLevelTableName"); clientFeeGroupVM.HierarchyTypes = hierarchyTypesList; ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup.FeeTypeId = ft; clientFeeGroup.Mandatory = (clientFeeGroup.FeeTypeId == 1 || clientFeeGroup.FeeTypeId == 2); clientFeeGroup.EnabledFlag = true; clientFeeGroupVM.ClientFeeGroup = clientFeeGroup; return(View(clientFeeGroupVM)); }
// GET: /UnDelete public ActionResult UnDelete(int id) { //Get Item From Database ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(id); //Check Exists if (clientFeeGroup == null || clientFeeGroup.DeletedFlag == false) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientFeeGroup(id)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientFeeGroupVM clientFeeGroupVM = new ClientFeeGroupVM(); clientFeeGroupRepository.EditGroupForDisplay(clientFeeGroup); clientFeeGroupVM.ClientFeeGroup = clientFeeGroup; clientFeeGroupVM.FeeTypeId = (int)clientFeeGroup.FeeTypeId; clientFeeGroupVM.FeeTypeDisplayName = clientFeeGroupRepository.FeeTypeDisplayName(clientFeeGroupVM.FeeTypeId); clientFeeGroupVM.FeeTypeDisplayNameShort = clientFeeGroupRepository.FeeTypeDisplayNameShort(clientFeeGroupVM.FeeTypeId); return(View(clientFeeGroupVM)); }
// GET: View A TransactionFeeClientFeeGroup public ActionResult View(int cid, int tid) { //Get Item From Database TransactionFeeClientFeeGroup transactionFeeClientFeeGroup = new TransactionFeeClientFeeGroup(); transactionFeeClientFeeGroup = transactionFeeClientFeeGroupRepository.GetItem(cid, tid); //Check Exists if (transactionFeeClientFeeGroup == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } ClientFeeGroupTransactionFeeAirVM clientFeeGroupTransactionFeeAirVM = new ClientFeeGroupTransactionFeeAirVM(); ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(cid); clientFeeGroupTransactionFeeAirVM.ClientFeeGroup = clientFeeGroup; TransactionFeeAir transactionFeeAir = new TransactionFeeAir(); transactionFeeAir = transactionFeeAirRepository.GetItem(tid); transactionFeeAirRepository.EditForDisplay(transactionFeeAir); clientFeeGroupTransactionFeeAirVM.TransactionFeeAir = transactionFeeAir; PolicyRouting policyRouting = new PolicyRouting(); policyRouting = policyRoutingRepository.GetPolicyRouting((int)transactionFeeAir.PolicyRoutingId); policyRoutingRepository.EditForDisplay(policyRouting); clientFeeGroupTransactionFeeAirVM.PolicyRouting = policyRouting; return(View(clientFeeGroupTransactionFeeAirVM)); }
public ClientFeeItemsVM(ClientFeeGroup clientFeeGroup, CWTPaginatedList <spDesktopDataAdmin_SelectClientFeeGroupClientFeeItems_v1Result> clientFeeItems, FeeType feeType, string feeTypeDisplayName, bool hasWriteAccess) { ClientFeeGroup = clientFeeGroup; ClientFeeItems = clientFeeItems; FeeType = feeType; FeeTypeDisplayName = feeTypeDisplayName; HasWriteAccess = hasWriteAccess; }
public ActionResult Create(TransactionFeeClientFeeGroup transactionFeeClientFeeGroup) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Get ClientFeeGroup ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(transactionFeeClientFeeGroup.ClientFeeGroupId); //Check Exists if (clientFeeGroup == null) { ViewData["ActionMethod"] = "CreateGet1"; return(View("RecordDoesNotExistError")); } //Get TransactionFee TransactionFee transactionFee = new TransactionFee(); int productId = transactionFeeClientFeeGroup.ProductId; if (productId == 1) { transactionFee = transactionFeeAirRepository.GetItem(transactionFeeClientFeeGroup.TransactionFeeId); } else { transactionFee = transactionFeeCarHotelRepository.GetItem(transactionFeeClientFeeGroup.TransactionFeeId); } //Check Exists if (transactionFee == null) { ViewData["ActionMethod"] = "CreateGet2"; return(View("RecordDoesNotExistError")); } //Database Update try { transactionFeeClientFeeGroupRepository.Add(transactionFeeClientFeeGroup); } catch (SqlException ex) { LogRepository logRepository = new LogRepository(); logRepository.LogError(ex.Message); ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(View("Error")); } return(RedirectToAction("List", new { id = transactionFeeClientFeeGroup.ClientFeeGroupId })); }
public ClientFeeGroupTransactionFeeCarHotelVM(TransactionFeeClientFeeGroup transactionFeeClientFeeGroup, ClientFeeGroup clientFeeGroup, TransactionFeeCarHotel transactionFeeCarHotel, int feeTypeId, string feeTypeDisplayName, string feeTypeDisplayNameShort) { TransactionFeeClientFeeGroup = transactionFeeClientFeeGroup; ClientFeeGroup = clientFeeGroup; TransactionFeeCarHotel = transactionFeeCarHotel; FeeTypeId = feeTypeId; FeeTypeDisplayName = feeTypeDisplayName; FeeTypeDisplayNameShort = feeTypeDisplayNameShort; }
public ClientFeeGroupTransactionFeesVM(ClientFeeGroup clientFeeGroup, int feeTypeId, string feeTypeDisplayName, string feeTypeDisplayNameShort, bool hasDomainWriteAccess, CWTPaginatedList <spDesktopDataAdmin_SelectClientFeeGroupTransactionFees_v1Result> clientFeeGroupTransactionFees) { ClientFeeGroupTransactionFees = clientFeeGroupTransactionFees; ClientFeeGroup = clientFeeGroup; FeeTypeId = feeTypeId; FeeTypeDisplayName = feeTypeDisplayName; FeeTypeDisplayNameShort = feeTypeDisplayNameShort; HasDomainWriteAccess = hasDomainWriteAccess; }
// GET: /HierarchySearch public ActionResult HierarchySearch(int id, string p, string t, string h) { ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(id); //Check Exists if (clientFeeGroup == null) { ViewData["ActionMethod"] = "HierarchySearchGet"; return(View("RecordDoesNotExistError")); } string filterHierarchySearchProperty = p; string filterHierarchySearchText = t; string filterHierarchyType = h; //if (filterHierarchySearchProperty == null) //{ // filterHierarchySearchProperty = "ClientSubUnitName"; //} HierarchySearchVM hierarchySearchVM = new HierarchySearchVM(); hierarchySearchVM.GroupId = id; hierarchySearchVM.GroupType = groupName; hierarchySearchVM.ClientFeeGroup = clientFeeGroup; hierarchySearchVM.LinkedHierarchies = clientFeeGroupRepository.ClientFeeGroupLinkedHierarchies(id, filterHierarchyType); hierarchySearchVM.FilterHierarchySearchProperty = filterHierarchySearchProperty; hierarchySearchVM.FilterHierarchySearchText = filterHierarchySearchText; hierarchySearchVM.LinkedHierarchiesTotal = clientFeeGroupRepository.CountClientFeeGroupLinkedHierarchies(id);; if (filterHierarchySearchProperty == null) { hierarchySearchVM.AvailableHierarchies = null; } else { hierarchySearchVM.AvailableHierarchies = clientFeeGroupRepository.ClientFeeGroupAvailableHierarchies(id, filterHierarchySearchProperty, filterHierarchySearchText); } hierarchySearchVM.FeeTypeDisplayName = clientFeeGroupRepository.FeeTypeDisplayName((int)clientFeeGroup.FeeTypeId); hierarchySearchVM.FilterHierarchySearchProperty = filterHierarchySearchProperty; TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository(); SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchiesForHierarchySearch(groupName).ToList(), "Value", "Text", hierarchySearchVM.FilterHierarchySearchProperty); hierarchySearchVM.HierarchyPropertyOptions = hierarchyTypesList; //List<SelectListItem> GetDomainHierarchiesForHierarchySearch RolesRepository rolesRepository = new RolesRepository(); hierarchySearchVM.HasWriteAccess = rolesRepository.HasWriteAccessToClientFeeGroup(id); return(View(hierarchySearchVM)); }
public ClientFeeGroupTransactionFeeAirVM(TransactionFeeClientFeeGroup transactionFeeClientFeeGroup, ClientFeeGroup clientFeeGroup, TransactionFeeAir transactionFeeAir, PolicyRouting policyRouting, int feeTypeId, string feeTypeDisplayName, string feeTypeDisplayNameShort) { TransactionFeeClientFeeGroup = transactionFeeClientFeeGroup; ClientFeeGroup = clientFeeGroup; TransactionFeeAir = transactionFeeAir; PolicyRouting = policyRouting; FeeTypeId = feeTypeId; FeeTypeDisplayName = feeTypeDisplayName; FeeTypeDisplayNameShort = feeTypeDisplayNameShort; }
public ClientFeeGroupVM(ClientFeeGroup clientFeeGroup, IEnumerable <SelectListItem> tripTypes, IEnumerable <SelectListItem> hierarchyTypes, int feeTypeId, string feeTypeDisplayName, string feeTypeDisplayNameShort) { ClientFeeGroup = clientFeeGroup; TripTypes = tripTypes; HierarchyTypes = hierarchyTypes; FeeTypeId = feeTypeId; FeeTypeDisplayName = feeTypeDisplayName; FeeTypeDisplayNameShort = feeTypeDisplayNameShort; }
//Change the deleted status on an item public void UpdateGroupDeletedStatus(ClientFeeGroup group) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_UpdateClientFeeGroupDeletedStatus_v1( group.ClientFeeGroupId, group.DeletedFlag, adminUserGuid, group.VersionNumber ); }
public ActionResult Edit(ClientFeeGroupMerchantFeeVM clientFeeGroupMerchantFeeVM) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Get ClientFeeGroup MerchantFeeClientFeeGroup merchantFeeClientFeeGroup = new MerchantFeeClientFeeGroup(); merchantFeeClientFeeGroup = clientFeeGroupMerchantFeeVM.MerchantFeeClientFeeGroup; ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(merchantFeeClientFeeGroup.ClientFeeGroupId); //Check Exists if (clientFeeGroup == null) { ViewData["ActionMethod"] = "EditGet1"; return(View("RecordDoesNotExistError")); } //Get MerchantFee MerchantFee merchantFee = new MerchantFee(); merchantFee = merchantFeeRepository.GetItem(merchantFeeClientFeeGroup.MerchantFeeId); //Check Exists if (merchantFee == null) { ViewData["ActionMethod"] = "EditGet2"; return(View("RecordDoesNotExistError")); } //Database Update try { merchantFeeClientFeeGroupRepository.Update(merchantFeeClientFeeGroup, clientFeeGroupMerchantFeeVM.OriginalMerchantFeeId); } catch (SqlException ex) { LogRepository logRepository = new LogRepository(); logRepository.LogError(ex.Message); ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(View("Error")); } return(RedirectToAction("List", new { id = merchantFeeClientFeeGroup.ClientFeeGroupId })); }
public ClientFeeGroupMerchantFeeVM(int originalMerchantFeeId, IEnumerable <SelectListItem> merchantFees, MerchantFeeClientFeeGroup merchantFeeClientFeeGroup, ClientFeeGroup clientFeeGroup, MerchantFee merchantFee, int feeTypeId, string feeTypeDisplayName, string feeTypeDisplayNameShort, bool hasDomainWriteAccess) { MerchantFeeClientFeeGroup = merchantFeeClientFeeGroup; ClientFeeGroup = clientFeeGroup; MerchantFees = merchantFees; MerchantFee = merchantFee; FeeTypeId = feeTypeId; FeeTypeDisplayName = feeTypeDisplayName; FeeTypeDisplayNameShort = feeTypeDisplayNameShort; HasDomainWriteAccess = hasDomainWriteAccess; OriginalMerchantFeeId = originalMerchantFeeId; }
public ClientFeeGroupTransactionFeeVM(IEnumerable <SelectListItem> transactionFees, int originalTransactionFeeId, IEnumerable <SelectListItem> products, TransactionFeeClientFeeGroup transactionFeeClientFeeGroup, ClientFeeGroup clientFeeGroup, TransactionFee transactionFee, int feeTypeId, string feeTypeDisplayName, string feeTypeDisplayNameShort, bool hasDomainWriteAccess) { TransactionFeeClientFeeGroup = transactionFeeClientFeeGroup; Products = products; ClientFeeGroup = clientFeeGroup; OriginalTransactionFeeId = originalTransactionFeeId; TransactionFees = transactionFees; TransactionFee = transactionFee; FeeTypeId = feeTypeId; FeeTypeDisplayName = feeTypeDisplayName; FeeTypeDisplayNameShort = feeTypeDisplayNameShort; HasDomainWriteAccess = hasDomainWriteAccess; }
public ActionResult UnDelete(ClientFeeGroupVM clientFeeGroupVM) { //Check Valid Item passed in Form if (clientFeeGroupVM.ClientFeeGroup == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Get Item From Database ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(clientFeeGroupVM.ClientFeeGroup.ClientFeeGroupId); //Check Exists in Databsase if (clientFeeGroup == null || clientFeeGroup.DeletedFlag == false) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientFeeGroup(clientFeeGroup.ClientFeeGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Delete Form Item try { clientFeeGroupVM.ClientFeeGroup.DeletedFlag = false; clientFeeGroupRepository.UpdateGroupDeletedStatus(clientFeeGroupVM.ClientFeeGroup); } catch (SqlException ex) { //Versioning Error - go to standard versionError page if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/ClientFeeGroup.mvc/UnDelete/" + clientFeeGroup.ClientFeeGroupId; return(View("VersionError")); } LogRepository logRepository = new LogRepository(); logRepository.LogError(ex.Message); ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(View("Error")); } return(RedirectToAction("ListUnDeleted", new { ft = clientFeeGroup.FeeTypeId })); }
public ActionResult List(int id, string filter, int?page, string sortField, int?sortOrder) { //Get ClientFeeGroup ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(id); //Check Exists if (clientFeeGroup == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } //SortField + SortOrder settings if (sortField != "ProductName" && sortField != "TravelIndicator" && sortField != "BookingOriginationCode" && sortField != "ChargeTypeCode" && sortField != "FeeCategory" && sortField != "FeeAmount" && sortField != "TransactionTypeCode") { sortField = "TransactionFeeDescription"; } ViewData["CurrentSortField"] = sortField; if (sortOrder == 1) { ViewData["NewSortOrder"] = 0; ViewData["CurrentSortOrder"] = 1; } else { ViewData["NewSortOrder"] = 1; ViewData["CurrentSortOrder"] = 0; } ClientFeeGroupTransactionFeesVM clientFeeGroupTransactionFeesVM = new ClientFeeGroupTransactionFeesVM(); clientFeeGroupTransactionFeesVM.ClientFeeGroup = clientFeeGroup; //Check Access Rights RolesRepository rolesRepository = new RolesRepository(); if (hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { clientFeeGroupTransactionFeesVM.HasDomainWriteAccess = true; } clientFeeGroupTransactionFeesVM.ClientFeeGroupTransactionFees = transactionFeeClientFeeGroupRepository.PageTransactionFeeClientFeeGroups(id, page ?? 1, filter ?? "", sortField, sortOrder ?? 0); return(View(clientFeeGroupTransactionFeesVM)); }
public ActionResult List(int id, string filter, int?page, string sortField, int?sortOrder) { //Get ClientFeeGroup ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(id); //Check Exists if (clientFeeGroup == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } //SortField + SortOrder settings if (sortField != "CountryName" && sortField != "CreditCardVendorName" && sortField != "ProductName" && sortField != "SupplierName" && sortField != "MerchantFeePercent") { sortField = "MerchantFeeDescription"; } ViewData["CurrentSortField"] = sortField; if (sortOrder == 1) { ViewData["NewSortOrder"] = 0; ViewData["CurrentSortOrder"] = 1; } else { ViewData["NewSortOrder"] = 1; ViewData["CurrentSortOrder"] = 0; } ClientFeeGroupMerchantFeesVM clientFeeGroupMerchantFeesVM = new ClientFeeGroupMerchantFeesVM(); clientFeeGroupMerchantFeesVM.ClientFeeGroup = clientFeeGroup; //Check Access Rights RolesRepository rolesRepository = new RolesRepository(); if (hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { clientFeeGroupMerchantFeesVM.HasDomainWriteAccess = true; } clientFeeGroupMerchantFeesVM.ClientFeeGroupMerchantFees = merchantFeeClientFeeGroupRepository.PageMerchantFeeClientFeeGroups(id, page ?? 1, filter ?? "", sortField, sortOrder ?? 0); return(View(clientFeeGroupMerchantFeesVM)); }
// GET: Edit A TransactionFeeClientFeeGroup public ActionResult Edit(int cid, int tId) { //Get Item From Database TransactionFeeClientFeeGroup transactionFeeClientFeeGroup = new TransactionFeeClientFeeGroup(); transactionFeeClientFeeGroup = transactionFeeClientFeeGroupRepository.GetItem(cid, tId); //Check Exists if (transactionFeeClientFeeGroup == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } ClientFeeGroupTransactionFeeVM clientFeeGroupTransactionFeeVM = new ClientFeeGroupTransactionFeeVM(); clientFeeGroupTransactionFeeVM.TransactionFeeClientFeeGroup = transactionFeeClientFeeGroup; //Get ClientFeeGroup ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(cid); clientFeeGroupTransactionFeeVM.ClientFeeGroup = clientFeeGroup; clientFeeGroupTransactionFeeVM.OriginalTransactionFeeId = tId; TransactionFee transactionFee = new TransactionFee(); transactionFee = transactionFeeRepository.GetItem(tId); int productId = (int)transactionFee.ProductId; transactionFeeClientFeeGroup.ProductId = productId; SelectList transactionFeeList = new SelectList(transactionFeeClientFeeGroupRepository.GetUnUsedTransactionFees(cid, productId, transactionFee.TransactionFeeId).ToList(), "TransactionFeeId", "TransactionFeeDescription"); clientFeeGroupTransactionFeeVM.TransactionFees = transactionFeeList; ProductRepository productRepository = new ProductRepository(); SelectList productList = new SelectList(productRepository.GetTransactionFeeProducts().ToList(), "ProductId", "ProductName", productId); clientFeeGroupTransactionFeeVM.Products = productList; return(View(clientFeeGroupTransactionFeeVM)); }
public HierarchySearchVM(int linkedHierarchiesTotal, ClientFeeGroup clientFeeGroup, string feeTypeDisplayName, string filterHierarchySearchText, string filterHierarchySearchProperty, string hierarchyType, IEnumerable <SelectListItem> hierarchyPropertyOptions, int groupId, string groupType, bool hasWriteAccess, List <spDesktopDataAdmin_SelectClientFeeGroupLinkedHierarchies_v1Result> linkedHierarchies, List <spDesktopDataAdmin_SelectClientFeeGroupAvailableHierarchies_v1Result> availableHierarchies) { LinkedHierarchiesTotal = linkedHierarchiesTotal; FilterHierarchySearchProperty = filterHierarchySearchProperty; FilterHierarchySearchText = filterHierarchySearchText; HierarchyType = hierarchyType; HasWriteAccess = hasWriteAccess; LinkedHierarchies = linkedHierarchies; AvailableHierarchies = availableHierarchies; FeeTypeDisplayName = feeTypeDisplayName; ClientFeeGroup = clientFeeGroup; GroupType = groupType; GroupId = groupId; HierarchyPropertyOptions = hierarchyPropertyOptions; }
// GET: /Create public ActionResult Create(int id) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Get ClientFeeGroup ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(id); //Check Exists if (clientFeeGroup == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } ClientFeeGroupTransactionFeeVM clientFeeGroupTransactionFeesVM = new ClientFeeGroupTransactionFeeVM(); clientFeeGroupTransactionFeesVM.ClientFeeGroup = clientFeeGroup; TransactionFeeClientFeeGroup transactionFeeClientFeeGroup = new TransactionFeeClientFeeGroup(); transactionFeeClientFeeGroup.ClientFeeGroupId = id; clientFeeGroupTransactionFeesVM.TransactionFeeClientFeeGroup = transactionFeeClientFeeGroup; //TransactionFeeRepository transactionFeeRepository = new TransactionFeeRepository(); //SelectList transactionFeeList = new SelectList(transactionFeeRepository.GetAllItems().ToList(), "TransactionFeeId", "TransactionFeeDescription"); SelectList transactionFeeList = new SelectList(transactionFeeClientFeeGroupRepository.GetUnUsedTransactionFees(id, 0, 0).ToList(), "TransactionFeeId", "TransactionFeeDescription"); clientFeeGroupTransactionFeesVM.TransactionFees = transactionFeeList; ProductRepository productRepository = new ProductRepository(); SelectList productList = new SelectList(productRepository.GetTransactionFeeProducts().ToList(), "ProductId", "ProductName"); clientFeeGroupTransactionFeesVM.Products = productList; return(View(clientFeeGroupTransactionFeesVM)); }
public ActionResult AddRemoveHierarchy(GroupHierarchyVM groupHierarchyVM) { //Get Item From Database ClientFeeGroup group = new ClientFeeGroup(); group = clientFeeGroupRepository.GetGroup(groupHierarchyVM.GroupId); //Check Exists if (group == null) { ViewData["ActionMethod"] = "AddRemoveHierarchyPost"; return(View("RecordDoesNotExistError")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientFeeGroup(groupHierarchyVM.GroupId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Delete Item try { clientFeeGroupRepository.UpdateLinkedHierarchy(groupHierarchyVM); } catch (SqlException ex) { //Versioning Error - go to standard versionError page if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/ClientFeeGroup.mvc/HierarchySearch/" + group.ClientFeeGroupId; return(View("VersionError")); } LogRepository logRepository = new LogRepository(); logRepository.LogError(ex.Message); ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(View("Error")); } return(RedirectToAction("HierarchySearch", new { id = group.ClientFeeGroupId, p = groupHierarchyVM.FilterHierarchySearchProperty, t = groupHierarchyVM.FilterHierarchySearchText, h = clientFeeGroupRepository.getHierarchyType(groupHierarchyVM.FilterHierarchySearchProperty) })); }
// GET: /Edit public ActionResult Edit(int id) { //Get Item From Database ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(id); //Check Exists if (clientFeeGroup == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientFeeGroup(id)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientFeeGroupVM clientFeeGroupVM = new ClientFeeGroupVM(); clientFeeGroupRepository.EditGroupForDisplay(clientFeeGroup); clientFeeGroupVM.ClientFeeGroup = clientFeeGroup; clientFeeGroupVM.FeeTypeId = (int)clientFeeGroup.FeeTypeId; clientFeeGroupVM.FeeTypeDisplayName = clientFeeGroupRepository.FeeTypeDisplayName(clientFeeGroupVM.FeeTypeId); clientFeeGroupVM.FeeTypeDisplayNameShort = clientFeeGroupRepository.FeeTypeDisplayNameShort(clientFeeGroupVM.FeeTypeId); TripTypeRepository tripTypeRepository = new TripTypeRepository(); SelectList tripTypesList = new SelectList(tripTypeRepository.GetAllTripTypes().ToList(), "TripTypeId", "TripTypeDescription"); clientFeeGroupVM.TripTypes = tripTypesList; TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository(); SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchies(groupName).ToList(), "HierarchyLevelTableName", "HierarchyLevelTableName"); clientFeeGroupVM.HierarchyTypes = hierarchyTypesList; return(View(clientFeeGroupVM)); }
public ActionResult Create(int id) { //Get Item From Database ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(id); //Check Exists if (clientFeeGroup == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientFeeGroup(id)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientFeeItemVM clientFeeItemVM = new ClientFeeItemVM(); ClientFeeItem clientFeeItem = new ClientFeeItem(); clientFeeItem.ClientFeeGroup = clientFeeGroup; clientFeeItemVM.ClientFeeItem = clientFeeItem; FeeTypeRepository feeTypeRepository = new FeeTypeRepository(); FeeType feeType = new FeeType(); feeType = feeTypeRepository.GetFeeType((int)clientFeeGroup.FeeTypeId); clientFeeItemVM.FeeType = feeType; SelectList clientFees = new SelectList(clientFeeRepository.GetClientFeesByType((int)clientFeeGroup.FeeTypeId).ToList(), "ClientFeeId", "ClientFeeDescription"); clientFeeItemVM.ClientFees = clientFees; return(View(clientFeeItemVM)); }
// GET: /View public ActionResult View(int id) { ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(id); //Check Exists if (clientFeeGroup == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } ClientFeeGroupVM clientFeeGroupVM = new ClientFeeGroupVM(); clientFeeGroupRepository.EditGroupForDisplay(clientFeeGroup); clientFeeGroupVM.ClientFeeGroup = clientFeeGroup; clientFeeGroupVM.FeeTypeId = (int)clientFeeGroup.FeeTypeId; clientFeeGroupVM.FeeTypeDisplayName = clientFeeGroupRepository.FeeTypeDisplayName(clientFeeGroupVM.FeeTypeId); clientFeeGroupVM.FeeTypeDisplayNameShort = clientFeeGroupRepository.FeeTypeDisplayNameShort(clientFeeGroupVM.FeeTypeId); return(View(clientFeeGroupVM)); }
// GET: Create a MerchantFeeClientFeeGroup public ActionResult Create(int id) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Get ClientFeeGroup ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(id); //Check Exists if (clientFeeGroup == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } ClientFeeGroupMerchantFeeVM clientFeeGroupMerchantFeeVM = new ClientFeeGroupMerchantFeeVM(); clientFeeGroupMerchantFeeVM.ClientFeeGroup = clientFeeGroup; MerchantFeeClientFeeGroup merchantFeeClientFeeGroup = new MerchantFeeClientFeeGroup(); merchantFeeClientFeeGroup.ClientFeeGroupId = id; clientFeeGroupMerchantFeeVM.MerchantFeeClientFeeGroup = merchantFeeClientFeeGroup; SelectList merchantFeeList = new SelectList(merchantFeeClientFeeGroupRepository.GetUnUsedMerchantFees(id, 0).ToList(), "MerchantFeeId", "MerchantFeeDescription"); clientFeeGroupMerchantFeeVM.MerchantFees = merchantFeeList; return(View(clientFeeGroupMerchantFeeVM)); }
// GET: Edit A MerchantFeeClientFeeGroup public ActionResult Edit(int id, int mId) { //Get Item From Database MerchantFeeClientFeeGroup merchantFeeClientFeeGroup = new MerchantFeeClientFeeGroup(); merchantFeeClientFeeGroup = merchantFeeClientFeeGroupRepository.GetItem(id, mId); //Check Exists if (merchantFeeClientFeeGroup == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } ClientFeeGroupMerchantFeeVM clientFeeGroupMerchantFeeVM = new ClientFeeGroupMerchantFeeVM(); clientFeeGroupMerchantFeeVM.MerchantFeeClientFeeGroup = merchantFeeClientFeeGroup; MerchantFee merchantFee = new MerchantFee(); merchantFee = merchantFeeRepository.GetItem(mId); merchantFeeRepository.EditForDisplay(merchantFee); clientFeeGroupMerchantFeeVM.MerchantFee = merchantFee; ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(id); clientFeeGroupMerchantFeeVM.ClientFeeGroup = clientFeeGroup; clientFeeGroupMerchantFeeVM.OriginalMerchantFeeId = mId; SelectList merchantFeeList = new SelectList(merchantFeeClientFeeGroupRepository.GetUnUsedMerchantFees(id, mId).ToList(), "MerchantFeeId", "MerchantFeeDescription", mId); clientFeeGroupMerchantFeeVM.MerchantFees = merchantFeeList; return(View(clientFeeGroupMerchantFeeVM)); }
public ActionResult Edit(ClientFeeGroupVM clientFeeGroupVM) { //Get Item ClientFeeGroup clientFeeGroup = new ClientFeeGroup(); clientFeeGroup = clientFeeGroupRepository.GetGroup(clientFeeGroupVM.ClientFeeGroup.ClientFeeGroupId); //Check Exists if (clientFeeGroup == null) { ViewData["ActionMethod"] = "EditPost"; return(View("RecordDoesNotExistError")); } //Check Access Rights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientFeeGroup(clientFeeGroup.ClientFeeGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Update Model From Form + Validate against DB try { UpdateModel <ClientFeeGroup>(clientFeeGroup, "ClientFeeGroup"); } catch { string n = ""; foreach (ModelState modelState in ViewData.ModelState.Values) { foreach (ModelError error in modelState.Errors) { n += error.ErrorMessage; } } ViewData["Message"] = "ValidationError : " + n; return(View("Error")); } //Dont check for multiple as We are not editing Hierarchy, we have alrady checked access to the item itself if (clientFeeGroup.HierarchyType != "Multiple") { //ClientSubUnitTravelerType has extra field string hierarchyCode = clientFeeGroup.HierarchyCode; if (clientFeeGroup.HierarchyType == "ClientSubUnitTravelerType") { clientFeeGroup.ClientSubUnitGuid = hierarchyCode; //ClientSubUnitTravelerType has 2 primarykeys } //Check Access Rights to PolicyGroup HierarchyRepository hierarchyRepository = new HierarchyRepository(); if (!hierarchyRepository.AdminHasDomainHierarchyWriteAccess(clientFeeGroup.HierarchyType, hierarchyCode, clientFeeGroup.SourceSystemCode, groupName)) { ViewData["Message"] = "You cannot add to this hierarchy item"; return(View("Error")); } } //Database Update try { clientFeeGroupRepository.Edit(clientFeeGroup); } catch (SqlException ex) { //Versioning Error if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/ClientFeeGroup.mvc/Edit/" + clientFeeGroup.ClientFeeGroupId; return(View("VersionError")); } LogRepository logRepository = new LogRepository(); logRepository.LogError(ex.Message); ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(View("Error")); } return(RedirectToAction("ListUnDeleted", new { ft = clientFeeGroup.FeeTypeId })); }