// GET: /Create public ActionResult Create(string id) { //Get ClientSubUnit ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id); //Check Exists if (clientSubUnit == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } //Access Rights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(id) || !hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } BookingChannelVM bookingChannelVM = new BookingChannelVM(); bookingChannelVM.ClientSubUnit = clientSubUnit; BookingChannel bookingChannel = new BookingChannel(); bookingChannel.ClientSubUnit = clientSubUnit; bookingChannel.ClientSubUnitGuid = clientSubUnit.ClientSubUnitGuid; bookingChannelVM.BookingChannel = bookingChannel; //Usage Types UsageTypeRepository usageTypeRepository = new UsageTypeRepository(); bookingChannelVM.UsageTypes = new SelectList(usageTypeRepository.GetAvailableUsageTypes(id).ToList(), "UsageTypeId", "UsageTypeDescription"); //Booking Channel Types BookingChannelTypeRepository bookingChannelTypeRepository = new BookingChannelTypeRepository(); bookingChannelVM.BookingChannelTypes = new SelectList(bookingChannelTypeRepository.GetAllBookingChannelTypes().ToList(), "BookingChannelTypeId", "BookingChannelTypeDescription"); //Channel Products ProductChannelTypeRepository productChannelTypeRepository = new ProductChannelTypeRepository(); bookingChannelVM.ProductChannelTypes = new SelectList(productChannelTypeRepository.GetAllProductChannelTypes().ToList(), "ProductChannelTypeId", "ProductChannelTypeDescription"); //Desktop Used Types DesktopUsedTypeRepository desktopUsedTypeRepository = new DesktopUsedTypeRepository(); bookingChannelVM.DesktopUsedTypes = new SelectList(desktopUsedTypeRepository.GetAllDesktopUsedTypes().ToList(), "DesktopUsedTypeId", "DesktopUsedTypeDescription"); //Content Booked Items ProductRepository productRepository = new ProductRepository(); bookingChannelVM.Products = new SelectList(productRepository.GetAllProducts().ToList(), "ProductId", "ProductName"); GDSRepository GDSRepository = new GDSRepository(); bookingChannelVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName"); //Show Create Form return(View(bookingChannelVM)); }
public ActionResult Delete(int id) { //Get BookingChannel BookingChannel bookingChannel = new BookingChannel(); bookingChannel = bookingChannelRepository.BookingChannel(id); //Check Exists if (bookingChannel == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } //Access Rights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(bookingChannel.ClientSubUnitGuid) || !hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } BookingChannelVM bookingChannelVM = new BookingChannelVM(); bookingChannelVM.BookingChannel = bookingChannel; //Get ClientSubUnit ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(bookingChannel.ClientSubUnitGuid); bookingChannelVM.ClientSubUnit = clientSubUnit; //Get GDS GDSRepository gdsRepository = new GDSRepository(); GDS gds = gdsRepository.GetGDS(bookingChannel.GDSCode); bookingChannelVM.GDS = gds; //Channel Products if (bookingChannel.ProductChannelTypeId != null) { ProductChannelTypeRepository productChannelTypeRepository = new ProductChannelTypeRepository(); ProductChannelType productChannelType = productChannelTypeRepository.GetProductChannelType((int)bookingChannel.ProductChannelTypeId); if (productChannelType != null) { bookingChannelVM.BookingChannel.ProductChannelType = productChannelType; } } //Desktop Used Types if (bookingChannel.DesktopUsedTypeId != null) { DesktopUsedTypeRepository desktopUsedTypeRepository = new DesktopUsedTypeRepository(); DesktopUsedType desktopUsedType = desktopUsedTypeRepository.GetDesktopUsedType((int)bookingChannel.DesktopUsedTypeId); if (desktopUsedType != null) { bookingChannelVM.BookingChannel.DesktopUsedType = desktopUsedType; } } //Content Booked Items ContentBookedItemRepository contentBookedItemRepository = new ContentBookedItemRepository(); List <ContentBookedItem> contentBookedItems = contentBookedItemRepository.GetBookingChannelContentBookedItems(bookingChannel.BookingChannelId).ToList(); if (contentBookedItems != null) { bookingChannelVM.ContentBookedItemsList = String.Join(", ", contentBookedItems.Select(x => x.Product.ProductName.ToString()).ToArray()); } //Show Form return(View(bookingChannelVM)); }
// GET: /View public ActionResult View(int id) { //Get BookingChannel BookingChannel bookingChannel = new BookingChannel(); bookingChannel = bookingChannelRepository.BookingChannel(id); //Check Exists if (bookingChannel == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } BookingChannelVM bookingChannelVM = new BookingChannelVM(); bookingChannelVM.BookingChannel = bookingChannel; //Get ClientSubUnit ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(bookingChannel.ClientSubUnitGuid); bookingChannelVM.ClientSubUnit = clientSubUnit; //Get GDS GDSRepository gdsRepository = new GDSRepository(); GDS gds = gdsRepository.GetGDS(bookingChannel.GDSCode); bookingChannelVM.GDS = gds; //Channel Products if (bookingChannel.ProductChannelTypeId != null) { ProductChannelTypeRepository productChannelTypeRepository = new ProductChannelTypeRepository(); ProductChannelType productChannelType = productChannelTypeRepository.GetProductChannelType((int)bookingChannel.ProductChannelTypeId); if (productChannelType != null) { bookingChannelVM.BookingChannel.ProductChannelType = productChannelType; } } //Desktop Used Types if (bookingChannel.DesktopUsedTypeId != null) { DesktopUsedTypeRepository desktopUsedTypeRepository = new DesktopUsedTypeRepository(); DesktopUsedType desktopUsedType = desktopUsedTypeRepository.GetDesktopUsedType((int)bookingChannel.DesktopUsedTypeId); if (desktopUsedType != null) { bookingChannelVM.BookingChannel.DesktopUsedType = desktopUsedType; } } //Content Booked Items ContentBookedItemRepository contentBookedItemRepository = new ContentBookedItemRepository(); List <ContentBookedItem> contentBookedItems = contentBookedItemRepository.GetBookingChannelContentBookedItems(bookingChannel.BookingChannelId).ToList(); if (contentBookedItems != null) { bookingChannelVM.ContentBookedItemsList = String.Join(", ", contentBookedItems.Select(x => x.Product.ProductName.ToString()).ToArray()); } //Show Form return(View(bookingChannelVM)); }
// GET: /Edit public ActionResult Edit(int id) { //Get BookingChannel BookingChannel bookingChannel = new BookingChannel(); bookingChannel = bookingChannelRepository.BookingChannel(id); //Check Exists if (bookingChannel == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Access Rights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(bookingChannel.ClientSubUnitGuid) || !hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } BookingChannelVM bookingChannelVM = new BookingChannelVM(); bookingChannelVM.BookingChannel = bookingChannel; //Get ClientSubUnit ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(bookingChannel.ClientSubUnitGuid); bookingChannelVM.ClientSubUnit = clientSubUnit; //Booking Channel Types BookingChannelTypeRepository bookingChannelTypeRepository = new BookingChannelTypeRepository(); if (bookingChannelVM.BookingChannel.BookingChannelTypeId != null) { bookingChannelVM.BookingChannelTypes = new SelectList( bookingChannelTypeRepository.GetAllBookingChannelTypes().ToList(), "BookingChannelTypeId", "BookingChannelTypeDescription", bookingChannelVM.BookingChannel.BookingChannelTypeId ); } else { bookingChannelVM.BookingChannelTypes = new SelectList( bookingChannelTypeRepository.GetAllBookingChannelTypes().ToList(), "BookingChannelTypeId", "BookingChannelTypeDescription" ); } //Channel Products ProductChannelTypeRepository productChannelTypeRepository = new ProductChannelTypeRepository(); int bookingChannelTypeId = (bookingChannelVM.BookingChannel.BookingChannelTypeId != null) ? bookingChannelVM.BookingChannel.BookingChannelTypeId.Value : 1; bookingChannelVM.ProductChannelTypes = new SelectList( productChannelTypeRepository.GetProductChannelTypesForBookingChannel(bookingChannelTypeId).ToList(), "ProductChannelTypeId", "ProductChannelTypeDescription", bookingChannelVM.BookingChannel.ProductChannelTypeId ); //Desktop Used Types DesktopUsedTypeRepository desktopUsedTypeRepository = new DesktopUsedTypeRepository(); if (bookingChannelVM.BookingChannel.DesktopUsedTypeId != null) { bookingChannelVM.DesktopUsedTypes = new SelectList( desktopUsedTypeRepository.GetAllDesktopUsedTypes().ToList(), "DesktopUsedTypeId", "DesktopUsedTypeDescription", bookingChannelVM.BookingChannel.DesktopUsedTypeId ); } else { bookingChannelVM.DesktopUsedTypes = new SelectList( desktopUsedTypeRepository.GetAllDesktopUsedTypes().ToList(), "DesktopUsedTypeId", "DesktopUsedTypeDescription" ); } //Content Booked Items ContentBookedItemRepository contentBookedItemRepository = new ContentBookedItemRepository(); List <ContentBookedItem> contentBookedItems = contentBookedItemRepository.GetBookingChannelContentBookedItems(bookingChannelVM.BookingChannel.BookingChannelId).ToList(); ProductRepository productRepository = new ProductRepository(); IEnumerable <SelectListItem> defaultProducts = new SelectList(productRepository.GetAllProducts().ToList(), "ProductId", "ProductName"); List <SelectListItem> contentBookedItemsSelected = new List <SelectListItem>(); foreach (SelectListItem item in defaultProducts) { bool selected = false; foreach (ContentBookedItem contentBookedItem in contentBookedItems) { if (item.Value == contentBookedItem.Product.ProductId.ToString()) { selected = true; } } contentBookedItemsSelected.Add( new SelectListItem() { Text = item.Text, Value = item.Value, Selected = selected } ); } bookingChannelVM.ContentBookedItemsSelected = contentBookedItemsSelected; //GDS GDSRepository GDSRepository = new GDSRepository(); bookingChannelVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName"); //Show Edit Form return(View(bookingChannelVM)); }
// GET: /Edit public ActionResult Edit(int id) { //Get Item From Database PriceTrackingSetupGroup group = new PriceTrackingSetupGroup(); group = priceTrackingSetupGroupRepository.GetPriceTrackingSetupGroup(id); //Check Exists if (group == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToPriceTrackingSetupGroup(id)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Set Access Rights ViewData["FIQIDAccess"] = ""; if (hierarchyRepository.AdminHasDomainWriteAccess(fIQIDGroupName)) { ViewData["FIQIDAccess"] = "WriteAccess"; } priceTrackingSetupGroupRepository.EditForDisplay(group); TripTypeRepository tripTypeRepository = new TripTypeRepository(); SelectList tripTypesList = new SelectList(tripTypeRepository.GetAllTripTypes().ToList(), "TripTypeId", "TripTypeDescription"); ViewData["tripTypes"] = tripTypesList; GDSRepository gdsRepository = new GDSRepository(); SelectList gDSList = new SelectList(gdsRepository.GetAllGDSs().ToList(), "GDSCode", "GDSName"); ViewData["GDSs"] = gDSList; PNROutputTypeRepository pNROutputTypeRepository = new PNROutputTypeRepository(); SelectList pNROutputTypeList = new SelectList(pNROutputTypeRepository.GetAllPNROutputTypes().ToList(), "PNROutputTypeId", "PNROutputTypeName"); ViewData["PNROutputTypes"] = pNROutputTypeList; TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository(); SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchies(groupName).ToList(), "HierarchyLevelTableName", "HierarchyLevelTableName"); ViewData["HierarchyTypes"] = hierarchyTypesList; PriceTrackingSetupTypeRepository priceTrackingSetupTypeRepository = new PriceTrackingSetupTypeRepository(); SelectList priceTrackingSetupTypes = new SelectList(priceTrackingSetupTypeRepository.GetAllPriceTrackingSetupTypes().ToList(), "PriceTrackingSetupTypeId", "PriceTrackingSetupTypeName", group.PriceTrackingSetupTypeId); ViewData["PriceTrackingSetupTypes"] = priceTrackingSetupTypes; DesktopUsedTypeRepository desktopUsedTypeRepository = new DesktopUsedTypeRepository(); SelectList desktopUsedTypes = new SelectList(desktopUsedTypeRepository.GetAllDesktopUsedTypes().ToList(), "DesktopUsedTypeId", "DesktopUsedTypeDescription", group.DesktopUsedTypeId); ViewData["DesktopUsedTypes"] = desktopUsedTypes; PriceTrackingMidOfficePlatformRepository priceTrackingMidOfficePlatformRepository = new PriceTrackingMidOfficePlatformRepository(); SelectList priceTrackingMidOfficePlatforms = new SelectList(priceTrackingMidOfficePlatformRepository.GetAllPriceTrackingMidOfficePlatforms().ToList(), "PriceTrackingMidOfficePlatformId", "PriceTrackingMidOfficePlatformName", group.PriceTrackingMidOfficePlatformId); ViewData["PriceTrackingMidOfficePlatforms"] = priceTrackingMidOfficePlatforms; ViewData["SharedPseudoCityOrOfficeList"] = new SelectList(commonRepository.GetTrueFalseList().ToList(), "Value", "Text", group.SharedPseudoCityOrOfficeIdFlag); ViewData["MidOfficeUsedForQCTicketingList"] = new SelectList(commonRepository.GetTrueFalseList().ToList(), "Value", "Text", group.MidOfficeUsedForQCTicketingFlag); ViewData["USGovernmentContractorList"] = new SelectList(commonRepository.GetTrueFalseList().ToList(), "Value", "Text", group.USGovernmentContractorFlag); ViewData["PriceTrackingSetupGroupAdditionalPseudoCityOrOfficeIdList"] = new SelectList(commonRepository.GetTrueFalseList().ToList(), "Value", "Text", "false"); PriceTrackingItinerarySolutionRepository priceTrackingItinerarySolutionRepository = new PriceTrackingItinerarySolutionRepository(); SelectList priceTrackingItinerarySolutions = new SelectList(priceTrackingItinerarySolutionRepository.GetAllPriceTrackingItinerarySolutions().ToList(), "PriceTrackingItinerarySolutionId", "PriceTrackingItinerarySolutionName", group.PriceTrackingItinerarySolutionId); ViewData["PriceTrackingItinerarySolutions"] = priceTrackingItinerarySolutions; PriceTrackingSystemRuleRepository priceTrackingSystemRuleRepository = new PriceTrackingSystemRuleRepository(); SelectList priceTrackingSystemRules = new SelectList(priceTrackingSystemRuleRepository.GetAllPriceTrackingSystemRules().ToList(), "PriceTrackingSystemRuleId", "PriceTrackingSystemRuleName", group.PriceTrackingSystemRuleId); ViewData["PriceTrackingSystemRules"] = priceTrackingSystemRules; BackOfficeSystemRepository backOfficeSystemRepository = new BackOfficeSystemRepository(); SelectList backOfficeSystems = new SelectList(backOfficeSystemRepository.GetAllBackOfficeSystems().ToList(), "BackOfficeSytemId", "BackOfficeSystemDescription", group.BackOfficeSystemId); ViewData["BackOfficeSystems"] = backOfficeSystems; PriceTrackingBillingModelRepository priceTrackingBillingModelRepository = new PriceTrackingBillingModelRepository(); List <PriceTrackingBillingModel> priceTrackingBillingModels = priceTrackingBillingModelRepository.GetAllPriceTrackingBillingModels().ToList(); SelectList airPriceTrackingBillingModels = new SelectList(priceTrackingBillingModels, "PriceTrackingBillingModelId", "PriceTrackingBillingModelName", group.AirPriceTrackingBillingModelId); ViewData["AirPriceTrackingBillingModels"] = airPriceTrackingBillingModels; SelectList hotelPriceTrackingBillingModels = new SelectList(priceTrackingBillingModels, "PriceTrackingBillingModelId", "PriceTrackingBillingModelName", group.HotelPriceTrackingBillingModelId); ViewData["HotelPriceTrackingBillingModels"] = hotelPriceTrackingBillingModels; SelectList preTicketPriceTrackingBillingModels = new SelectList(priceTrackingBillingModels, "PriceTrackingBillingModelId", "PriceTrackingBillingModelName", group.PreTicketPriceTrackingBillingModelId); ViewData["PreTicketPriceTrackingBillingModels"] = preTicketPriceTrackingBillingModels; return(View(group)); }
// GET: /Create public ActionResult Create() { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } PriceTrackingSetupGroup priceTrackingSetupGroup = new PriceTrackingSetupGroup(); priceTrackingSetupGroup.MidOfficeUsedForQCTicketingFlag = true; TripTypeRepository tripTypeRepository = new TripTypeRepository(); SelectList tripTypesList = new SelectList(tripTypeRepository.GetAllTripTypes().ToList(), "TripTypeId", "TripTypeDescription"); ViewData["TripTypes"] = tripTypesList; GDSRepository gdsRepository = new GDSRepository(); SelectList gDSList = new SelectList(gdsRepository.GetAllGDSs().ToList(), "GDSCode", "GDSName"); ViewData["GDSs"] = gDSList; PNROutputTypeRepository pNROutputTypeRepository = new PNROutputTypeRepository(); SelectList pNROutputTypeList = new SelectList(pNROutputTypeRepository.GetAllPNROutputTypes().ToList(), "PNROutputTypeId", "PNROutputTypeName"); ViewData["PNROutputTypes"] = pNROutputTypeList; TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository(); SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchies(groupName).ToList(), "HierarchyLevelTableName", "HierarchyLevelTableName"); ViewData["HierarchyTypes"] = hierarchyTypesList; PriceTrackingSetupTypeRepository priceTrackingSetupTypeRepository = new PriceTrackingSetupTypeRepository(); SelectList priceTrackingSetupTypes = new SelectList(priceTrackingSetupTypeRepository.GetAllPriceTrackingSetupTypes().ToList(), "PriceTrackingSetupTypeId", "PriceTrackingSetupTypeName"); ViewData["PriceTrackingSetupTypes"] = priceTrackingSetupTypes; DesktopUsedTypeRepository desktopUsedTypeRepository = new DesktopUsedTypeRepository(); SelectList desktopUsedTypes = new SelectList(desktopUsedTypeRepository.GetAllDesktopUsedTypes().ToList(), "DesktopUsedTypeId", "DesktopUsedTypeDescription"); ViewData["DesktopUsedTypes"] = desktopUsedTypes; PriceTrackingMidOfficePlatformRepository priceTrackingMidOfficePlatformRepository = new PriceTrackingMidOfficePlatformRepository(); SelectList priceTrackingMidOfficePlatforms = new SelectList(priceTrackingMidOfficePlatformRepository.GetAllPriceTrackingMidOfficePlatforms().ToList(), "PriceTrackingMidOfficePlatformId", "PriceTrackingMidOfficePlatformName"); ViewData["PriceTrackingMidOfficePlatforms"] = priceTrackingMidOfficePlatforms; ViewData["SharedPseudoCityOrOfficeList"] = new SelectList(commonRepository.GetTrueFalseList().ToList(), "Value", "Text"); ViewData["MidOfficeUsedForQCTicketingList"] = new SelectList(commonRepository.GetTrueFalseList().ToList(), "Value", "Text", priceTrackingSetupGroup.MidOfficeUsedForQCTicketingFlag); ViewData["USGovernmentContractorList"] = new SelectList(commonRepository.GetTrueFalseList().ToList(), "Value", "Text"); ViewData["PriceTrackingSetupGroupAdditionalPseudoCityOrOfficeIdList"] = new SelectList(commonRepository.GetTrueFalseList().ToList(), "Value", "Text", "false"); PriceTrackingItinerarySolutionRepository priceTrackingItinerarySolutionRepository = new PriceTrackingItinerarySolutionRepository(); SelectList priceTrackingItinerarySolutions = new SelectList(priceTrackingItinerarySolutionRepository.GetAllPriceTrackingItinerarySolutions().ToList(), "PriceTrackingItinerarySolutionId", "PriceTrackingItinerarySolutionName"); ViewData["PriceTrackingItinerarySolutions"] = priceTrackingItinerarySolutions; PriceTrackingSystemRuleRepository priceTrackingSystemRuleRepository = new PriceTrackingSystemRuleRepository(); SelectList priceTrackingSystemRules = new SelectList(priceTrackingSystemRuleRepository.GetAllPriceTrackingSystemRules().ToList(), "PriceTrackingSystemRuleId", "PriceTrackingSystemRuleName"); ViewData["PriceTrackingSystemRules"] = priceTrackingSystemRules; BackOfficeSystemRepository backOfficeSystemRepository = new BackOfficeSystemRepository(); SelectList backOfficeSystems = new SelectList(backOfficeSystemRepository.GetAllBackOfficeSystems().ToList(), "BackOfficeSytemId", "BackOfficeSystemDescription"); ViewData["BackOfficeSystems"] = backOfficeSystems; PriceTrackingBillingModelRepository priceTrackingBillingModelRepository = new PriceTrackingBillingModelRepository(); List <PriceTrackingBillingModel> priceTrackingBillingModels = priceTrackingBillingModelRepository.GetAllPriceTrackingBillingModels().ToList(); SelectList priceTrackingBillingModelsList = new SelectList(priceTrackingBillingModels, "PriceTrackingBillingModelId", "PriceTrackingBillingModelName"); ViewData["AirPriceTrackingBillingModels"] = priceTrackingBillingModelsList; ViewData["HotelPriceTrackingBillingModels"] = priceTrackingBillingModelsList; ViewData["PreTicketPriceTrackingBillingModels"] = priceTrackingBillingModelsList; return(View(priceTrackingSetupGroup)); }