/// <summary>
        /// Builds this instance.
        /// </summary>
        /// <returns>El comando que sera enviado al API</returns>
        public override string Build()
        {
            var mailer = new InterJetMailer();

            if (VolarisSession.IsVolarisProcess)
            {
                Ticket.RecordSabre = VolarisSession.PNRSabre;
            }
            else
            {
                Ticket.RecordSabre = RecordLocalizer.GetRecordLocalizer();
            }

            if (string.IsNullOrEmpty(Ticket.RecordSabre))
            {
                string responseFromApi = this.Comunicator.SendCommand("*A");
                string sabrePnr        = responseFromApi.Split('\n')[0];
                Ticket.RecordSabre = sabrePnr;
            }
            mailer.Ticket = Ticket;
            string responseFromAPI = Comunicator.SendCommand(GetSabreCommand());

            if (!string.IsNullOrEmpty(responseFromAPI))
            {
                if (responseFromAPI.ToLower().Contains("*pac to verify"))
                {
                    string newResponse = Comunicator.SendCommand(GetSabreCommand());
                    if (newResponse.Contains("INVOICED"))
                    {
                        mailer.SendConfirmationMail();

                        LogInterJetReservation(Ticket.RecordLocator, Ticket.RecordSabre);

                        return("OK");
                    }
                }
                if (responseFromAPI.Contains("INVOICED"))
                {
                    LogInterJetReservation(Ticket.RecordLocator, Ticket.RecordSabre);
                    mailer.SendConfirmationMail();
                    return("OK");
                }
            }
            InterJetHelper.DestroyTicket();
            return("FAIL");
        }
        private void OnRecordCompleted(object sender, OnRecordCompletedEventArgs e)
        {
            if (VolarisSession.IsVolarisProcess)
            {
                var reservation = (VolarisReservation)this.Parameter;//preguntar a Luis
                VolarisSession.ReservationStatus            = VolarisReservationStatus.Accepted;
                ucServicesFeePayApply.PNRBajoCostoAerolinea = VolarisSession.PNR;
                ucServicesFeePayApply.PNRBajoCostoSabre     = String.Empty;
                ChargesPerService.DKActualBajoCosto         = VolarisSession.DK;
                ucServicesFeePayApply.OrigenTipo            = ChargesPerService.OrigenTipoCargo.BajoCosto;

                if (!string.IsNullOrEmpty(e.SabrePnr) && e.SabrePnr.Length == 6 && ValidateRegularExpression.ValidatePNR(e.SabrePnr))
                {
                    LogTicketsBL.LogTicketsVolarisUpdate(VolarisSession.PNR, e.SabrePnr);
                    VolarisSession.PNRSabre = e.SabrePnr;
                    ucServicesFeePayApply.PNRBajoCostoSabre = e.SabrePnr;
                    //quitar
                    ImpuestosBajoCostoBL.UpdateImpuestosBajoCosto(ImpuestosBajoCosto.Id, ImpuestosBajoCosto.ImpuestosObtenidos, VolarisSession.PNR, ImpuestosBajoCosto.ImpuestosMostrados, ImpuestosBajoCosto.LineaContable, VolarisSession.PNRSabre);

                    var mailer = new VolarisMailer
                    {
                        Reservation = reservation
                    };
                    mailer.SendTest();
                    if (e.IsInvoiced)
                    {
                        VolarisSession.ReservationStatus = VolarisReservationStatus.Invoiced;
                        VolarisLogger.UpdateReservation(VolarisSession.PNR,
                                                        VolarisSession.PNRSabre, VolarisSession.ReservationStatus);
                        ucServicesFeePayApply.OrigenTipo = ChargesPerService.OrigenTipoCargo.BajoCosto;
                        ucServicesFeePayApply pago = new ucServicesFeePayApply();
                        pago.PayServiceFee();
                        Loader.AddToPanelWithParameters(Loader.Zone.Middle, this, "ucEndRecordSuccess",
                                                        null);
                    }
                }
                else
                {
                    MessageBox.Show("No ha sido posible generar la factura para el servicio aéreo,\n por tal motivo los cargos por servicio en linea\n no pudieron ser completados", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            if (IsInterJet)
            {
                ucServicesFeePayApply.PNRBajoCostoAerolinea = InterJetTicket.RecordLocator;
                ucServicesFeePayApply.PNRBajoCostoSabre     = String.Empty;
                ucServicesFeePayApply.OrigenTipo            = ChargesPerService.OrigenTipoCargo.BajoCosto;

                if (!string.IsNullOrEmpty(e.SabrePnr) && e.SabrePnr.Length == 6 && ValidateRegularExpression.ValidatePNR(e.SabrePnr))
                {
                    //quitar
                    ImpuestosBajoCostoBL.UpdateImpuestosBajoCosto(ImpuestosBajoCosto.Id, ImpuestosBajoCosto.ImpuestosObtenidos, ImpuestosBajoCosto.PNRBajoCosto, ImpuestosBajoCosto.ImpuestosMostrados, ImpuestosBajoCosto.LineaContable, e.SabrePnr);

                    LogTicketsBL.LogTicketsInterjetUpdate(InterJetTicket.RecordLocator, e.SabrePnr);

                    InterJetTicket.RecordSabre = e.SabrePnr;
                    ucServicesFeePayApply.PNRBajoCostoSabre = e.SabrePnr;
                    var mailer = new InterJetMailer {
                        Ticket = InterJetTicket
                    };
                    mailer.SendConfirmationMail();
                    if (e.IsInvoiced)
                    {
                        InterJetTicket.IsFactured = e.IsInvoiced;
                        var service = new LogInterJetBL();
                        service.InvoiceRecord(InterJetTicket.RecordLocator);
                        MyCTS.Presentation.Reservations.Availability.ChargeOfServiceLowFare.AssignamentChargeOfService.ucChargeOfServiceAssign.sPNR = InterJetTicket.RecordLocator;
                        service.InsertSabreRecord(InterJetTicket.RecordLocator, InterJetTicket.RecordSabre);
                        ucMenuReservations.EnabledMenu   = true;
                        ucServicesFeePayApply.OrigenTipo = ChargesPerService.OrigenTipoCargo.BajoCosto;
                        ucServicesFeePayApply pago = new ucServicesFeePayApply();
                        pago.PayServiceFee();
                        Loader.AddToPanelWithParameters(Loader.Zone.Middle, this, "ucEndRecordSuccess",
                                                        null);
                    }
                }
                else
                {
                    MessageBox.Show("No ha sido posible generar la factura para el servicio aéreo,\n por tal motivo los cargos por servicio en linea\n no pudieron ser completados", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            this.errrorMessageContainer.Visible = e.Success;
            this.errorMessage.Text         = e.Message;
            ucMenuReservations.EnabledMenu = true;
            this._group.Visible            = true;
            this.loadingControl1.Visible   = false;
        }