//Add Data From Linked Tables for Display public void EditGroupForDisplay(MeetingPNROutput group) { if (group.GDSCode != "") { GDSRepository GDSRepository = new GDSRepository(); GDS GDS = GDSRepository.GetGDS(group.GDSCode); if (GDS != null) { group.GDS = GDS; } } if (group.CountryCode != "") { CountryRepository countryRepository = new CountryRepository(); Country country = countryRepository.GetCountry(group.CountryCode); if (country != null) { group.Country = country; } } if (group.DefaultLanguageCode != "") { LanguageRepository languageRepository = new LanguageRepository(); Language language = languageRepository.GetLanguage(group.DefaultLanguageCode); if (language != null) { group.Language = language; } } }
//Add Data From Linked Tables for Display public void EditItemForDisplay(TicketQueueItem ticketQueueItem) { TicketTypeRepository ticketTypeRepository = new TicketTypeRepository(); TicketType ticketType = new TicketType(); ticketType = ticketTypeRepository.GetTicketType(ticketQueueItem.TicketTypeId); if (ticketType != null) { ticketQueueItem.TicketTypeDescription = ticketType.TicketTypeDescription; } TicketQueueGroupRepository ticketQueueGroupRepository = new TicketQueueGroupRepository(); TicketQueueGroup ticketQueueGroup = new TicketQueueGroup(); ticketQueueGroup = ticketQueueGroupRepository.GetGroup(ticketQueueItem.TicketQueueGroupId); if (ticketQueueGroup != null) { ticketQueueItem.TicketQueueGroupName = ticketQueueGroup.TicketQueueGroupName; } GDSRepository gdsRepository = new GDSRepository(); GDS gds = new GDS(); gds = gdsRepository.GetGDS(ticketQueueItem.GDSCode); if (gds != null) { ticketQueueItem.GDSName = gds.GDSName; } }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(GDSAdditionalEntry group) { TripTypeRepository tripTypeRepository = new TripTypeRepository(); TripType tripType = new TripType(); tripType = tripTypeRepository.GetTripType(group.TripTypeId); if (tripType != null) { group.TripType = tripType.TripTypeDescription; } GDSRepository gDSRepository = new GDSRepository(); GDS gds = new GDS(); gds = gDSRepository.GetGDS(group.GDSCode); if (gds != null) { group.GDSName = gds.GDSName; } SubProductRepository subProductRepository = new SubProductRepository(); SubProduct subProduct = new SubProduct(); subProduct = subProductRepository.GetSubProduct(group.SubProductId); if (subProduct != null) { group.SubProductName = subProduct.SubProductName; Product product = new Product(); product = subProductRepository.GetSubProductProduct(group.SubProductId); group.ProductId = product.ProductId; group.ProductName = product.ProductName; } HierarchyRepository hierarchyRepository = new HierarchyRepository(); fnDesktopDataAdmin_SelectGDSAdditionalEntryHierarchy_v1Result hierarchy = new fnDesktopDataAdmin_SelectGDSAdditionalEntryHierarchy_v1Result(); hierarchy = GetGroupHierarchy(group.GDSAdditionalEntryId); group.GDSAdditionalEntryValue = Regex.Replace(group.GDSAdditionalEntryValue, @"[^\w\-()*]", "-"); if (hierarchy != null) { group.HierarchyType = hierarchy.HierarchyType; group.HierarchyCode = hierarchy.HierarchyCode.ToString(); group.HierarchyItem = hierarchy.HierarchyName.Trim(); if (hierarchy.HierarchyType == "ClientSubUnitTravelerType") { group.ClientSubUnitGuid = hierarchy.HierarchyCode.ToString(); group.ClientSubUnitName = hierarchy.HierarchyName.Trim(); group.TravelerTypeGuid = hierarchy.TravelerTypeGuid; group.TravelerTypeName = hierarchy.TravelerTypeName.Trim(); } } }
//Add Data From Linked Tables for Display public void EditItemForDisplay(ServicingOptionItem servicingOptionItem) { ServicingOptionRepository servicingOptionRepository = new ServicingOptionRepository(); ServicingOption servicingOption = new ServicingOption(); servicingOption = servicingOptionRepository.GetServicingOption(servicingOptionItem.ServicingOptionId); if (servicingOption != null) { servicingOptionItem.ServicingOptionName = servicingOption.ServicingOptionName; servicingOptionItem.GDSRequiredFlag = servicingOption.GDSRequiredFlag; } ServicingOptionGroupRepository servicingOptionGroupRepository = new ServicingOptionGroupRepository(); ServicingOptionGroup servicingOptionGroup = new ServicingOptionGroup(); servicingOptionGroup = servicingOptionGroupRepository.GetGroup(servicingOptionItem.ServicingOptionGroupId); if (servicingOptionGroup != null) { servicingOptionItem.ServicingOptionGroupName = servicingOptionGroup.ServicingOptionGroupName; } if(servicingOptionItem.GDSCode!=null){ GDSRepository gDSRepository = new GDSRepository(); GDS gds = new GDS(); gds = gDSRepository.GetGDS(servicingOptionItem.GDSCode); if (gds != null) { servicingOptionItem.GDSName = gds.GDSName; } } //Get ServicingOptionFareCalculations ServicingOptionFareCalculation servicingOptionFareCalculation = new ServicingOptionFareCalculation(); servicingOptionFareCalculation = db.ServicingOptionFareCalculations.SingleOrDefault(c => c.ServicingOptionItemId == servicingOptionItem.ServicingOptionItemId); if (servicingOptionFareCalculation != null) { servicingOptionItem.DepartureTimeWindowMinutes = servicingOptionFareCalculation.DepartureTimeWindowMinutes; servicingOptionItem.ArrivalTimeWindowMinutes = servicingOptionFareCalculation.ArrivalTimeWindowMinutes; servicingOptionItem.MaximumConnectionTimeMinutes = servicingOptionFareCalculation.MaximumConnectionTimeMinutes; servicingOptionItem.MaximumStops = servicingOptionFareCalculation.MaximumStops; servicingOptionItem.UseAlternateAirportFlag = servicingOptionFareCalculation.UseAlternateAirportFlag; servicingOptionItem.NoPenaltyFlag = servicingOptionFareCalculation.NoPenaltyFlag; servicingOptionItem.NoRestrictionsFlag = servicingOptionFareCalculation.NoRestrictionsFlag; } }
//Add Data From Linked Tables for Display public void EditForDisplay(SystemUserGDS systemUserGDS) { SystemUserRepository systemUserRepository = new SystemUserRepository(); SystemUser systemUser = new SystemUser(); systemUser = systemUserRepository.GetUserBySystemUserGuid(systemUserGDS.SystemUserGuid); if (systemUser != null) { systemUserGDS.SystemUserName = (systemUser.LastName + ", " + systemUser.FirstName + " " + systemUser.MiddleName).Replace(" ", " "); } GDSRepository gdsRepository = new GDSRepository(); GDS gds = new GDS(); gds = gdsRepository.GetGDS(systemUserGDS.GDSCode); if (gds != null) { systemUserGDS.GDSName = gds.GDSName; } }
//Add Data From Linked Tables for Display public void EditItemForDisplay(PolicySupplierDealCode policySupplierDealCode) { //PolicySupplierDealCodeType PolicySupplierDealCodeTypeRepository policySupplierDealCodeTypeRepository = new PolicySupplierDealCodeTypeRepository(); PolicySupplierDealCodeType policySupplierDealCodeType = new PolicySupplierDealCodeType(); policySupplierDealCodeType = policySupplierDealCodeTypeRepository.GetPolicySupplierDealCodeType(policySupplierDealCode.PolicySupplierDealCodeTypeId); if (policySupplierDealCodeType != null) { policySupplierDealCode.PolicySupplierDealCodeTypeDescription = policySupplierDealCodeType.PolicySupplierDealCodeTypeDescription; } //GDS GDSRepository gdsRepository = new GDSRepository(); GDS gds = new GDS(); gds = gdsRepository.GetGDS(policySupplierDealCode.GDSCode); if (gds != null) { policySupplierDealCode.GDSName = gds.GDSName; } //PolicyLocation PolicyLocationRepository policyLocationRepository = new PolicyLocationRepository(); PolicyLocation policyLocation = new PolicyLocation(); policyLocation = policyLocationRepository.GetPolicyLocation((int)policySupplierDealCode.PolicyLocationId); if (policyLocation != null) { policySupplierDealCode.PolicyLocationName = policyLocation.PolicyLocationName; } //Supplier SupplierRepository supplierRepository = new SupplierRepository(); Supplier supplier = new Supplier(); supplier = supplierRepository.GetSupplier(policySupplierDealCode.SupplierCode, policySupplierDealCode.ProductId); if (supplier != null) { policySupplierDealCode.SupplierName = supplier.SupplierName; } //EnabledFlag is nullable if (policySupplierDealCode.EnabledFlag != true) { policySupplierDealCode.EnabledFlag = false; } policySupplierDealCode.EnabledFlagNonNullable = (bool)policySupplierDealCode.EnabledFlag; //OSIFlag is nullable if (policySupplierDealCode.OSIFlag != true) { policySupplierDealCode.OSIFlag = false; } policySupplierDealCode.OSIFlagNonNullable = (bool)policySupplierDealCode.OSIFlag; //Product ProductRepository productRepository = new ProductRepository(); Product product = new Product(); product = productRepository.GetProduct(policySupplierDealCode.ProductId); if (product != null) { policySupplierDealCode.ProductName = product.ProductName; } //PolicyGroup PolicyGroupRepository policyGroupRepository = new PolicyGroupRepository(); PolicyGroup policyGroup = policyGroupRepository.GetGroup(policySupplierDealCode.PolicyGroupId); policySupplierDealCode.PolicyGroupName = policyGroup.PolicyGroupName; //Tour Code Type TourCodeTypeRepository tourCodeTypeRepository = new TourCodeTypeRepository(); TourCodeType tourCodeType = tourCodeTypeRepository.GetTourCodeType(policySupplierDealCode.TourCodeTypeId ?? 0); if (tourCodeType != null) { policySupplierDealCode.TourCodeType = tourCodeType; } }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(PNROutputGroup group) { // TripTypeRepository tripTypeRepository = new TripTypeRepository(); //TripType tripType = new TripType(); //tripType = tripTypeRepository.GetTripType(group.TripTypeId); //if (tripType != null) // { // group.TripType = tripType.TripTypeDescription; // } GDSRepository gDSRepository = new GDSRepository(); GDS gds = new GDS(); gds = gDSRepository.GetGDS(group.GDSCode); if (gds != null) { group.GDSName = gds.GDSName; } PNROutputTypeRepository pNROutputTypeRepository = new PNROutputTypeRepository(); PNROutputType pNROutputType = new PNROutputType(); pNROutputType = pNROutputTypeRepository.GetPNROutputType(group.PNROutputTypeID); if (pNROutputType != null) { group.PNROutputTypeName = pNROutputType.PNROutputTypeName; } group.PNROutputGroupName = Regex.Replace(group.PNROutputGroupName, @"[^\w\-()*]", "-"); HierarchyRepository hierarchyRepository = new HierarchyRepository(); List <fnDesktopDataAdmin_SelectPNROutputGroupHierarchy_v1Result> hierarchy = GetGroupHierarchy(group.PNROutputGroupId); if (hierarchy.Count > 0) { if (hierarchy.Count == 1) { HierarchyGroup hierarchyGroup = hierarchyRepository.GetHierarchyGroup( hierarchy[0].HierarchyType ?? "", hierarchy[0].HierarchyCode ?? "", hierarchy[0].HierarchyName ?? "", hierarchy[0].TravelerTypeGuid ?? "", hierarchy[0].TravelerTypeName ?? "", hierarchy[0].SourceSystemCode ?? "" ); if (hierarchyGroup != null) { group.HierarchyType = hierarchyGroup.HierarchyType; group.HierarchyCode = hierarchyGroup.HierarchyCode; group.HierarchyItem = hierarchyGroup.HierarchyItem; group.ClientSubUnitGuid = hierarchyGroup.ClientSubUnitGuid; group.ClientSubUnitName = hierarchyGroup.ClientSubUnitName; group.TravelerTypeGuid = hierarchyGroup.TravelerTypeGuid; group.TravelerTypeName = hierarchyGroup.TravelerTypeName; group.ClientTopUnitName = hierarchyGroup.ClientTopUnitName; group.SourceSystemCode = hierarchyGroup.SourceSystemCode; } } else { List <MultipleHierarchyDefinition> multipleHierarchies = new List <MultipleHierarchyDefinition>(); foreach (fnDesktopDataAdmin_SelectPNROutputGroupHierarchy_v1Result item in hierarchy) { multipleHierarchies.Add(new MultipleHierarchyDefinition() { HierarchyType = item.HierarchyType, HierarchyItem = item.HierarchyName, HierarchyCode = item.HierarchyCode, TravelerTypeGuid = item.TravelerTypeGuid, SourceSystemCode = item.SourceSystemCode }); } group.MultipleHierarchies = hierarchyRepository.GetMultipleHierarchies(multipleHierarchies); } } if (hierarchy.Count > 1) { group.IsMultipleHierarchy = true; group.HierarchyType = "Multiple"; group.HierarchyItem = "Multiple"; group.HierarchyCode = "Multiple"; } else { group.IsMultipleHierarchy = false; } }
private void ValidateLines(ref XmlDocument doc, string[] lines, ref List <string> returnMessages) { XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", null, null); doc.AppendChild(dec); XmlElement root = doc.CreateElement("BookingChannels"); doc.AppendChild(root); string returnMessage; int i = 0; //loop through CSV lines foreach (string line in lines) { i++; if (i > 1) //ignore first line with titles { Regex csvParser = new Regex(",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))"); String[] cells = csvParser.Split(line); //extract the data items from the file string gdsCode = CWTStringHelpers.NullToEmpty(CWTStringHelpers.UnescapeQuotes(cells[0])); //Required string bookingChannelTypeDescription = CWTStringHelpers.NullToEmpty(CWTStringHelpers.UnescapeQuotes(cells[1])); //Required string productChannelTypeDescription = CWTStringHelpers.NullToEmpty(CWTStringHelpers.UnescapeQuotes(cells[2])); //Required string bookingPseudoCityOrOfficeId = CWTStringHelpers.NullToEmpty(CWTStringHelpers.UnescapeQuotes(cells[3])); string ticketingPseudoCityOrOfficeId = CWTStringHelpers.NullToEmpty(CWTStringHelpers.UnescapeQuotes(cells[4])); string desktopUsedTypeDescription = CWTStringHelpers.NullToEmpty(CWTStringHelpers.UnescapeQuotes(cells[5])); //Required when Booking Channel = Offline string additionalBookingCommentDescription = CWTStringHelpers.NullToEmpty(CWTStringHelpers.UnescapeQuotes(cells[6])); string languageCode = CWTStringHelpers.NullToEmpty(CWTStringHelpers.UnescapeQuotes(cells[7])); //Build the XML Element for items XmlElement xmlBookingChannelItem = doc.CreateElement("BookingChannelItem"); //Validate data /* GDS Code */ //Required if (string.IsNullOrEmpty(gdsCode) == true) { returnMessage = "Row " + i + ": GDSCode is missing. Please provide a GDS Code"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } else { //GDSCode must contain any one value from the GDSCode column of the GDS table GDSRepository gdsRepository = new GDSRepository(); GDS gds = gdsRepository.GetGDS(gdsCode); if (gds == null) { returnMessage = "Row " + i + ": GDSCode " + gdsCode + " is invalid. Please provide a valid GDS Code"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } } XmlElement xmlGDSCode = doc.CreateElement("GDSCode"); xmlGDSCode.InnerText = gdsCode; xmlBookingChannelItem.AppendChild(xmlGDSCode); /* Booking Channel Type */ string bookingChannelTypeId = string.Empty; BookingChannelTypeRepository bookingChannelTypeRepository = new BookingChannelTypeRepository(); BookingChannelType bookingChannelType = new BookingChannelType(); //Required if (string.IsNullOrEmpty(bookingChannelTypeDescription) == true) { returnMessage = "Row " + i + ": Booking Channel is missing. Please provide a Booking Channel"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } else { //BookingChannelTypeDescription must contain any one value from the BookingChannelTypeDescription column of the BookingChannelType table bookingChannelType = bookingChannelTypeRepository.GetBookingChannelTypeByDescription(bookingChannelTypeDescription); if (bookingChannelType == null) { returnMessage = "Row " + i + ": BookingChannelTypeDescription " + bookingChannelTypeDescription + " is invalid. Please provide a valid BookingChannelType Code"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } else { bookingChannelTypeId = bookingChannelType.BookingChannelTypeId.ToString(); } } XmlElement xmlBookingChannelTypeId = doc.CreateElement("BookingChannelTypeId"); xmlBookingChannelTypeId.InnerText = bookingChannelTypeId; xmlBookingChannelItem.AppendChild(xmlBookingChannelTypeId); /* Product Channel Type */ string productChannelTypeId = string.Empty; ProductChannelTypeRepository productChannelTypeRepository = new ProductChannelTypeRepository(); ProductChannelType productChannelType = new ProductChannelType(); //Required if (string.IsNullOrEmpty(productChannelTypeDescription) == true) { returnMessage = "Row " + i + ": Product Channel is missing. Please provide a Product Channel"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } else { //ProductChannelTypeDescription must contain any one value from the ProductChannelTypeDescription column of the ProductChannelType table productChannelType = productChannelTypeRepository.GetProductChannelTypeByDescription(productChannelTypeDescription); if (productChannelType == null) { returnMessage = "Row " + i + ": ProductChannelTypeDescription " + productChannelTypeDescription + " is invalid. Please provide a valid ProductChannelType Code"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } else { productChannelTypeId = productChannelType.ProductChannelTypeId.ToString(); } } XmlElement xmlProductChannelTypeId = doc.CreateElement("ProductChannelTypeId"); xmlProductChannelTypeId.InnerText = productChannelTypeId; xmlBookingChannelItem.AppendChild(xmlProductChannelTypeId); //ProductChannelTypeId and BookingChannelTypeID must be present in the ProductChannelType table if (bookingChannelType != null && bookingChannelType.BookingChannelTypeId > 0 && productChannelType != null && productChannelType.ProductChannelTypeId > 0) { ProductChannelType productChannelBookingChannelType = productChannelTypeRepository.GetProductChannelTypeBookingChannelType(bookingChannelType.BookingChannelTypeId, productChannelType.ProductChannelTypeId); if (productChannelBookingChannelType == null) { returnMessage = "Row " + i + ": Product Channel and Booking Channel combination is invalid. Please provide a valid combination"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } } /* DesktopUsedTypeDescription */ string desktopUsedTypeId = string.Empty; //Required if BookingChannelTypeDescription is Offline if (string.IsNullOrEmpty(desktopUsedTypeDescription) == true && bookingChannelTypeDescription.ToLower() == "offline") { returnMessage = "Row " + i + ": Desktop Used is required when Booking Channel is Offline. Please provide a valid Desktop Used or change Booking Channel"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } else if (!string.IsNullOrEmpty(desktopUsedTypeDescription)) { //DesktopUsed must contain any one value from the DesktopUsedTypeDescription column of the DesktopUsedType table DesktopUsedTypeRepository desktopUsedTypeRepository = new DesktopUsedTypeRepository(); DesktopUsedType desktopUsedType = desktopUsedTypeRepository.GetDesktopUsedTypeByDescription(desktopUsedTypeDescription); if (desktopUsedType == null) { returnMessage = "Row " + i + ": Desktop Used " + desktopUsedTypeDescription + " is invalid. Please provide a valid Desktop Used"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } else { desktopUsedTypeId = desktopUsedType.DesktopUsedTypeId.ToString(); } } XmlElement xmlDesktopUsedTypeId = doc.CreateElement("DesktopUsedTypeId"); xmlDesktopUsedTypeId.InnerText = desktopUsedTypeId; xmlBookingChannelItem.AppendChild(xmlDesktopUsedTypeId); /* BookingPseudoCityOrOfficeId */ int validBookingPseudoCityOrOfficeIdCount = db.ValidPseudoCityOrOfficeIds.Where(x => x.PseudoCityOrOfficeId == bookingPseudoCityOrOfficeId).Count(); if (!string.IsNullOrEmpty(bookingPseudoCityOrOfficeId) && validBookingPseudoCityOrOfficeIdCount == 0) { returnMessage = "Row " + i + ": BookingPseudoCityOrOfficeId " + bookingPseudoCityOrOfficeId + " is invalid. Please provide a valid BookingPseudoCityOrOfficeId"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } /* Trim if is not null */ if (!string.IsNullOrEmpty(bookingPseudoCityOrOfficeId)) { bookingPseudoCityOrOfficeId = bookingPseudoCityOrOfficeId.Trim(); } XmlElement xmlBookingPseudoCityOrOfficeId = doc.CreateElement("BookingPseudoCityOrOfficeId"); xmlBookingPseudoCityOrOfficeId.InnerText = bookingPseudoCityOrOfficeId; xmlBookingChannelItem.AppendChild(xmlBookingPseudoCityOrOfficeId); /* TicketingPseudoCityOrOfficeId */ int validTicketingPseudoCityOrOfficeIdCount = db.ValidPseudoCityOrOfficeIds.Where(x => x.PseudoCityOrOfficeId == ticketingPseudoCityOrOfficeId).Count(); if (!string.IsNullOrEmpty(ticketingPseudoCityOrOfficeId) && validTicketingPseudoCityOrOfficeIdCount == 0) { returnMessage = "Row " + i + ": TicketingPseudoCityOrOfficeId " + ticketingPseudoCityOrOfficeId + " is invalid. Please provide a valid TicketingPseudoCityOrOfficeId"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } /* Trim if is not null */ if (!string.IsNullOrEmpty(ticketingPseudoCityOrOfficeId)) { ticketingPseudoCityOrOfficeId = ticketingPseudoCityOrOfficeId.Trim(); } XmlElement xmlTicketingPseudoCityOrOfficeId = doc.CreateElement("TicketingPseudoCityOrOfficeId"); xmlTicketingPseudoCityOrOfficeId.InnerText = ticketingPseudoCityOrOfficeId; xmlBookingChannelItem.AppendChild(xmlTicketingPseudoCityOrOfficeId); /* AdditionalBookingComment */ if (!string.IsNullOrEmpty(additionalBookingCommentDescription)) { //AdditionalBookingComment is freeform text and will allow up to 1500 alphanumeric and allowable special characters. if (additionalBookingCommentDescription.Length > 1500) { returnMessage = "Row " + i + ": AdditionalBookingComment contains more than 1500 characters. Please provide a valid AdditionalBookingComment"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } //Allowable special characters are: space, dash, underscore, right and left parentheses, period, apostrophe (O’Reily), ampersand and accented characters. string additionalBookingCommentPattern = @"^[À-ÿ\w\s\-\(\)\.\&\'\’_]+$"; if (!Regex.IsMatch(additionalBookingCommentDescription, additionalBookingCommentPattern, RegexOptions.IgnoreCase)) { returnMessage = "Row " + i + ": AdditionalBookingComment contains invalid special characters. Please provide a valid AdditionalBookingComment"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } } XmlElement xmlAdditionalBookingCommentDescription = doc.CreateElement("AdditionalBookingCommentDescription"); xmlAdditionalBookingCommentDescription.InnerText = additionalBookingCommentDescription; xmlBookingChannelItem.AppendChild(xmlAdditionalBookingCommentDescription); /* Language Code */ //Where the AdditionalBookingComment value exists, then the LanguageCode column must contain a LanguageCode value, if (!string.IsNullOrEmpty(additionalBookingCommentDescription) && (languageCode == null || string.IsNullOrEmpty(languageCode))) { returnMessage = "Row " + i + ": AdditionalBookingComment provided, LanguageCode is mandatory. Please provide a valid LanguageCode"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } //LanguageCode must contain any one value from the LanguageCode column of the Language table if (!string.IsNullOrEmpty(languageCode)) { LanguageRepository languageRepository = new LanguageRepository(); Language language = languageRepository.GetLanguage(languageCode); if (language == null) { returnMessage = "Row " + i + ": LanguageCode " + languageCode + " is invalid. Please provide a valid Language Code"; if (!returnMessages.Contains(returnMessage)) { returnMessages.Add(returnMessage); } } } XmlElement xmlLanguageCode = doc.CreateElement("LanguageCode"); xmlLanguageCode.InnerText = languageCode; xmlBookingChannelItem.AppendChild(xmlLanguageCode); //Attach the XML Element for an item to the Document root.AppendChild(xmlBookingChannelItem); } } if (i == 0) { returnMessage = "There is no data in the file"; returnMessages.Add(returnMessage); } }
//Update SystemUser GDSss public WizardMessages UpdateSystemUserGDSs(SystemUserWizardVM systemuserChanges, WizardMessages wizardMessages) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; // Create the xml document container XmlDocument doc = new XmlDocument();// Create the XML Declaration, and append it to XML document XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", null, null); doc.AppendChild(dec); XmlElement root = doc.CreateElement("SystemUserGDSs"); doc.AppendChild(root); GDSRepository gdsRepository = new GDSRepository(); if (systemuserChanges.SystemUserGDSs != null) { if (systemuserChanges.SystemUserGDSs.Count > 0) { foreach (fnDesktopDataAdmin_SelectSystemUserGDSs_v1Result item in systemuserChanges.SystemUserGDSs) { GDS gds = new GDS(); gds = gdsRepository.GetGDS(item.GDSCode); if (gds != null) { XmlElement xmlGDS = doc.CreateElement("GDS"); root.AppendChild(xmlGDS); XmlElement xmlGDSName = doc.CreateElement("GDSName"); xmlGDSName.InnerText = gds.GDSName; xmlGDS.AppendChild(xmlGDSName); XmlElement xmlGDSCode = doc.CreateElement("GDSCode"); xmlGDSCode.InnerText = gds.GDSCode; xmlGDS.AppendChild(xmlGDSCode); XmlElement xmlPseudoCityOrOfficeId = doc.CreateElement("PseudoCityOrOfficeId"); xmlPseudoCityOrOfficeId.InnerText = item.PseudoCityOrOfficeId; xmlGDS.AppendChild(xmlPseudoCityOrOfficeId); XmlElement xmlGDSSignOn = doc.CreateElement("GDSSignOn"); xmlGDSSignOn.InnerText = item.GDSSignOn; xmlGDS.AppendChild(xmlGDSSignOn); XmlElement xmlDefaultGDS = doc.CreateElement("DefaultGDS"); xmlDefaultGDS.InnerText = item.DefaultGDS == true ? "1" : "0"; xmlGDS.AppendChild(xmlDefaultGDS); } } } } var output = (from n in db.spDDAWizard_UpdateSystemUserGDSs_v1( systemuserChanges.SystemUser.SystemUserGuid, System.Xml.Linq.XElement.Parse(doc.OuterXml), adminUserGuid) select n).ToList(); if (output != null) { foreach (spDDAWizard_UpdateSystemUserGDSs_v1Result message in output) { if (message != null) { if (message.MessageText != null && message.Success != null) { wizardMessages.AddMessage(message.MessageText.ToString(), (bool)message.Success); } } } } return(wizardMessages); }