/// <summary> /// Envia comando para desplegar los numeros de boletos generados /// </summary> private void SendValidationTicketCommand() { TktNumber = new List <string>(); PaxName = new List <string>(); LinkVT = new List <string>(); sabreAnswer = string.Empty; sabreConcat = string.Empty; string emitedPCC = string.Empty; string command = Resources.TicketEmission.Constants.COMMANDS_AST_T; using (CommandsAPI objCommands = new CommandsAPI()) { sabreAnswer = objCommands.SendReceive(command); } //return; sabreConcat = sabreAnswer; SearchTKT(); sabreConcat = sabreConcat.Replace('‡', '\n'); string[] numbersOfTkt = sabreConcat.Split(new char[] { '\n' }); foreach (string tkt in numbersOfTkt) { if (tkt.Length > 30 && ValidateRegularExpression.ValidateThirteenNumbers(tkt.Substring(7, 13)) && tkt.Substring(4, 2) != "TV") { emitedPCC = recoverEmitedPCC(tkt); TktNumber.Add(tkt.Substring(7, 13)); if (tkt.Substring(20, 1) == "/") { PaxName.Add(tkt.Substring(27, 7).Trim()); } else { PaxName.Add(tkt.Substring(24, 7).Trim()); } } } sabreAnswer = string.Empty; sabreConcat = string.Empty; //********************************************************************** string recordLocalizator = ucFirstValidations.LocatorRecord; if (string.IsNullOrEmpty(recordLocalizator)) { recordLocalizator = ucTicketEmissionBuildCommand.RecordLocator; } Parameter activateTicketPrinter = ParameterBL.GetParameterValue("ActivateTicketPrinter"); if (Convert.ToBoolean(activateTicketPrinter.Values)) { List <string> listTicketsByPNR = GetTicketsByPNRBL.GetTKTByPNR(recordLocalizator); for (int j = 0; j < TktNumber.Count; j++) { if (!listTicketsByPNR.Contains(TktNumber[j].Substring(3, 10))) { listNewTickets.Add(TktNumber[j]); } } } //************************************************************************** for (int i = 0; i < TktNumber.Count; i++) { string[] names = PaxName[i].Split(new char[] { '/' }); LinkVT.Add(string.Concat("https://services.tripcase.com/new/eticketPrint.html?pnr=", recordLocalizator, "&hostID=1W&ETTOT=1&ETNBR1=", TktNumber[i], "&pcc=", emitedPCC, "&action=printEticket")); AddDetailsTktsLinksBL.AddDetailsTktsLinks(Login.Agent, recordLocalizator, TktNumber[i].Substring(3, 10), PaxName[i], LinkVT[i], DateTime.Now); } //*********************************************** if (Convert.ToBoolean(activateTicketPrinter.Values)) { GetInfoTicketDelegate(listNewTickets); } //*********************************************** }
/// <summary> /// Regenera el boleto cuando no fue encontrado en la BD /// </summary> private void RegenarateInvoice() { string ticket = string.Empty; string paxName = string.Empty; string linkVT = string.Empty; List <string> listNewTickets = null; string emitedPCC = string.Empty; sabreAnswer = string.Empty; sabreConcat = string.Empty; string command = string.Concat("*TKT", txtNumberTicket.Text.Substring(3, 10)); using (CommandsAPI objCommands = new CommandsAPI()) { sabreAnswer = objCommands.SendReceive(command); } string[] sabreAnswerInfo = sabreAnswer.Split(new char[] { '\n' }); int row = 0; int col = 0; CommandsQik.searchResponse(sabreAnswer, "UNABLE TO FIND TICKET NUMBER", ref row, ref col); if (row != 0 && col >= 0) { MessageBox.Show("EL NÚMERO DE BOLETO NO FUE ENCONTRADO", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } else if (sabreAnswerInfo.Length > 0 && sabreAnswerInfo[0].Length == 6 && ValidateRegularExpression.ValidatePNR(sabreAnswerInfo[0])) { command = "*T"; using (CommandsAPI objCommands = new CommandsAPI()) { sabreAnswer = objCommands.SendReceive(command); } sabreConcat = sabreAnswer; SearchTKT(); command = "*PDK"; using (CommandsAPI objCommands = new CommandsAPI()) { sabreAnswer = objCommands.SendReceive(command); } DK = sabreAnswer.Substring(18, 6); using (CommandsAPI objCommands = new CommandsAPI()) { objCommands.SendReceive("I"); } sabreConcat = sabreConcat.Replace('‡', '\n'); string[] numbersOfTkt = sabreConcat.Split(new char[] { '\n' }); foreach (string tkt in numbersOfTkt) { emitedPCC = recoverEmitedPCC(tkt); int index = tkt.IndexOf(txtNumberTicket.Text); if (index >= 0) { if (tkt.Length > 30 && ValidateRegularExpression.ValidateThirteenNumbers(tkt.Substring(index, 13)) && !tkt.Contains("TV") ) //&& tkt.Substring(index, 13) == txtNumberTicket.Text) { ticket = tkt.Substring(index, 13); string value = tkt.Substring(index, tkt.Length - index); string[] data = value.Split(new char[] { ' ' }); if (data[1].Contains("/")) { paxName = data[1]; // else // paxName = tkt.Substring(24, 7).Trim(); } else { paxName = string.Format("{0} {1}", data[1], data[2]); } break; } } } if (!string.IsNullOrEmpty(ticket) && !string.IsNullOrEmpty(paxName)) { string airline = GetAirlineCodeByNumIDBL.GetAirlineCode(ticket.Substring(0, 3)); if (string.IsNullOrEmpty(airline) || airline.Equals("NOTHING")) { MessageBox.Show("ERROR EN CÓDIGO DE AEROLÍNEA, FAVOR DE REPORTARLO A SISTEMAS", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } else { string[] names = paxName.Split(new char[] { '/' }); linkVT = string.Concat("https://services.tripcase.com/new/eticketPrint.html?pnr=", sabreAnswerInfo[0], "&hostID=1W&ETTOT=1&ETNBR1=", ticket, "&pcc=", emitedPCC, "&action=printEticket"); //linkVT = string.Concat("https://www.virtuallythere.com/new/eTicketReceiptPrint.html?pnr=", sabreAnswerInfo[0], "&pcc=3L64&language=1&name=", // names[0], "&host=1W&agent=AFM&ETNBR1=", ticket, "&ETNME1=", names[0], "/", names[1].Substring(0, 1), " &ETDTE1=4DEC&ETISS1=3L64*AJV&ETTOT=1"); if (addTicketInBD) { AddDetailsTktsLinksBL.AddDetailsTktsLinks(Login.Agent, sabreAnswerInfo[0], ticket.Substring(3, 10), paxName, linkVT, DateTime.Now); } ucTicketsEmissionInstructions.Airline = airline; listNewTickets = new List <string>(); listNewTickets.Add(txtNumberTicket.Text); if (!string.IsNullOrEmpty(txtCCMail.Text)) { tempccmail = txtCCMail.Text.ToLower(); } GetInfoTicketDelegate(listNewTickets); MessageBox.Show("SU SOLICITUD FUE ENVIADA CON ÉXITO", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } } else { MessageBox.Show("EL BOLETO NO PUDO SER ENCONTRADO, FAVOR DE REPORTARLO A SISTEMAS", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } } else { MessageBox.Show("NO SE PUEDE ACCESAR AL NÚMERO DE BOLETO", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information); Loader.AddToPanel(Loader.Zone.Middle, this, Resources.Constants.UCWELCOME); } }