public ActionResult SelectType(PolicyMessageGroupItemCreateVM policyMessageGroupItemCreateVM) { int policyGroupId = policyMessageGroupItemCreateVM.PolicyGroup.PolicyGroupId; string type = policyMessageGroupItemCreateVM.PolicyMessageGroupItemType; PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyGroupId);; //Check Exists if (policyGroup == null) { ViewData["ActionMethod"] = "SelectTypePost"; return(View("RecordDoesNotExistError")); } if (type == "Air") { return(RedirectToAction("Create", "PolicyMessageGroupItemAir", new { id = policyGroupId })); } else if (type == "Car") { return(RedirectToAction("Create", "PolicyMessageGroupItemCar", new { id = policyGroupId })); } return(RedirectToAction("Create", "PolicyMessageGroupItemHotel", new { id = policyGroupId })); }
//Add Data From Linked Tables for Display public void EditItemForDisplay(PolicyCountryGroupItem policyCountryGroupItem) { //PolicyGroupName PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository(); PolicyGroup policyGroup = policyGroupRepository.GetGroup(policyCountryGroupItem.PolicyGroupId); policyCountryGroupItem.PolicyGroupName = policyGroup.PolicyGroupName; //PolicyCountryStatus if (policyCountryGroupItem.PolicyCountryStatusId != null) { int policyCountryStatusId = (int)policyCountryGroupItem.PolicyCountryStatusId; PolicyCountryStatusRepository policyCountryStatusRepository = new PolicyCountryStatusRepository(); PolicyCountryStatus policyCountryStatus = new PolicyCountryStatus(); policyCountryStatus = policyCountryStatusRepository.GetPolicyCountryStatus(policyCountryStatusId); if (policyCountryStatus != null) { policyCountryGroupItem.PolicyCountryStatusDescription = policyCountryStatus.PolicyCountryStatusDescription; } } //CountryName CountryRepository countryRepository = new CountryRepository(); Country country = new Country(); country = countryRepository.GetCountry(policyCountryGroupItem.CountryCode); if (country != null) { policyCountryGroupItem.CountryName = country.CountryName; } }
public ActionResult View(int id) { PolicyMessageGroupItemHotel policyMessageGroupItemHotel = new PolicyMessageGroupItemHotel(); policyMessageGroupItemHotel = policyMessageGroupItemHotelRepository.GetPolicyMessageGroupItemHotel(id);; //Check Exists if (policyMessageGroupItemHotel == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyMessageGroupItemHotel.PolicyGroupId); PolicyMessageGroupItemHotelVM policyMessageGroupItemHotelVM = new PolicyMessageGroupItemHotelVM(); policyMessageGroupItemHotelVM.PolicyGroupName = policyGroup.PolicyGroupName; policyMessageGroupItemHotelVM.PolicyGroupId = policyGroup.PolicyGroupId; policyMessageGroupItemHotelVM.PolicyMessageGroupItemHotel = policyMessageGroupItemHotel; //Populate List of PolicyLocations PolicyLocationRepository policyLocationRepository = new PolicyLocationRepository(); SelectList policyLocations = new SelectList(policyLocationRepository.GetAllPolicyLocations().ToList(), "PolicyLocationId", "PolicyLocationName", policyMessageGroupItemHotel.PolicyLocationId); policyMessageGroupItemHotelVM.PolicyLocations = policyLocations; return(View(policyMessageGroupItemHotelVM)); }
// GET: /View public ActionResult View(int id) { //Get PolicyCarTypeGroupItem PolicyCityGroupItem policyCityGroupItem = new PolicyCityGroupItem(); policyCityGroupItem = policyCityGroupItemRepository.GetPolicyCityGroupItem(id); //Check Exists if (policyCityGroupItem == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } //Create ViewModel PolicyCityGroupItemVM policyCityGroupItemVM = new PolicyCityGroupItemVM(); PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyCityGroupItem.PolicyGroupId); policyCityGroupItemVM.PolicyGroup = policyGroup; policyCityGroupItemVM.PolicyCityGroupItem = policyCityGroupItem; //Return Form to Users return(View(policyCityGroupItemVM)); }
public PolicyPriceTrackingOtherGroupItemsVM( CWTPaginatedList <spDesktopDataAdmin_SelectPolicyPriceTrackingOtherGroupItems_v1Result> policyPriceTrackingOtherGroupItems, PolicyGroup policyGroup) { PolicyPriceTrackingOtherGroupItems = policyPriceTrackingOtherGroupItems; PolicyGroup = policyGroup; }
// GET: /PolicyAirParameterGroupItemLanguage/Create public ActionResult Create(int id, int policyGroupId) { PolicyAirParameterGroupItemLanguageVM policyAirParameterGroupItemLanguageVM = new PolicyAirParameterGroupItemLanguageVM(); //Check Policy Exists PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyGroupId); if (policyGroup == null) { ViewData["ActionMethod"] = "CreateGet"; return View("RecordDoesNotExistError"); } //Check PolicyAirParameterGroupItem Exists PolicyAirParameterGroupItem policyAirParameterGroupItem = new PolicyAirParameterGroupItem(); policyAirParameterGroupItem = policyAirParameterGroupItemRepository.GetPolicyAirParameterGroupItem(id); if (policyAirParameterGroupItem == null) { ViewData["ActionMethod"] = "CreateGet"; return View("RecordDoesNotExistError"); } policyAirParameterGroupItemLanguageVM.PolicyAirParameterGroupItem = policyAirParameterGroupItem; policyGroupRepository.EditGroupForDisplay(policyGroup); policyAirParameterGroupItemLanguageVM.PolicyGroup = policyGroup; PolicyAirParameterGroupItemLanguage policyAirParameterGroupItemLanguage = new PolicyAirParameterGroupItemLanguage(); policyAirParameterGroupItemLanguageVM.PolicyAirParameterGroupItemLanguage = policyAirParameterGroupItemLanguage; //Languages SelectList languages = new SelectList(policyAirParameterGroupItemLanguageRepository.GetAvailableLanguages(id).ToList(), "LanguageCode", "LanguageName"); policyAirParameterGroupItemLanguageVM.Languages = languages; return View(policyAirParameterGroupItemLanguageVM); }
public ActionResult View(int id) { PolicyMessageGroupItemAir policyMessageGroupItemAir = new PolicyMessageGroupItemAir(); policyMessageGroupItemAir = policyMessageGroupItemAirRepository.GetPolicyMessageGroupItemAir(id);; //Check Exists if (policyMessageGroupItemAir == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyMessageGroupItemAir.PolicyGroupId); PolicyMessageGroupItemAirVM policyMessageGroupItemAirVM = new PolicyMessageGroupItemAirVM(); policyMessageGroupItemAirVM.PolicyGroupName = policyGroup.PolicyGroupName; policyMessageGroupItemAirVM.PolicyGroupId = policyGroup.PolicyGroupId; policyMessageGroupItemAirVM.PolicyMessageGroupItemAir = policyMessageGroupItemAir; //add the PolicyRouting information PolicyRouting policyRouting = policyRoutingRepository.GetPolicyRouting((int)policyMessageGroupItemAir.PolicyRoutingId); policyRoutingRepository.EditForDisplay(policyRouting); policyMessageGroupItemAirVM.PolicyRouting = policyRouting; return(View(policyMessageGroupItemAirVM)); }
// GET: Linked ClientSubUnits public ActionResult LinkedClientSubUnits(int id) { //Get Group From Database PolicyGroup group = new PolicyGroup(); group = policyGroupRepository.GetGroup(id); //Check Exists if (group == null) { ViewData["ActionMethod"] = "ClientSubUnitGet"; return(View("RecordDoesNotExistError")); } PolicyGroupClientSubUnitCountriesVM policyGroupClientSubUnits = new PolicyGroupClientSubUnitCountriesVM(); policyGroupClientSubUnits.PolicyGroupId = id; policyGroupClientSubUnits.PolicyGroupName = group.PolicyGroupName; List <ClientSubUnitCountryVM> clientSubUnitsAvailable = new List <ClientSubUnitCountryVM>(); clientSubUnitsAvailable = policyGroupRepository.GetLinkedClientSubUnits(id, false); policyGroupClientSubUnits.ClientSubUnitsAvailable = clientSubUnitsAvailable; List <ClientSubUnitCountryVM> clientSubUnitsUnAvailable = new List <ClientSubUnitCountryVM>(); clientSubUnitsUnAvailable = policyGroupRepository.GetLinkedClientSubUnits(id, true); policyGroupClientSubUnits.ClientSubUnitsUnAvailable = clientSubUnitsUnAvailable; return(View(policyGroupClientSubUnits)); }
public Policy24HSCOtherGroupItemsVM( CWTPaginatedList <spDesktopDataAdmin_SelectPolicy24HSCOtherGroupItems_v1Result> policy24HSCVendorGroupItems, PolicyGroup policyGroup) { Policy24HSCVendorGroupItems = policy24HSCVendorGroupItems; PolicyGroup = policyGroup; }
//Export Items to CSV public byte[] Export(int id) { StringBuilder sb = new StringBuilder(); //Add Headers List <string> headers = new List <string>(); headers.Add("Policy Group Name"); headers.Add("City Name"); headers.Add("City Code"); headers.Add("PolicyCityStatusDescription"); headers.Add("Enabled Flag"); headers.Add("Enabled Date"); headers.Add("Expiry Date"); headers.Add("Travel Date Valid From"); headers.Add("Travel Date Valid To"); headers.Add("Inherit From Parent Flag"); headers.Add("Creation TimeStamp"); headers.Add("Last Update Time Stamp"); headers.Add("Advice"); sb.AppendLine(String.Join(",", headers.Select(x => x.ToString()).ToArray())); //Add Items List <PolicyCityGroupItem> policyCityGroupItems = db.PolicyCityGroupItems.Where(x => x.PolicyGroupId == id).ToList(); foreach (PolicyCityGroupItem item in policyCityGroupItems) { //PolicyGroupName PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository(); PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(item.PolicyGroupId); string PolicyGroupName = policyGroup.PolicyGroupName; int adviceCount = 0; string date_format = "MM/dd/yy HH:mm"; string short_date_format = "yyyy/MM/dd"; sb.AppendFormat("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12}", !string.IsNullOrEmpty(PolicyGroupName) ? PolicyGroupName : "", !string.IsNullOrEmpty(item.City.Name) ? item.City.Name : "", !string.IsNullOrEmpty(item.CityCode) ? item.CityCode : "", !string.IsNullOrEmpty(item.PolicyCityStatus.PolicyCityStatusDescription) ? item.PolicyCityStatus.PolicyCityStatusDescription: "", item.EnabledFlag == true ? "True" : "False", item.EnabledDate.HasValue ? item.EnabledDate.Value.ToString(short_date_format) : "", item.ExpiryDate.HasValue ? item.ExpiryDate.Value.ToString(short_date_format) : "", item.TravelDateValidFrom.HasValue ? item.TravelDateValidFrom.Value.ToString(short_date_format) : "", item.TravelDateValidTo.HasValue ? item.TravelDateValidTo.Value.ToString(short_date_format) : "", item.InheritFromParentFlag == true ? "True" : "False", item.CreationTimestamp.HasValue ? item.CreationTimestamp.Value.ToString(date_format) : "", item.LastUpdateTimestamp.HasValue ? item.LastUpdateTimestamp.Value.ToString(date_format) : "", adviceCount > 0 ? "True" : "False" ); sb.Append(Environment.NewLine); } return(Encoding.ASCII.GetBytes(sb.ToString())); }
// GET: /UnDelete public ActionResult UnDelete(int id) { //Get Item PolicyGroup group = new PolicyGroup(); group = policyGroupRepository.GetGroup(id); //Check Exists if (group == null || group.DeletedFlag == false) { ViewData["ActionMethod"] = "UnDeleteGet"; return(View("RecordDoesNotExistError")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToPolicyGroup(id)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } policyGroupRepository.EditGroupForDisplay(group); return(View(group)); }
//Add Data From Linked Tables for Display public void EditItemForDisplay(PolicyHotelPropertyGroupItem policyHotelPropertyGroupItem) { //PolicyGroupName PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository(); PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyHotelPropertyGroupItem.PolicyGroupId); policyHotelPropertyGroupItem.PolicyGroupName = policyGroup.PolicyGroupName; //PolicyHotelStatus if (policyHotelPropertyGroupItem.PolicyHotelStatusId != null) { int policyHotelStatusId = (int)policyHotelPropertyGroupItem.PolicyHotelStatusId; PolicyHotelStatusRepository policyHotelStatusRepository = new PolicyHotelStatusRepository(); PolicyHotelStatus policyHotelStatus = new PolicyHotelStatus(); policyHotelStatus = policyHotelStatusRepository.GetPolicyHotelStatus(policyHotelStatusId); policyHotelPropertyGroupItem.PolicyHotelStatus = policyHotelStatus.PolicyHotelStatusDescription; } //HarpHotel HarpHotelRepository harpHotelRepository = new HarpHotelRepository(); HarpHotel harpHotel = new HarpHotel(); harpHotel = harpHotelRepository.GetHarpHotel(policyHotelPropertyGroupItem.HarpHotelId); if (harpHotel != null) { policyHotelPropertyGroupItem.HarpHotelName = harpHotel.HarpHotelName; } }
public PolicyGroupSubMenuVM(PolicyGroup policyGroup, int policyAirCabinGroupItemCount, int policyAirMissedSavingsThresholdGroupItemCount, int policyAirVendorGroupItemCount, int policyCarTypeGroupItemCount, int policyCarVendorGroupItemCount, int policyCityGroupItemCount, int policyCountryGroupItemCount, int policyHotelCapRateGroupItemCount, int policyHotelPropertyItemCount, int policyHotelVendorGroupItemCount, int policyMessageGroupItemCount, int policySupplierDealCodeCount, int policySupplierServiceInformationCount, int policy24HSCOtherGroupItemCount, int policyAirOtherGroupItemCount, int policyAllOtherGroupItemCount, int policyCarOtherGroupItemCount, int policyHotelOtherGroupItemCount, int policyOtherGroupItemCount ) { PolicyGroup = policyGroup; PolicyAirCabinGroupItemCount = policyAirCabinGroupItemCount; PolicyAirMissedSavingsThresholdGroupItemCount = policyAirMissedSavingsThresholdGroupItemCount; PolicyAirVendorGroupItemCount = policyAirVendorGroupItemCount; PolicyCarTypeGroupItemCount = policyCarTypeGroupItemCount; PolicyCarVendorGroupItemCount = policyCarVendorGroupItemCount; PolicyCityGroupItemCount = policyCityGroupItemCount; PolicyCountryGroupItemCount = policyCountryGroupItemCount; PolicyHotelCapRateGroupItemCount = policyHotelCapRateGroupItemCount; PolicyHotelPropertyItemCount = policyHotelPropertyItemCount; PolicyHotelVendorGroupItemCount = policyHotelVendorGroupItemCount; PolicyMessageGroupItemCount = policyMessageGroupItemCount; PolicySupplierDealCodeCount = policySupplierDealCodeCount; PolicySupplierServiceInformationCount = policySupplierServiceInformationCount; Policy24HSCOtherGroupItemCount = policy24HSCOtherGroupItemCount; PolicyAirOtherGroupItemCount = policyAirOtherGroupItemCount; PolicyAllOtherGroupItemCount = policyAllOtherGroupItemCount; PolicyCarOtherGroupItemCount = policyCarOtherGroupItemCount; PolicyHotelOtherGroupItemCount = policyHotelOtherGroupItemCount; PolicyOtherGroupItemCount = policyOtherGroupItemCount; }
public ActionResult Delete(int id) { PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem(); policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(id); //Check Exists if (policyAirMissedSavingsThresholdGroupItem == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } //Check AccessRights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToPolicyGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Create ViewModel PolicyAirMissedSavingsThresholdGroupItemVM policyAirMissedSavingsThresholdGroupItemVM = new PolicyAirMissedSavingsThresholdGroupItemVM(); PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId); policyAirMissedSavingsThresholdGroupItemVM.PolicyGroup = policyGroup; policyAirMissedSavingsThresholdGroupItemVM.PolicyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItem; //Return Form to Users return(View(policyAirMissedSavingsThresholdGroupItemVM)); }
// GET: /Create public ActionResult Create(int id) { PolicyGroup policyGroup = policyGroupRepository.GetGroup(id); if (policyGroup == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } //Check AccessRights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToPolicyGroup(id)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Populate List of PolicyCountryStatuses PolicyCountryStatusRepository policyCountryStatusRepository = new PolicyCountryStatusRepository(); SelectList policyCountryStatuses = new SelectList(policyCountryStatusRepository.GetAllPolicyCountryStatuses().ToList(), "PolicyCountryStatusId", "PolicyCountryStatusDescription"); ViewData["PolicyCountryStatusList"] = policyCountryStatuses; //populateItem with known PolicyGroup Information PolicyCountryGroupItem policyCountryGroupItem = new PolicyCountryGroupItem(); policyCountryGroupItem.PolicyGroupId = id; policyCountryGroupItem.PolicyGroupName = policyGroup.PolicyGroupName; //Show 'Create' Form return(View(policyCountryGroupItem)); }
//Add Data From Linked Tables for Display public void EditItemForDisplay(PolicyHotelCapRateGroupItem policyHotelCapRateGroupItem) { //PolicyGroupName PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository(); PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyHotelCapRateGroupItem.PolicyGroupId); policyHotelCapRateGroupItem.PolicyGroupName = policyGroup.PolicyGroupName; //Currency if (policyHotelCapRateGroupItem.CurrencyCode != null) { string currencyCode = policyHotelCapRateGroupItem.CurrencyCode; CurrencyRepository currencyRepository = new CurrencyRepository(); Currency currency = new Currency(); currency = currencyRepository.GetCurrency(currencyCode); policyHotelCapRateGroupItem.CurrencyName = currency.Name; } //PolicyLocation PolicyLocationRepository policyLocationRepository = new PolicyLocationRepository(); PolicyLocation policyLocation = new PolicyLocation(); policyLocation = policyLocationRepository.GetPolicyLocation(policyHotelCapRateGroupItem.PolicyLocationId); if (policyLocation != null) { policyHotelCapRateGroupItem.PolicyLocation = policyLocation.PolicyLocationName; } }
//Add Data From Linked Tables for Display public void EditItemForDisplay(PolicyAirMissedSavingsThresholdGroupItemLanguage policyAirMissedSavingsThresholdGroupItemLanguage) { //Add LanguageName if (policyAirMissedSavingsThresholdGroupItemLanguage.LanguageCode != null) { LanguageRepository languageRepository = new LanguageRepository(); Language language = new Language(); language = languageRepository.GetLanguage(policyAirMissedSavingsThresholdGroupItemLanguage.LanguageCode); if (language != null) { policyAirMissedSavingsThresholdGroupItemLanguage.LanguageName = language.LanguageName; } } //Add PolicyGroupName PolicyAirMissedSavingsThresholdGroupItemRepository policyAirMissedSavingsThresholdGroupItemRepository = new PolicyAirMissedSavingsThresholdGroupItemRepository(); PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem = new PolicyAirMissedSavingsThresholdGroupItem(); policyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItemRepository.GetPolicyAirMissedSavingsThresholdGroupItem(policyAirMissedSavingsThresholdGroupItemLanguage.PolicyAirMissedSavingsThresholdGroupItemId); if (policyAirMissedSavingsThresholdGroupItem != null) { PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository(); PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyAirMissedSavingsThresholdGroupItem.PolicyGroupId); //policyAirMissedSavingsThresholdGroupItemRepository.EditItemForDisplay(policyAirMissedSavingsThresholdGroupItem); policyAirMissedSavingsThresholdGroupItemLanguage.PolicyGroupName = policyGroup.PolicyGroupName; policyAirMissedSavingsThresholdGroupItemLanguage.PolicyGroupId = policyAirMissedSavingsThresholdGroupItem.PolicyGroupId; } }
// GET: /EditSequence public ActionResult EditSequence(int id, int?page) { //Check Exists PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(id); if (policyGroup == null) { ViewData["ActionMethod"] = "EditSequenceGet"; return(View("RecordDoesNotExistError")); } //Check Access Rights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToPolicyGroup(id)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } PolicyGroupSequenceRepository policyGroupSequenceRepository = new PolicyGroupSequenceRepository(); var result = policyGroupSequenceRepository.GetPolicyCityGroupItemSequences(id, page ?? 1); ViewData["Page"] = page ?? 1; ViewData["PolicyGroupId"] = id; ViewData["PolicyGroupName"] = policyGroup.PolicyGroupName; return(View(result)); }
public ActionResult View(int id) { PolicyMessageGroupItemCar policyMessageGroupItemCar = new PolicyMessageGroupItemCar(); policyMessageGroupItemCar = policyMessageGroupItemCarRepository.GetPolicyMessageGroupItemCar(id);; //Check Exists if (policyMessageGroupItemCar == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyMessageGroupItemCar.PolicyGroupId); PolicyMessageGroupItemCarVM policyMessageGroupItemCarVM = new PolicyMessageGroupItemCarVM(); policyMessageGroupItemCarVM.PolicyGroupName = policyGroup.PolicyGroupName; policyMessageGroupItemCarVM.PolicyGroupId = policyGroup.PolicyGroupId; policyMessageGroupItemCarVM.PolicyMessageGroupItemCar = policyMessageGroupItemCar; return(View(policyMessageGroupItemCarVM)); }
public ActionResult Delete(int id) { PolicyMessageGroupItemCar policyMessageGroupItemCar = new PolicyMessageGroupItemCar(); policyMessageGroupItemCar = policyMessageGroupItemCarRepository.GetPolicyMessageGroupItemCar(id);; //Check Exists if (policyMessageGroupItemCar == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyMessageGroupItemCar.PolicyGroupId); RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToPolicyGroupMessages(policyGroup.PolicyGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } PolicyMessageGroupItemCarVM policyMessageGroupItemCarVM = new PolicyMessageGroupItemCarVM(); policyMessageGroupItemCarVM.PolicyGroupName = policyGroup.PolicyGroupName; policyMessageGroupItemCarVM.PolicyGroupId = policyGroup.PolicyGroupId; policyMessageGroupItemCarVM.PolicyMessageGroupItemCar = policyMessageGroupItemCar; return(View(policyMessageGroupItemCarVM)); }
// GET: /View public ActionResult View(int id) { //Get PolicyAirVendorGroupItem PolicyAirVendorGroupItem policyAirVendorGroupItem = new PolicyAirVendorGroupItem(); policyAirVendorGroupItem = policyAirVendorGroupItemRepository.GetPolicyAirVendorGroupItem(id); //Check Exists if (policyAirVendorGroupItem == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } //populate new PolicyAirVendorGroupItem with known PolicyGroup Information policyAirVendorGroupItemRepository.EditItemForDisplay(policyAirVendorGroupItem); //Policy Group PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyAirVendorGroupItem.PolicyGroupId); //add the PolicyRouting information PolicyRouting policyRouting = policyRoutingRepository.GetPolicyRouting(policyAirVendorGroupItem.PolicyRoutingId); policyRoutingRepository.EditForDisplay(policyRouting); PolicyAirVendorGroupItemVM policyAirVendorGroupItemViewModel = new PolicyAirVendorGroupItemVM(policyGroup, policyAirVendorGroupItem, policyRouting); //Show 'Create' Form return(View(policyAirVendorGroupItemViewModel)); }
public PolicyAirMissedSavingsThresholdGroupItemVM(PolicyGroup policyGroup, PolicyAirMissedSavingsThresholdGroupItem policyAirMissedSavingsThresholdGroupItem, IEnumerable <SelectListItem> currencies, IEnumerable <SelectListItem> routingCodes) { PolicyGroup = policyGroup; PolicyAirMissedSavingsThresholdGroupItem = policyAirMissedSavingsThresholdGroupItem; RoutingCodes = routingCodes; }
//GET: A list of PolicyGroupCarType Items for this PolicyGroup public ActionResult List(int id, string filter, int?page, string sortField, int?sortOrder) { PolicyGroup group = new PolicyGroup(); group = policyGroupRepository.GetGroup(id);; //Check Exists if (group == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } policyGroupRepository.EditGroupForDisplay(group); //Set Access Rights RolesRepository rolesRepository = new RolesRepository(); ViewData["Access"] = ""; if (rolesRepository.HasWriteAccessToPolicyGroup(id)) { ViewData["Access"] = "WriteAccess"; } //Set Import Access Rights ViewData["ImportAccess"] = ""; if (rolesRepository.HasWriteAccessToPolicyHotelCapRateImport(id)) { ViewData["ImportAccess"] = "WriteAccess"; } //Parent Information ViewData["PolicyGroupID"] = id; ViewData["PolicyGroupName"] = group.PolicyGroupName; //SortField + SortOrder settings if (string.IsNullOrEmpty(sortField)) { sortField = "SequenceNumber"; } ViewData["CurrentSortField"] = sortField; if (sortOrder == 1) { ViewData["NewSortOrder"] = 0; ViewData["CurrentSortOrder"] = 1; } else { ViewData["NewSortOrder"] = 1; ViewData["CurrentSortOrder"] = 0; } var items = policyHotelCapRateGroupItemRepository.GetPolicyHotelCapRateGroupItems(id, filter ?? "", sortField, sortOrder ?? 0, page ?? 1); return(View(items)); }
public ActionResult Create(PolicyMessageGroupItemCarVM policyMessageGroupItemCarVM) { int policyGroupId = policyMessageGroupItemCarVM.PolicyMessageGroupItemCar.PolicyGroupId; PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyGroupId);; //Check Exists if (policyGroup == null) { ViewData["ActionMethod"] = "CreatePost"; return(View("RecordDoesNotExistError")); } //Check AccessRights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToPolicyGroupMessages(policyGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Update Model from Form try { UpdateModel <PolicyMessageGroupItemCar>(policyMessageGroupItemCarVM.PolicyMessageGroupItemCar, "PolicyMessageGroupItemCar"); } 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")); } try { policyMessageGroupItemCarRepository.Add(policyMessageGroupItemCarVM.PolicyMessageGroupItemCar); } 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", "PolicyMessageGroupItem", new { id = policyGroupId })); }
public ActionResult Delete(PolicyCarOtherGroupItemDataTableItemVM policyCarOtherGroupItemDataTableItemVM) { //Check PolicyCarOtherGroupItemDataTableRow Exists PolicyCarOtherGroupItemDataTableRow policyCarOtherGroupItemDataTableRow = new PolicyCarOtherGroupItemDataTableRow(); policyCarOtherGroupItemDataTableRow = policyCarOtherGroupItemDataTableRowRepository.GetPolicyCarOtherGroupItemDataTableRow( policyCarOtherGroupItemDataTableItemVM.PolicyCarOtherGroupItemDataTableRow.PolicyCarOtherGroupItemDataTableRowId ); if (policyCarOtherGroupItemDataTableRow == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Check Policy Exists PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyCarOtherGroupItemDataTableItemVM.PolicyGroup.PolicyGroupId); if (policyGroup == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Check PolicyOtherGroupHeader Exists PolicyOtherGroupHeader policyOtherGroupHeader = new PolicyOtherGroupHeader(); policyOtherGroupHeader = policyOtherGroupHeaderRepository.GetPolicyOtherGroupHeader( policyCarOtherGroupItemDataTableItemVM.PolicyOtherGroupHeader.PolicyOtherGroupHeaderId ); if (policyOtherGroupHeader == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } //Delete Form Item try { policyCarOtherGroupItemDataTableItemRepository.Delete(policyCarOtherGroupItemDataTableRow); } catch (SqlException ex) { //Versioning Error - go to standard versionError page if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/PolicyCarOtherGroupItemDataTableItem.mvc/Delete/" + policyCarOtherGroupItemDataTableItemVM.PolicyCarOtherGroupItemDataTableRow.PolicyCarOtherGroupItemDataTableRowId; 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("List", new { id = policyCarOtherGroupItemDataTableItemVM.PolicyOtherGroupHeader.PolicyOtherGroupHeaderId, policyGroupId = policyCarOtherGroupItemDataTableItemVM.PolicyGroup.PolicyGroupId })); }
public ActionResult Create(PolicyAirParameterGroupItemLanguageVM policyAirParameterGroupItemLanguageVM, FormCollection formCollection) { //Check Policy Exists PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyAirParameterGroupItemLanguageVM.PolicyGroup.PolicyGroupId); if (policyGroup == null) { ViewData["ActionMethod"] = "CreatePost"; return(View("RecordDoesNotExistError")); } //Check PolicyAirParameterGroupItem Exists PolicyAirParameterGroupItem policyAirParameterGroupItem = new PolicyAirParameterGroupItem(); policyAirParameterGroupItem = policyAirParameterGroupItemRepository.GetPolicyAirParameterGroupItem(policyAirParameterGroupItemLanguageVM.PolicyAirParameterGroupItem.PolicyAirParameterGroupItemId); if (policyAirParameterGroupItem == null) { ViewData["ActionMethod"] = "CreatePost"; return(View("RecordDoesNotExistError")); } //We need to extract group from groupVM PolicyAirParameterGroupItemLanguage policyAirParameterGroupItemLanguage = new PolicyAirParameterGroupItemLanguage(); policyAirParameterGroupItemLanguage = policyAirParameterGroupItemLanguageVM.PolicyAirParameterGroupItemLanguage; if (policyAirParameterGroupItemLanguage == null) { ViewData["Message"] = "ValidationError : missing item";; return(View("Error")); } policyAirParameterGroupItemLanguage.PolicyAirParameterGroupItemId = policyAirParameterGroupItem.PolicyAirParameterGroupItemId; //Database Update try { policyAirParameterGroupItemLanguageRepository.Add(policyAirParameterGroupItemLanguageVM.PolicyAirParameterGroupItemLanguage); } catch (SqlException ex) { //Non-Unique Name if (ex.Message == "NonUniqueName") { return(View("NonUniqueNameError")); } 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")); } ViewData["NewSortOrder"] = 0; return(RedirectToAction("List", new { id = policyAirParameterGroupItemLanguageVM.PolicyAirParameterGroupItem.PolicyAirParameterGroupItemId, policyGroupId = policyAirParameterGroupItemLanguageVM.PolicyGroup.PolicyGroupId })); }
public PolicyAirParameterGroupItemLanguagesVM( CWTPaginatedList <spDesktopDataAdmin_SelectPolicyAirParameterGroupItemLanguages_v1Result> policyAirParameterGroupItemLanguages, PolicyAirParameterGroupItem policyAirParameterGroupItem, PolicyGroup policyGroup) { PolicyAirParameterGroupItemLanguages = policyAirParameterGroupItemLanguages; PolicyAirParameterGroupItem = policyAirParameterGroupItem; PolicyGroup = policyGroup; }
public PolicyOnlineOtherGroupItemLanguagesVM( CWTPaginatedList <spDesktopDataAdmin_SelectPolicyOnlineOtherGroupItemLanguages_v1Result> policyOnlineOtherGroupItemLanguages, PolicyOtherGroupHeader policyOtherGroupHeader, PolicyGroup policyGroup) { PolicyOnlineOtherGroupItemLanguages = policyOnlineOtherGroupItemLanguages; PolicyOtherGroupHeader = policyOtherGroupHeader; PolicyGroup = policyGroup; }
// GET: /PolicyOtherGroupItemLanguage/List public ActionResult List(int id, int policyGroupId, string filter, int?page, string sortField, int?sortOrder) { PolicyOtherGroupItemLanguagesVM policyOtherGroupItemLanguagesVM = new PolicyOtherGroupItemLanguagesVM(); //Check Policy Exists PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyGroupId); if (policyGroup == null) { return(View("Error")); } policyOtherGroupItemLanguagesVM.PolicyGroup = policyGroup; //Check PolicyOtherGroupHeader Exists PolicyOtherGroupHeader policyOtherGroupHeader = new PolicyOtherGroupHeader(); policyOtherGroupHeader = policyOtherGroupHeaderRepository.GetPolicyOtherGroupHeader(id); if (policyOtherGroupHeader == null) { return(View("Error")); } policyOtherGroupItemLanguagesVM.PolicyOtherGroupHeader = policyOtherGroupHeader; //Set Access Rights policyOtherGroupItemLanguagesVM.HasWriteAccess = false; RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToPolicyGroup(policyGroupId)) { policyOtherGroupItemLanguagesVM.HasWriteAccess = true; } //SortField + SortOrder settings if (string.IsNullOrEmpty(sortField)) { sortField = "Label"; } ViewData["CurrentSortField"] = sortField; if (sortOrder == 1) { ViewData["NewSortOrder"] = 0; ViewData["CurrentSortOrder"] = 1; } else { ViewData["NewSortOrder"] = 1; ViewData["CurrentSortOrder"] = 0; } policyOtherGroupItemLanguagesVM.PolicyVendorGroupItemLanguages = policyOtherGroupItemLanguageRepository.GetPolicyOtherGroupItemLanguages(id, policyGroup.PolicyGroupId, filter ?? "", sortField, sortOrder ?? 0, page ?? 1); return(View(policyOtherGroupItemLanguagesVM)); }
// GET: /PolicyOtherGroupItemLanguage/Edit public ActionResult Edit(int id, int policyGroupId, int policyOtherGroupHeaderId) { PolicyOtherGroupItemLanguageVM policyOtherGroupItemLanguageVM = new PolicyOtherGroupItemLanguageVM(); //Check Item Exists PolicyOtherGroupItemLanguage policyOtherGroupItemLanguage = new PolicyOtherGroupItemLanguage(); policyOtherGroupItemLanguage = policyOtherGroupItemLanguageRepository.GetPolicyOtherGroupItemLanguage(id); if (policyOtherGroupItemLanguage == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check Policy Exists PolicyGroup policyGroup = new PolicyGroup(); policyGroup = policyGroupRepository.GetGroup(policyGroupId); if (policyGroup == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check PolicyOtherGroupHeader Exists PolicyOtherGroupHeader policyOtherGroupHeader = new PolicyOtherGroupHeader(); policyOtherGroupHeader = policyOtherGroupHeaderRepository.GetPolicyOtherGroupHeader(policyOtherGroupHeaderId); if (policyOtherGroupHeader == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } policyOtherGroupItemLanguageVM.PolicyOtherGroupHeader = policyOtherGroupHeader; policyOtherGroupItemLanguageVM.PolicyOtherGroupItemLanguage = policyOtherGroupItemLanguage; policyGroupRepository.EditGroupForDisplay(policyGroup); policyOtherGroupItemLanguageVM.PolicyGroup = policyGroup; //Languages List <Language> availableLanguages = policyOtherGroupItemLanguageRepository.GetAvailableLanguages(policyOtherGroupHeaderId, policyGroup.PolicyGroupId).ToList(); Language selectedLanguage = new Language(); LanguageRepository languageRepository = new LanguageRepository(); selectedLanguage = languageRepository.GetLanguage(policyOtherGroupItemLanguage.LanguageCode); if (selectedLanguage != null) { availableLanguages.Add(selectedLanguage); } SelectList languages = new SelectList(availableLanguages.OrderBy(x => x.LanguageCode), "LanguageCode", "LanguageName", policyOtherGroupItemLanguage.LanguageCode); policyOtherGroupItemLanguageVM.Languages = languages; return(View(policyOtherGroupItemLanguageVM)); }