//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; } } }
// GET: Edit A Single ClientFee public ActionResult Edit(int id) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientFee clientFee = new ClientFee(); clientFee = clientFeeRepository.GetItem(id); //Check Exists if (clientFee == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Change DisplayText for Transaction Fees FeeType feeType = new FeeType(); feeType = clientFee.FeeType; if (feeType.FeeTypeDescription == "Client Fee") { feeType.FeeTypeDescription = "Transaction Fee"; } ClientFeeVM clientFeeVM = new ClientFeeVM(); clientFeeVM.ClientFee = clientFee; GDSRepository gdsRepository = new GDSRepository(); clientFeeVM.GDSs = new SelectList(gdsRepository.GetAllGDSs().ToList(), "GDSCode", "GDSName", clientFee.GDSCode); ContextRepository contextRepository = new ContextRepository(); clientFeeVM.Contexts = new SelectList(contextRepository.GetAllContexts().ToList(), "ContextId", "ContextName", clientFee.ContextId); //Check for missing GDS if (clientFee.GDS == null) { GDS gds = new GDS(); clientFee.GDS = gds; } ClientFeeOutput clientFeeOutput = new ClientFeeOutput(); if (clientFee.ClientFeeOutputs.Count > 0) { clientFeeOutput = clientFeeOutputRepository.GetItem(clientFee.ClientFeeOutputs[0].ClientFeeOutputId); } clientFeeVM.ClientFeeOutput = clientFeeOutput; return(View(clientFeeVM)); }
//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; } }
// GET: View A Single ClientFee public ActionResult View(int id) { ClientFee clientFee = new ClientFee(); clientFee = clientFeeRepository.GetItem(id); //Check Exists if (clientFee == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } //Check for missing GDS if (clientFee.GDS == null) { GDS gds = new GDS(); clientFee.GDS = gds; } //Change DisplayText for Transaction Fees FeeType feeType = new FeeType(); feeType = clientFee.FeeType; if (feeType.FeeTypeDescription == "Client Fee") { feeType.FeeTypeDescription = "Transaction Fee"; } ClientFeeVM clientFeeVM = new ClientFeeVM(); clientFeeVM.ClientFee = clientFee; ClientFeeOutput clientFeeOutput = new ClientFeeOutput(); if (clientFee.ClientFeeOutputs.Count > 0) { clientFeeOutput = clientFeeOutputRepository.GetItem(clientFee.ClientFeeOutputs[0].ClientFeeOutputId); } clientFeeVM.ClientFeeOutput = clientFeeOutput; return(View(clientFeeVM)); }
//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; } }
public ActionResult Delete(int id) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientFee clientFee = new ClientFee(); clientFee = clientFeeRepository.GetItem(id); //Check Exists if (clientFee == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } //Check for missing GDS if (clientFee.GDS == null) { GDS gds = new GDS(); clientFee.GDS = gds; } ClientFeeVM clientFeeVM = new ClientFeeVM(); clientFeeVM.ClientFee = clientFee; ClientFeeOutput clientFeeOutput = new ClientFeeOutput(); if (clientFee.ClientFeeOutputs.Count > 0) { clientFeeOutput = clientFeeOutputRepository.GetItem(clientFee.ClientFeeOutputs[0].ClientFeeOutputId); } clientFeeVM.ClientFeeOutput = clientFeeOutput; return(View(clientFeeVM)); }
public JsonResult Publish(int clientProfileGroupId, string sabreStatus, string gdsCode) { //Get Item From Database ClientProfileGroup clientProfileGroup = new ClientProfileGroup(); clientProfileGroup = clientProfileGroupRepository.GetGroup(clientProfileGroupId); //Check Exists in Database if (clientProfileGroup == null) { ViewData["ActionMethod"] = "DeletePost"; return(Json("Record Does Not Exist Error")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientProfileGroup(clientProfileGroup.ClientProfileGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(Json("Error")); } GDS gds = new GDS(); GDSRepository gdsRepository = new GDSRepository(); gds = gdsRepository.GetGDS(clientProfileGroup.GDSCode); string gdsName = gds.GDSName; switch (gdsCode) { case "1S": gdsName = sabreStatus; break; } string response = DoPublish(clientProfileGroup, gds, gdsName, clientProfileGroup.PseudoCityOrOfficeId, false); return(Json(response)); }
public ActionResult Delete(int id) { //Check Exists QueueMinderItem queueMinderItem = new QueueMinderItem(); queueMinderItem = queueMinderItemRepository.GetItem(id); if (queueMinderItem == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToQueueMinderItem(queueMinderItem.QueueMinderItemId)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } if (queueMinderItem.GDS == null) { GDS gDS = new GDS(); queueMinderItem.GDS = gDS; } if (queueMinderItem.Context == null) { Context context = new Context(); queueMinderItem.Context = context; } QueueMinderItemVM queueMinderItemVM = new QueueMinderItemVM(); queueMinderItemVM.QueueMinderItem = queueMinderItem; return(View(queueMinderItemVM)); }
public ActionResult View(int id) { //Check Exists QueueMinderItem queueMinderItem = new QueueMinderItem(); queueMinderItem = queueMinderItemRepository.GetItem(id); if (queueMinderItem == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } if (queueMinderItem.GDS == null) { GDS gDS = new GDS(); queueMinderItem.GDS = gDS; } if (queueMinderItem.Context == null) { Context context = new Context(); queueMinderItem.Context = context; } return(View(queueMinderItem)); }
public JsonResult Verify(int clientProfileGroupId, string sabreStatus, string gdsCode) { //Get Item From Database ClientProfileGroup clientProfileGroup = new ClientProfileGroup(); clientProfileGroup = clientProfileGroupRepository.GetGroup(clientProfileGroupId); //Check Exists in Databsase if (clientProfileGroup == null) { ViewData["ActionMethod"] = "DeletePost"; return(Json("Record Does Not Exist Error")); } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientProfileGroup(clientProfileGroup.ClientProfileGroupId)) { ViewData["Message"] = "You do not have access to this item"; return(Json("Error")); } GDS gds = new GDS(); GDSRepository gdsRepository = new GDSRepository(); gds = gdsRepository.GetGDS(clientProfileGroup.GDSCode); string verifyPCC = string.Empty; string gdsName = gds.GDSName; switch (gdsCode) { case "1G": verifyPCC = ConfigurationManager.AppSettings["VerifyPCC_Galileo"].ToString(); break; case "1V": verifyPCC = ConfigurationManager.AppSettings["VerifyPCC_Apollo"].ToString(); break; case "1A": verifyPCC = ConfigurationManager.AppSettings["VerifyPCC_Amadeus"].ToString(); break; case "1S": verifyPCC = ConfigurationManager.AppSettings["VerifyPCC_Sabre"].ToString(); gdsName = sabreStatus; break; } if (string.IsNullOrEmpty(verifyPCC)) { //Need to add values into web config LogRepository logRepository = new LogRepository(); logRepository.LogError("Please ensure verify PCC is present for GDS"); ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(Json("There was a problem with your request, please see the log file or contact an administrator for details")); } string response = DoPublish(clientProfileGroup, gds, gdsName, verifyPCC, true); return(Json(response)); }
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)); }
//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; } }
//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); }
public JsonResult IsProfileReadytoPublish(string clientProfileGroupId) { if (clientProfileGroupId == null) { return(Json("No Id")); } int id = Int32.Parse(clientProfileGroupId); string retval = "true"; //Get Item From Database ClientProfileGroup clientProfileGroup = new ClientProfileGroup(); clientProfileGroup = clientProfileGroupRepository.GetGroup(id); //Get GDS GDS gds = new GDS(); GDSRepository gdsRepository = new GDSRepository(); gds = gdsRepository.GetGDS(clientProfileGroup.GDSCode); //Check Exists if (clientProfileGroup == null) { retval = "RecordDoesNotExistError"; } //Check Access RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientProfileGroup(id)) { retval = "You do not have access to this item"; } List <ClientProfileItemVM> clientProfileItemsList = GDSIntegration.GetProfileLineItems(id, true); bool doIncompleteFieldsExists = false; //Check if all mandatory fields are complete foreach (ClientProfileItemVM clientProfileItemVM in clientProfileItemsList) { ClientProfileItemRow clientProfileItemRow = clientProfileItemVM.ClientProfileItem; if (clientProfileItemRow.MandatoryFlag == true && ( clientProfileItemRow.ClientProfileMoveStatusId == null || string.IsNullOrEmpty(clientProfileItemRow.Remark) || string.IsNullOrEmpty(clientProfileItemRow.GDSCommandFormat))) { doIncompleteFieldsExists = true; } } if (doIncompleteFieldsExists) { return(Json("There are incomplete mandatory elements.<br/><br/>Please return to the Items page and correct the error.")); } //Check Line Counts int lineCount = clientProfileItemsList.Count(); int maxLineCount = 0; switch (gds.GDSName) { case "Apollo": maxLineCount = 200; break; case "Amadeus": maxLineCount = 100; break; case "Galileo": maxLineCount = 200; break; case "Sabre": maxLineCount = 200; break; } if (lineCount > maxLineCount) { retval = "The client profile exceeds the maximum number of lines.<br/><br/>Please return to the Items page and correct the error."; } return(Json(retval)); }
public MyConexionOracle(GDS gds) { this.gds = gds; }
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); } }
//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; } }
// // GET: /ClientProfileItem/List public ActionResult List(int id, int?clientProfilePanelId) { ClientProfileItemsVM clientProfileItemsVM = new ClientProfileItemsVM(); //Set Access Rights if (hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { clientProfileItemsVM.HasDomainWriteAccess = true; } //Get the ClientProfileGroup ClientProfileGroup clientProfileGroup = new ClientProfileGroup(); clientProfileGroup = clientProfileGroupRepository.GetGroup(id); clientProfileGroupRepository.EditGroupForDisplay(clientProfileGroup); clientProfileItemsVM.ClientProfileGroup = clientProfileGroup; clientProfileItemsVM.ClientProfileGroupId = clientProfileGroup.ClientProfileGroupId; clientProfileItemsVM.ClientProfileGroupClientProfileGroupName = clientProfileGroup.ClientProfileGroupName; GDS gds = new GDS(); GDSRepository gdsRepository = new GDSRepository(); gds = gdsRepository.GetGDS(clientProfileGroup.GDSCode); clientProfileItemsVM.ClientProfileGroupGDSName = gds.GDSName; clientProfileItemsVM.ClientProfileGroupHierarchyItem = clientProfileGroup.HierarchyItem; clientProfileItemsVM.ClientProfileGroupBackOfficeSystemDescription = clientProfileGroup.BackOfficeSystem.BackOfficeSystemDescription; clientProfileItemsVM.ClientProfilePanelId = clientProfilePanelId ?? 0; //Get ClientTopUnit if (clientProfileGroup.HierarchyType == "ClientSubUnit") { ClientProfileGroupClientSubUnit clientProfileGroupClientSubUnit = clientProfileGroup.ClientProfileGroupClientSubUnits.SingleOrDefault(); if (clientProfileGroupClientSubUnit != null) { ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository(); ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientProfileGroupClientSubUnit.ClientSubUnitGuid); if (clientSubUnit != null) { if (clientSubUnit.ClientTopUnit != null) { ViewData["ClientTopUnitName"] = clientSubUnit.ClientTopUnit.ClientTopUnitName; } } } } //Get a list of ClientProfileItems for each panel clientProfileItemsVM.ClientProfileItemsClientDetails = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 6); clientProfileItemsVM.ClientProfileItemsMidOffice = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 3); clientProfileItemsVM.ClientProfileItemsBackOffice = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 5); clientProfileItemsVM.ClientProfileItemsAirRailPolicy = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 7); clientProfileItemsVM.ClientProfileItemsItinerary = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 9); clientProfileItemsVM.ClientProfileItems24Hours = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 10); clientProfileItemsVM.ClientProfileItemsAmadeusTPM = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 11); /*GDS Integration*/ //https://docs.google.com/document/d/1TMOvJzZmePKjFTt0qFUC6_JGRz0x508uIiV3jGCa7b0/ //TLS Update System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; ClientProfileService lService = null; StringBuilder clientProfileText = new StringBuilder(); //Format PCC String string formattedPcc = GDSIntegration.FormatPccString(clientProfileGroup.PseudoCityOrOfficeId); try { //This is a singleton, and should be used strictly to retrieve existing profiles from the GDS lService = ClientProfileService.getInstance; } catch (Exception ex) { LogRepository logRepository = new LogRepository(); logRepository.LogError(ex.Message); //Generic Error ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(View("Error")); } if (lService != null) { try { //string pGds, string pPcc, string pZeroLevel, string pCompanyProfileName, stringpTravellerProfileName ClientProfileResponse clientProfileResponse = lService.GetProfile(gds.GDSName, formattedPcc, "", clientProfileGroup.ClientProfileGroupName, ""); if (clientProfileResponse != null) { if (clientProfileResponse.Result != CWTResponse.ResultStatus.Error) { if (clientProfileResponse.ClientProfile != null) { ClientProfile clientProfile = clientProfileResponse.ClientProfile; if (clientProfile != null) { if (clientProfile.ProfileLines.Count > 0) { //Loop through the profile and write out the lines foreach (ClientProfileLine line in clientProfile.ProfileLines) { // is new line clientProfileText.AppendFormat("{0} {1} ", line.LineNumber, line.LineText); } //Pass content into view if exists if (!string.IsNullOrEmpty(clientProfileText.ToString())) { ViewData["clientProfileText"] = clientProfileText.ToString(); } } } } } else { //Log Get Profile error messages and show error in GDS window if (clientProfileResponse.MessageList.Count > 0) { string errorMessage = string.Empty; foreach (string message in clientProfileResponse.MessageList) { errorMessage += string.Format("{0} ", message); } if (!string.IsNullOrEmpty(errorMessage)) { ViewData["clientProfileText"] = errorMessage; } } } } } catch (Exception ex) { LogRepository logRepository = new LogRepository(); logRepository.LogError(ex.Message); //Generic Error ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(View("Error")); } } return(View(clientProfileItemsVM)); }
public string DoPublish([Bind(Exclude = "HierarchyType, HierarchyItem, HierarchyCode")] ClientProfileGroup clientProfileGroup, [Bind(Include = "GDSCode, GDSName")] GDS gds, string gdsName, string formattedPcc, bool verify = false) { /*GDS Integration*/ //https://docs.google.com/document/d/1TMOvJzZmePKjFTt0qFUC6_JGRz0x508uIiV3jGCa7b0/ //TLS Update System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; ClientProfileService lService = null; CWTResponse CWTResponse = null; string errorMessage = string.Empty; try { //This is a singleton, and should be used strictly to retrieve existing profiles from the GDS lService = ClientProfileService.getInstance; if (lService == null) { return("Service Error"); } ClientProfile clientProfile = null; ClientProfileResponse clientProfileResponse = lService.GetProfile(gdsName, formattedPcc, "", clientProfileGroup.ClientProfileGroupName, ""); if (clientProfileResponse != null && clientProfileResponse.ClientProfile != null) { clientProfile = clientProfileResponse.ClientProfile; } if (clientProfileResponse != null && clientProfileResponse.MessageList != null && clientProfileResponse.MessageList.Count > 0) { errorMessage = string.Format("These errors were returned by the GDS for PCC when retrieving profile:"); foreach (string message in clientProfileResponse.MessageList) { errorMessage += string.Format("{0}<br/>", message); } LogRepository logRepository = new LogRepository(); logRepository.LogError(errorMessage); return(errorMessage); } //Get Lines List <ClientProfileItemVM> clientProfileItemsList = GDSIntegration.GetProfileLineItems(clientProfileGroup.ClientProfileGroupId); List <ClientProfileLine> clientProfileItemLines = GDSIntegration.WriteProfileLines(clientProfileItemsList, gds.GDSCode); //Modify Profile if (clientProfile != null) { //Replace current lines with new lines clientProfile.ProfileLines = clientProfileItemLines; CWTResponse = clientProfile.DeleteProfileLines(); CWTResponse = clientProfile.ModifyProfile(); } //Create New else { clientProfile = new ClientProfile( gds.GDSName, formattedPcc, clientProfileGroup.ClientProfileGroupName, string.Empty, clientProfileItemLines); CWTResponse = clientProfile.SaveProfile(); } } catch (Exception 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("There was a problem with your request, please see the log file or contact an administrator for details"); } //Update Client Profile Publish Date if (CWTResponse != null && CWTResponse.Result != CWTResponse.ResultStatus.Error) { try { //Don't update timestamp for verify process if (!verify) { clientProfileGroupRepository.UpdateGroupPublishDate(clientProfileGroup); } } catch (SqlException ex) { //Versioning Error if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/ClientProfileGroup.mvc/Publish/" + clientProfileGroup.ClientProfileGroupId; return("Version Error"); } 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("Error"); } } else if (CWTResponse != null && CWTResponse.MessageList != null && CWTResponse.MessageList.Count > 0) { errorMessage = string.Format("These errors were returned by the GDS for PCC when retrieving profile:"); foreach (string message in CWTResponse.MessageList) { errorMessage += string.Format("{0}<br/>", message); } errorMessage += "<br/>Please correct the profile and try to re-publish again."; LogRepository logRepository = new LogRepository(); logRepository.LogError(errorMessage); return(errorMessage); } else { errorMessage = "There was a problem with your request, please see the log file or contact an administrator for details."; LogRepository logRepository = new LogRepository(); logRepository.LogError(errorMessage); return(errorMessage); } return("true"); }