public ClientProfileItemVM(ClientProfileItemRow clientProfileItem, IEnumerable <SelectListItem> clientProfileMoveStatuses) { ClientProfileMoveStatuses = clientProfileMoveStatuses; ClientProfileItem = clientProfileItem; }
/* * https://support.travelport.com/NR/rdonlyres/CC80873C-B071-48CA-8CD9-6834281DB367/0/GalileoDesktopSpecial_Characters.pdf * @.>|\/:L¤#[] * * http://sds.sabre.com/XTRANET_Access/sabre.htm * /-,^¤<‡$.>?†:* * * * */ public string IsValidClientProfileRowItem(ClientProfileItemRow clientProfileItemRow) { if (string.IsNullOrEmpty(clientProfileItemRow.Remark)) { clientProfileItemRow.Remark = ""; } if (clientProfileItemRow.GDSCode == "1A") //Amadeus { if (clientProfileItemRow.GDSCommandFormat == "RM*ACC") { if (clientProfileItemRow.Remark.Length < 1 || clientProfileItemRow.Remark.Length > 10) { return("Remark must be between 1 and 10 characters"); } } if (clientProfileItemRow.GDSCommandFormat == "PCN/") { if (clientProfileItemRow.Remark.Length < 3 || clientProfileItemRow.Remark.Length > 64) { return("Remark must be between 3 and 64 characters"); } } if (clientProfileItemRow.GDSCommandFormat == "TKOK" || clientProfileItemRow.GDSCommandFormat == "TKTL") { if (clientProfileItemRow.Remark.Length < 2 || clientProfileItemRow.Remark.Length > 19) { return("Remark must be between 2 and 19 characters"); } } if (clientProfileItemRow.GDSCommandFormat == "AP" || clientProfileItemRow.GDSCommandFormat == "APF" || clientProfileItemRow.GDSCommandFormat == "APE") { if (clientProfileItemRow.Remark.Length < 1 || clientProfileItemRow.Remark.Length > 90) { return("Remark must be between 1 and 90 characters"); } } if (clientProfileItemRow.GDSCommandFormat == "RC" || clientProfileItemRow.GDSCommandFormat == "RM" || clientProfileItemRow.GDSCommandFormat == "RQ") { if (clientProfileItemRow.Remark.Length < 1 || clientProfileItemRow.Remark.Length > 124) { return("Remark must be between 1 and 124 characters"); } } } if (clientProfileItemRow.GDSCode == "1G") //Galileo { if (clientProfileItemRow.GDSCommandFormat == "D.") { if (clientProfileItemRow.Remark.Length > 119) { return("Remark cannot be longer than 119 characters"); } string pattern2 = @"(\*([\w\s\-()\u2628\u00A4]){1,37}){1,6}"; Match match2 = Regex.Match(clientProfileItemRow.Remark, pattern2, RegexOptions.IgnoreCase); if (!match2.Success) { return("Remark is not a valid format"); } } else if (clientProfileItemRow.GDSCommandFormat == "W.") { if (clientProfileItemRow.Remark.Length > 119) { return("Remark cannot be longer than 119 characters"); } string pattern1 = @"\*P/"; Match match1 = Regex.Match(clientProfileItemRow.Remark, pattern1, RegexOptions.IgnoreCase); if (!match1.Success) { return("Remark must contain a PostCode"); } string pattern2 = @"(\*([\w\s\-()\u2628\u00A4]){1,37}){1,5}"; Match match2 = Regex.Match(clientProfileItemRow.Remark, pattern2, RegexOptions.IgnoreCase); if (!match2.Success) { return("Remark is not a valid format"); } } else if (clientProfileItemRow.GDSCommandFormat == "RA.") { string pattern1 = @"\*P/"; Match match1 = Regex.Match(clientProfileItemRow.Remark, pattern1, RegexOptions.IgnoreCase); if (!match1.Success) { return("Remark must contain a PostCode"); } string pattern2 = @"(\*([\w\s\-()\u2628\u00A4]){1,37}){1,5}"; Match match2 = Regex.Match(clientProfileItemRow.Remark, pattern2, RegexOptions.IgnoreCase); if (!match2.Success) { return("Remark is not a valid format"); } } else if (clientProfileItemRow.Remark.Length > 58) { return("Remark cannot be longer than 58 characters"); } } if (clientProfileItemRow.GDSCode == "1S") //Sabre { if (clientProfileItemRow.Remark.Length > 64) { return("Remark cannot be longer than 64 characters"); } } if (clientProfileItemRow.GDSCode == "1V") //Apollo { if (clientProfileItemRow.GDSCommandFormat == "W-" || clientProfileItemRow.GDSCommandFormat == "D-") { if (clientProfileItemRow.ClientProfileMoveStatusId == 2) //Never Move { if (clientProfileItemRow.Remark.Length > 244) { return("Remark cannot be longer than 244 characters"); } } else { if (clientProfileItemRow.Remark.Length > 120) { return("Remark cannot be longer than 120 characters"); } } } else { if (clientProfileItemRow.Remark.Length > 58) { return("Remark cannot be longer than 58 characters"); } } } return("OK"); }
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 JsonResult IsValidClientProfileRowItem(ClientProfileItemRow clientProfileItemRow) { var result = validationRepository.IsValidClientProfileRowItem(clientProfileItemRow); return(Json(result)); }