// GET: /Create public ActionResult Create(int id) { Meeting meeting = new Meeting(); meeting = meetingRepository.GetGroup(id); //Check Exists if (meeting == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } MeetingPNROutputVM meetingPNROutputVM = new MeetingPNROutputVM(); MeetingPNROutput meetingPNROutput = new MeetingPNROutput(); meetingPNROutputVM.MeetingPNROutput = meetingPNROutput; meetingRepository.EditGroupForDisplay(meeting); ViewData["ClientTopUnitGuid"] = meeting.ClientTopUnitGuid; ViewData["ClientTopUnitName"] = meeting.ClientTopUnit.ClientTopUnitName; ViewData["MeetingID"] = meeting.MeetingID; ViewData["MeetingName"] = meeting.MeetingName; meetingPNROutputVM.Meeting = meeting; meetingPNROutput.MeetingID = meeting.MeetingID; //GDS GDSRepository GDSRepository = new GDSRepository(); meetingPNROutputVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName"); //PNR Output Remark Types PNROutputRemarkTypeRepository PNROutputRemarkTypeRepository = new PNROutputRemarkTypeRepository(); meetingPNROutputVM.PNROutputRemarkTypeCodes = new SelectList(PNROutputRemarkTypeRepository.GetMeetingPNROutputRemarkTypes(), "PNROutputRemarkTypeCode", "PNROutputRemarkTypeName", ""); //Languages LanguageRepository languageRepository = new LanguageRepository(); meetingPNROutputVM.Languages = new SelectList(languageRepository.GetAllLanguages().ToList(), "LanguageCode", "LanguageName"); //Countries CountryRepository countryRepository = new CountryRepository(); meetingPNROutputVM.Countries = new SelectList(countryRepository.GetAllCountries().ToList(), "CountryCode", "CountryName"); return(View(meetingPNROutputVM)); }
// GET: /Edit public ActionResult Edit(int id) { MeetingPNROutputVM meetingPNROutputVM = new MeetingPNROutputVM(); MeetingPNROutput meetingPNROutput = new MeetingPNROutput(); meetingPNROutput = meetingPNROutputRepository.GetMeetingPNROutput(id); if (meetingPNROutput == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } meetingPNROutputVM.MeetingPNROutput = meetingPNROutput; //Check Exists Meeting for VM Meeting meeting = new Meeting(); meeting = meetingRepository.GetGroup(meetingPNROutput.MeetingID); if (meeting != null) { meetingRepository.EditGroupForDisplay(meeting); meetingPNROutputVM.Meeting = meeting; } meetingRepository.EditGroupForDisplay(meeting); ViewData["ClientTopUnitGuid"] = meeting.ClientTopUnitGuid; ViewData["ClientTopUnitName"] = meeting.ClientTopUnit.ClientTopUnitName; ViewData["MeetingID"] = meeting.MeetingID; ViewData["MeetingName"] = meeting.MeetingName; meetingPNROutputVM.Meeting = meeting; meetingPNROutput.MeetingID = meeting.MeetingID; //GDS GDSRepository GDSRepository = new GDSRepository(); meetingPNROutputVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName", meetingPNROutput.GDSCode); //PNR Output Remark Types PNROutputRemarkTypeRepository PNROutputRemarkTypeRepository = new PNROutputRemarkTypeRepository(); meetingPNROutputVM.PNROutputRemarkTypeCodes = new SelectList(PNROutputRemarkTypeRepository.GetMeetingPNROutputRemarkTypes(), "PNROutputRemarkTypeCode", "PNROutputRemarkTypeName", meetingPNROutput.PNROutputRemarkTypeCode); //Languages LanguageRepository languageRepository = new LanguageRepository(); meetingPNROutputVM.Languages = new SelectList(languageRepository.GetAllLanguages().ToList(), "LanguageCode", "LanguageName", meetingPNROutput.DefaultLanguageCode); //Countries CountryRepository countryRepository = new CountryRepository(); meetingPNROutputVM.Countries = new SelectList(countryRepository.GetAllCountries().ToList(), "CountryCode", "CountryName", meetingPNROutput.CountryCode); return(View(meetingPNROutputVM)); }
// GET: /Edit public ActionResult Edit(int id) { ServicingOptionItem servicingOptionItem = new ServicingOptionItem(); servicingOptionItem = servicingOptionItemRepository.GetItem(id); //Check Exists if (servicingOptionItem == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //AccessRights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToServicingOptionGroup(servicingOptionItem.ServicingOptionGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ServicingOptionRepository servicingOptionRepository = new ServicingOptionRepository(); SelectList servicingOptionsList = new SelectList(servicingOptionRepository.GetAllServicingOptions().ToList(), "ServicingOptionId", "ServicingOptionName"); ViewData["ServicingOptions"] = servicingOptionsList; GDSRepository gdsRepository = new GDSRepository(); SelectList gDSList = new SelectList(gdsRepository.GetAllGDSsExceptALL().ToList(), "GDSCode", "GDSName"); ViewData["GDSs"] = gDSList; ViewData["DepartureTimeWindowMinutesList"] = new SelectList( servicingOptionRepository.GetServicingOptionDepartureTimeWindows().Select( x => new { value = x, text = x } ), "value", "text", servicingOptionItem.DepartureTimeWindowMinutes); ViewData["ArrivalTimeWindowMinutesList"] = new SelectList( servicingOptionRepository.GetServicingOptionArrivalTimeWindows().Select( x => new { value = x, text = x } ), "value", "text", servicingOptionItem.ArrivalTimeWindowMinutes); ViewData["MaximumStopsList"] = new SelectList( servicingOptionRepository.GetServicingOptionMaximumStops().Select( x => new { value = x, text = x } ), "value", "text", servicingOptionItem.MaximumStops); servicingOptionItemRepository.EditItemForDisplay(servicingOptionItem); return(View(servicingOptionItem)); }
// GET: Create public ActionResult Create(string id) { //Set Access Rights ViewData["Access"] = ""; RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToClientSubUnit(id) && hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Access"] = "WriteAccess"; } ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id); //Check clientSubUnit if (clientSubUnit == null) { ViewData["ActionMethod"] = "List"; return(View("RecordDoesNotExistError")); } clientSubUnitRepository.EditGroupForDisplay(clientSubUnit); ViewData["ClientSubUnitName"] = clientSubUnit.ClientSubUnitDisplayName; ViewData["ClientSubUnitGuid"] = clientSubUnit.ClientSubUnitGuid; ViewData["ClientTopUnitName"] = clientSubUnit.ClientTopUnitName; ViewData["ClientTopUnitGuid"] = clientSubUnit.ClientTopUnitGuid; PNRNameStatementInformationVM PNRNameStatementInformationVM = new PNRNameStatementInformationVM(); PNRNameStatementInformation PNRNameStatementInformation = new PNRNameStatementInformation(); PNRNameStatementInformation.ClientSubUnit = clientSubUnit; PNRNameStatementInformationVM.PNRNameStatementInformation = PNRNameStatementInformation; PNRNameStatementInformationVM.ClientSubUnit = clientSubUnit; //GDS GDSRepository GDSRepository = new GDSRepository(); PNRNameStatementInformationVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName"); //Delimiters PNRNameStatementInformationVM.Delimiters = new SelectList(PNRNameStatementInformationRepository.GetPNRNameStatementInformationDelimiters().ToList(), "Value", "Text"); //Statement Info PNRNameStatementInformationVM.StatementInformationItems = new SelectList(PNRNameStatementInformationRepository.GetPNRNameStatementInformationStatementInformation(id).ToList(), "Value", "Text"); return(View(PNRNameStatementInformationVM)); }
// GET: /Create public ActionResult Create(int id) { //Check Exists ServicingOptionGroup servicingOptionGroup = new ServicingOptionGroup(); servicingOptionGroup = servicingOptionGroupRepository.GetGroup(id); if (servicingOptionGroup == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToServicingOptionGroup(id)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ServicingOptionRepository servicingOptionRepository = new ServicingOptionRepository(); SelectList servicingOptionsList = new SelectList(servicingOptionRepository.GetAvailableServicingOptions(id).ToList(), "ServicingOptionId", "ServicingOptionName"); ViewData["ServicingOptions"] = servicingOptionsList; GDSRepository gdsRepository = new GDSRepository(); SelectList gDSList = new SelectList(gdsRepository.GetAllGDSsExceptALL().ToList(), "GDSCode", "GDSName"); ViewData["GDSs"] = gDSList; ViewData["DepartureTimeWindowMinutesList"] = new SelectList(servicingOptionRepository.GetServicingOptionDepartureTimeWindows().Select(x => new { value = x, text = x }), "value", "text"); ViewData["ArrivalTimeWindowMinutesList"] = new SelectList(servicingOptionRepository.GetServicingOptionArrivalTimeWindows().Select(x => new { value = x, text = x }), "value", "text"); ViewData["MaximumStopsList"] = new SelectList(servicingOptionRepository.GetServicingOptionMaximumStops().Select(x => new { value = x, text = x }), "value", "text"); ServicingOptionItem servicingOptionItem = new ServicingOptionItem(); servicingOptionItem.ServicingOptionGroupName = servicingOptionGroup.ServicingOptionGroupName; servicingOptionItem.ServicingOptionGroupId = servicingOptionGroup.ServicingOptionGroupId; return(View(servicingOptionItem)); }
// 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)); }
// 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, string csu, string can, string ssc) { ClientDefinedReferenceItemPNROutputVM clientDefinedReferenceItemPNROutputVM = new ClientDefinedReferenceItemPNROutputVM(); ClientDefinedReferenceItemPNROutput clientDefinedReferenceItemPNROutput = new ClientDefinedReferenceItemPNROutput(); clientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutputRepository.GetClientDefinedReferenceItemPNROutput(id); if (clientDefinedReferenceItemPNROutput == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } clientDefinedReferenceItemPNROutputVM.ClientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutput; //Check Exists ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem(); clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemId); if (clientDefinedReferenceItem == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } ViewData["DsplayName"] = !string.IsNullOrEmpty(clientDefinedReferenceItem.DisplayNameAlias) ? clientDefinedReferenceItem.DisplayNameAlias : clientDefinedReferenceItem.DisplayName; //Check Exists CSU for VM ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); if (clientSubUnit != null) { clientSubUnitRepository.EditGroupForDisplay(clientSubUnit); clientDefinedReferenceItemPNROutputVM.ClientSubUnit = clientSubUnit; } // Check Exists CDR CSU (can be null) ClientSubUnit clientSubUnitCDR = new ClientSubUnit(); if (clientDefinedReferenceItem.ClientSubUnitGuid != null) { clientSubUnitCDR = clientSubUnitRepository.GetClientSubUnit(clientDefinedReferenceItem.ClientSubUnitGuid); if (clientSubUnit != null) { clientSubUnitRepository.EditGroupForDisplay(clientSubUnitCDR); clientDefinedReferenceItem.ClientSubUnitGuid = clientSubUnitCDR.ClientSubUnitGuid; } } if (can != null && ssc != null) { ClientSubUnitClientAccount clientSubUnitClientAccount = new ClientSubUnitClientAccount(); clientSubUnitClientAccount = clientSubUnitClientAccountRepository.GetClientSubUnitClientAccount(can, ssc, csu); if (clientSubUnitClientAccount != null) { ViewData["ClientSubUnitClientAccountClientAccountName"] = clientSubUnitClientAccount.ClientAccount.ClientAccountName; } clientDefinedReferenceItem.ClientAccountNumber = clientDefinedReferenceItem.ClientAccountNumber; clientDefinedReferenceItem.SourceSystemCode = clientDefinedReferenceItem.SourceSystemCode; } if (can != null && ssc != null) { ClientAccount clientAccount = new ClientAccount(); ClientAccountRepository clientAccountRepository = new ClientAccountRepository(); clientAccount = clientAccountRepository.GetClientAccount(can, ssc); if (clientAccount != null) { ViewData["ClientAccountName"] = clientAccount.ClientAccountName; } clientDefinedReferenceItem.ClientAccountNumber = can; clientDefinedReferenceItem.SourceSystemCode = ssc; ViewData["ClientDefinedReferenceItemId"] = clientDefinedReferenceItem.ClientDefinedReferenceItemId; ViewData["ClientAccountNumber"] = can; ViewData["SourceSystemCode"] = ssc; } //ClientDefinedReferenceItem clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItem = clientDefinedReferenceItem; clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemId = clientDefinedReferenceItem.ClientDefinedReferenceItemId; //GDS GDSRepository GDSRepository = new GDSRepository(); clientDefinedReferenceItemPNROutputVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName"); //PNR Output Remark Types PNROutputRemarkTypeRepository PNROutputRemarkTypeRepository = new PNROutputRemarkTypeRepository(); clientDefinedReferenceItemPNROutputVM.PNROutputRemarkTypeCodes = new SelectList(PNROutputRemarkTypeRepository.GetPNROutputRemarkTypes(), "PNROutputRemarkTypeCode", "PNROutputRemarkTypeName"); //Languages LanguageRepository languageRepository = new LanguageRepository(); clientDefinedReferenceItemPNROutputVM.Languages = new SelectList(languageRepository.GetAllLanguages().ToList(), "LanguageCode", "LanguageName"); return(View(clientDefinedReferenceItemPNROutputVM)); }
// GET: /Create public ActionResult Create(string id, string csu, string can, string ssc) { ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); //Check Exists if (clientSubUnit == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientDefinedReferenceItemPNROutputVM clientDefinedReferenceItemPNROutputVM = new ClientDefinedReferenceItemPNROutputVM(); ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem(); clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(id); ClientDefinedReferenceItemPNROutput clientDefinedReferenceItemPNROutput = new ClientDefinedReferenceItemPNROutput(); //ClientDefinedReferenceItem if (clientDefinedReferenceItem == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } clientDefinedReferenceItem.ClientSubUnitGuid = clientSubUnit.ClientSubUnitGuid; clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItem = clientDefinedReferenceItem; clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemId = clientDefinedReferenceItem.ClientDefinedReferenceItemId; clientDefinedReferenceItemPNROutputVM.ClientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutput; ViewData["DsplayName"] = !string.IsNullOrEmpty(clientDefinedReferenceItem.DisplayNameAlias) ? clientDefinedReferenceItem.DisplayNameAlias : clientDefinedReferenceItem.DisplayName; if (can != null && ssc != null) { ClientSubUnitClientAccount clientSubUnitClientAccount = new ClientSubUnitClientAccount(); clientSubUnitClientAccount = clientSubUnitClientAccountRepository.GetClientSubUnitClientAccount(can, ssc, clientSubUnit.ClientSubUnitGuid); if (clientSubUnitClientAccount != null) { ViewData["ClientSubUnitClientAccountClientAccountName"] = clientSubUnitClientAccount.ClientAccount.ClientAccountName; } clientDefinedReferenceItem.ClientAccountNumber = can; clientDefinedReferenceItem.SourceSystemCode = ssc; ViewData["ClientDefinedReferenceItemId"] = clientDefinedReferenceItem.ClientDefinedReferenceItemId; ViewData["ClientAccountNumber"] = can; ViewData["SourceSystemCode"] = ssc; } //ClientSubUnit clientDefinedReferenceItemPNROutputVM.ClientSubUnit = clientSubUnit; //GDS GDSRepository GDSRepository = new GDSRepository(); clientDefinedReferenceItemPNROutputVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName"); //PNR Output Remark Types PNROutputRemarkTypeRepository PNROutputRemarkTypeRepository = new PNROutputRemarkTypeRepository(); clientDefinedReferenceItemPNROutputVM.PNROutputRemarkTypeCodes = new SelectList(PNROutputRemarkTypeRepository.GetPNROutputRemarkTypes(), "PNROutputRemarkTypeCode", "PNROutputRemarkTypeName", ""); //Languages LanguageRepository languageRepository = new LanguageRepository(); clientDefinedReferenceItemPNROutputVM.Languages = new SelectList(languageRepository.GetAllLanguages().ToList(), "LanguageCode", "LanguageName"); return(View(clientDefinedReferenceItemPNROutputVM)); }
// GET: Edit public ActionResult Edit(string id, string csu) { //Set Access Rights ViewData["Access"] = ""; RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToClientSubUnit(csu) && hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Access"] = "WriteAccess"; } PNRNameStatementInformationVM PNRNameStatementInformationVM = new PNRNameStatementInformationVM(); ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); //Check clientSubUnit if (clientSubUnit == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } clientSubUnitRepository.EditGroupForDisplay(clientSubUnit); PNRNameStatementInformationVM.ClientSubUnit = clientSubUnit; ViewData["ClientSubUnitName"] = clientSubUnit.ClientSubUnitDisplayName; ViewData["ClientSubUnitGuid"] = clientSubUnit.ClientSubUnitGuid; ViewData["ClientTopUnitName"] = clientSubUnit.ClientTopUnitName; ViewData["ClientTopUnitGuid"] = clientSubUnit.ClientTopUnitGuid; PNRNameStatementInformation PNRNameStatementInformation = new PNRNameStatementInformation(); PNRNameStatementInformation = PNRNameStatementInformationRepository.GetPNRNameStatementInformation(id); //Check PNRNameStatementInformation if (PNRNameStatementInformation == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } PNRNameStatementInformation.ClientSubUnit = clientSubUnit; PNRNameStatementInformationVM.PNRNameStatementInformation = PNRNameStatementInformation; //GDS GDSRepository GDSRepository = new GDSRepository(); PNRNameStatementInformationVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName", PNRNameStatementInformation.GDSCode); //Delimiters var delimiters = PNRNameStatementInformationRepository.GetPNRNameStatementInformationDelimiters().ToList(); PNRNameStatementInformationVM.Delimiter1 = new SelectList(delimiters, "Value", "Text", PNRNameStatementInformation.Delimiter1); PNRNameStatementInformationVM.Delimiter2 = new SelectList(delimiters, "Value", "Text", PNRNameStatementInformation.Delimiter2); PNRNameStatementInformationVM.Delimiter3 = new SelectList(delimiters, "Value", "Text", PNRNameStatementInformation.Delimiter3); PNRNameStatementInformationVM.Delimiter4 = new SelectList(delimiters, "Value", "Text", PNRNameStatementInformation.Delimiter4); PNRNameStatementInformationVM.Delimiter5 = new SelectList(delimiters, "Value", "Text", PNRNameStatementInformation.Delimiter5); PNRNameStatementInformationVM.Delimiter6 = new SelectList(delimiters, "Value", "Text", PNRNameStatementInformation.Delimiter6); //Statement Info var PNRNameStatementInformationStatementInformation = PNRNameStatementInformationRepository.GetPNRNameStatementInformationStatementInformation(csu).ToList(); PNRNameStatementInformationVM.StatementInformationItem1 = new SelectList(PNRNameStatementInformationStatementInformation, "Value", "Text", PNRNameStatementInformation.Field1_ReferToRecordIdentifier); PNRNameStatementInformationVM.StatementInformationItem2 = new SelectList(PNRNameStatementInformationStatementInformation, "Value", "Text", PNRNameStatementInformation.Field2_ReferToRecordIdentifier); PNRNameStatementInformationVM.StatementInformationItem3 = new SelectList(PNRNameStatementInformationStatementInformation, "Value", "Text", PNRNameStatementInformation.Field3_ReferToRecordIdentifier); PNRNameStatementInformationVM.StatementInformationItem4 = new SelectList(PNRNameStatementInformationStatementInformation, "Value", "Text", PNRNameStatementInformation.Field4_ReferToRecordIdentifier); PNRNameStatementInformationVM.StatementInformationItem5 = new SelectList(PNRNameStatementInformationStatementInformation, "Value", "Text", PNRNameStatementInformation.Field5_ReferToRecordIdentifier); return(View(PNRNameStatementInformationVM)); }
// GET: /Edit public ActionResult Edit(int id, string csu, string can, string ssc) { ClientDefinedReferenceItemPNROutputVM clientDefinedReferenceItemPNROutputVM = new ClientDefinedReferenceItemPNROutputVM(); ClientDefinedReferenceItemPNROutput clientDefinedReferenceItemPNROutput = new ClientDefinedReferenceItemPNROutput(); clientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutputRepository.GetClientDefinedReferenceItemPNROutput(id); if (clientDefinedReferenceItemPNROutput == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } clientDefinedReferenceItemPNROutputVM.ClientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutput; //Check Exists ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem(); clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemId); if (clientDefinedReferenceItem == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } //Check Exists CSU for VM ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); if (clientSubUnit != null) { clientSubUnitRepository.EditGroupForDisplay(clientSubUnit); clientDefinedReferenceItemPNROutputVM.ClientSubUnit = clientSubUnit; } clientSubUnitRepository.EditGroupForDisplay(clientSubUnit); ViewData["ClientTopUnitGuid"] = clientSubUnit.ClientTopUnitGuid; ViewData["ClientTopUnitName"] = clientSubUnit.ClientTopUnitName; ViewData["ClientSubUnitGuid"] = clientSubUnit.ClientSubUnitGuid; ViewData["ClientSubUnitName"] = clientSubUnit.ClientSubUnitName; ViewData["ClientDefinedReferenceItemId"] = clientDefinedReferenceItem.ClientDefinedReferenceItemId; ViewData["DisplayNameAlias"] = clientDefinedReferenceItem.DisplayNameAlias != null ? clientDefinedReferenceItem.DisplayNameAlias : clientDefinedReferenceItem.DisplayName; clientDefinedReferenceItemPNROutputVM.ClientSubUnit = clientSubUnit; clientDefinedReferenceItem.ClientSubUnitGuid = clientSubUnit.ClientSubUnitGuid; //GDS GDSRepository GDSRepository = new GDSRepository(); clientDefinedReferenceItemPNROutputVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName"); //PNR Output Remark Types PNROutputRemarkTypeRepository PNROutputRemarkTypeRepository = new PNROutputRemarkTypeRepository(); clientDefinedReferenceItemPNROutputVM.PNROutputRemarkTypeCodes = new SelectList(PNROutputRemarkTypeRepository.GetPNROutputRemarkTypes(), "PNROutputRemarkTypeCode", "PNROutputRemarkTypeName"); //Languages LanguageRepository languageRepository = new LanguageRepository(); clientDefinedReferenceItemPNROutputVM.Languages = new SelectList(languageRepository.GetAllLanguages().ToList(), "LanguageCode", "LanguageName"); return(View(clientDefinedReferenceItemPNROutputVM)); }