Example #1
0
        private void NewTicketInterjet(string oldTicket)
        {
            string num       = oldTicket.Substring(2, 1);
            string num2      = (Convert.ToInt32(num) + 1).ToString();
            string newTicket = oldTicket.Substring(0, 2) + num2.Substring(0, 1) + oldTicket.Substring(3, 7);

            boleto = LogTicketsBL.LogTicketsInterjet(newTicket);
            if (!string.IsNullOrEmpty(boleto.TicketNumber))
            {
                NewTicketInterjet(boleto.TicketNumber);
            }
            else
            {
                boleto.TicketNumber = newTicket;
            }
        }
Example #2
0
        /// <summary>
        /// Gets the sabre command.
        /// </summary>
        /// <param name="flights">The flights.</param>
        /// <returns></returns>
        private string[] GetSabreCommand(List <InterJetFlight> flights)
        {
            var commands = new List <string>();
            //quitar
            string comando = string.Empty;

            if (flights.Count > 0)
            {
                string         currentFlightID = flights.FirstOrDefault().ID;
                InterJetFlight theFlight       = flights.FirstOrDefault();

                if (this.Ticket.Passangers.HasAdults)
                {
                    int infante = 1;

                    var adultCountingLine = new
                    {
                        TotalBasePriceSum = (flights.Sum(flight => flight.PriceDetail.Adult.BasePrice - flight.PriceDetail.Adult.Discount) / Ticket.Passangers.TotalAdults) * 100,
                        TotalTuaSum       = (flights.Sum(flight => flight.PriceDetail.Adult.TUA) / Ticket.Passangers.TotalAdults) * 100,
                        TotalIVASuma      = (flights.Sum(flight => flight.PriceDetail.Adult.IVA) / Ticket.Passangers.TotalAdults) * 100,
                        TotalExtraSum     = (flights.Sum(flight => flight.PriceDetail.Adult.TotalExtraTaxes) / Ticket.Passangers.TotalAdults) * 100
                    };
                    foreach (InterJetAdultPassanger pax in this.Ticket.Passangers.GetAdultsPassangers())
                    {
                        if (this.Ticket.PaymentForm.StartsWith("CCA3"))
                        {
                            this.Ticket.PaymentForm = this.Ticket.PaymentForm.Replace("CCA3", "CCAX");
                        }

                        //boleto = LogTicketsBL.LogTicketsInterjet("7916309061"); //solo para pruebas
                        boleto = LogTicketsBL.LogTicketsInterjet(pax.UniqueID + currentFlightID[1]);
                        if (!string.IsNullOrEmpty(boleto.TicketNumber))
                        {
                            NewTicketInterjet(boleto.TicketNumber);
                        }
                        else
                        {
                            boleto.TicketNumber = pax.UniqueID + currentFlightID[1];
                        }

                        LogTicketsBL.LogTicketsInterjetInsert(boleto.TicketNumber, DateTime.Now, Ticket.RecordLocator, string.Empty);
                        string command = string.Format("AC/4o/{0}/P01/{1}/{2}/d{3}/D{7}/ONE/{4} {5}/1/{6}",
                                                       boleto.TicketNumber,
                                                       decimal.Truncate(adultCountingLine.TotalBasePriceSum),
                                                       decimal.Truncate(adultCountingLine.TotalTuaSum),
                                                       decimal.Truncate(adultCountingLine.TotalIVASuma),
                                                       this.Ticket.PaymentForm,
                                                       pax.AccountLineParameter,
                                                       theFlight.IsInternational ? "F" : "D",
                                                       decimal.Truncate(adultCountingLine.TotalExtraSum));

                        if (ListTaxesInterjet.Conexion)
                        {
                            string quality = string.Format("5.</C80-{0}*{1}/>",
                                                           boleto.TicketNumber,
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[0]).Information.DepartureStation + "." +
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[0]).Information.ArrivalStation + "." +
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[1]).Information.ArrivalStation);

                            InterjetQualityControleEighty.c80.Add(quality);
                        }

                        string commandt = command.Trim();
                        commands.Add("" + commandt + "");

                        if (this.Ticket.Passangers.GetInfants().Count > 0 && infante <= this.Ticket.Passangers.GetInfants().Count &&
                            PriceTotalResponseInterjet.totalPriceInfant > 0)
                        {
                            string command2 = string.Format("AC/4o/{0}/P01/{1}/{2}/d{3}/D{7}/ONE/{4} {5}/1/{6}/E-V-4o/P-SAL",
                                                            "88" + boleto.TicketNumber.Substring(2, 8),
                                                            decimal.Truncate(PriceTotalResponseInterjet.totalPriceInfant * 100),
                                                            decimal.Truncate(0),
                                                            decimal.Truncate(0),
                                                            this.Ticket.PaymentForm,
                                                            pax.AccountLineParameter,
                                                            theFlight.IsInternational ? "F" : "D",
                                                            decimal.Truncate(0));

                            string commandt2 = command2.Trim();
                            commands.Add("" + commandt2 + "");
                            infante++;
                        }


                        //quitar
                        comando = comando + commandt;
                        decimal C11 = adultCountingLine.TotalBasePriceSum + adultCountingLine.TotalIVASuma + adultCountingLine.TotalTuaSum + adultCountingLine.TotalExtraSum;
                        amountC11[cont] = amountC11[cont] + C11;
                        amountC16[cont] = amountC16[cont] + adultCountingLine.TotalBasePriceSum;
                        cont++;
                    }
                }

                if (this.Ticket.Passangers.HasChildren)
                {
                    var childCountingLine = new
                    {
                        TotalBasePriceSum = (flights.Sum(flight => flight.PriceDetail.Child.BasePrice - flight.PriceDetail.Child.Discount) / Ticket.Passangers.TotalChildren) * 100,
                        TotalTuaSum       = (flights.Sum(flight => flight.PriceDetail.Child.TUA) / Ticket.Passangers.TotalChildren) * 100,
                        TotalIVASuma      = (flights.Sum(flight => flight.PriceDetail.Child.IVA) / Ticket.Passangers.TotalChildren) * 100,
                        TotalExtraSum     = (flights.Sum(flight => flight.PriceDetail.Child.TotalExtraTaxes) / Ticket.Passangers.TotalChildren) * 100
                    };

                    foreach (InterJetChildPassanger pax in this.Ticket.Passangers.GetChildrenPassangers())
                    {
                        if (this.Ticket.PaymentForm.StartsWith("CCA3"))
                        {
                            this.Ticket.PaymentForm = this.Ticket.PaymentForm.Replace("CCA3", "CCAX");
                        }

                        boleto = LogTicketsBL.LogTicketsInterjet(pax.UniqueID + currentFlightID[1]);
                        if (!string.IsNullOrEmpty(boleto.TicketNumber))
                        {
                            NewTicketInterjet(boleto.TicketNumber);
                        }
                        else
                        {
                            boleto.TicketNumber = pax.UniqueID + currentFlightID[1];
                        }

                        LogTicketsBL.LogTicketsInterjetInsert(boleto.TicketNumber, DateTime.Now, Ticket.RecordLocator, string.Empty);

                        string command = string.Format(InterJetAddAccountingLineCommand.ACCOUNT_LINE_STRING_TEMPLATE,
                                                       boleto.TicketNumber,
                                                       decimal.Truncate(childCountingLine.TotalBasePriceSum),
                                                       decimal.Truncate(childCountingLine.TotalTuaSum),
                                                       decimal.Truncate(childCountingLine.TotalIVASuma),
                                                       this.Ticket.PaymentForm,
                                                       pax.AccountLineParameter,
                                                       theFlight.IsInternational ? "F" : "D",
                                                       decimal.Truncate(childCountingLine.TotalExtraSum));

                        if (ListTaxesInterjet.Conexion)
                        {
                            string quality = string.Format("5.</C80-{0}*{1}/>",
                                                           boleto.TicketNumber,
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[0]).Information.DepartureStation + "." +
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[0]).Information.ArrivalStation + "." +
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[1]).Information.ArrivalStation);

                            InterjetQualityControleEighty.c80.Add(quality);
                        }

                        commands.Add(command);
                        comando = comando + " " + command;

                        decimal C11 = childCountingLine.TotalBasePriceSum + childCountingLine.TotalIVASuma + childCountingLine.TotalTuaSum + childCountingLine.TotalExtraSum;
                        amountC11[cont] = amountC11[cont] + C11;
                        amountC16[cont] = amountC16[cont] + childCountingLine.TotalBasePriceSum;
                        cont++;
                    }
                }

                if (this.Ticket.Passangers.HasSeniorAdult)
                {
                    var SeniorCountingLine = new
                    {
                        TotalBasePriceSum = (flights.Sum(flight => (flight.PriceDetail.Senior.BasePrice - flight.PriceDetail.Senior.Discount)) / Ticket.Passangers.TotalSenior) * 100,
                        TotalTuaSum       = (flights.Sum(flight => flight.PriceDetail.Senior.TUA) / Ticket.Passangers.TotalSenior) * 100,
                        TotalIVASuma      = (flights.Sum(flight => flight.PriceDetail.Senior.IVA) / Ticket.Passangers.TotalSenior) * 100,
                        TotalExtraSum     = (flights.Sum(flight => flight.PriceDetail.Senior.TotalExtraTaxes) / Ticket.Passangers.TotalSenior) * 100
                    };

                    foreach (InterJetSeniorAdultPassanger pax in this.Ticket.Passangers.GetSeniorAdultsPassangers())
                    {
                        if (this.Ticket.PaymentForm.StartsWith("CCA3"))
                        {
                            this.Ticket.PaymentForm = this.Ticket.PaymentForm.Replace("CCA3", "CCAX");
                        }

                        boleto = LogTicketsBL.LogTicketsInterjet(pax.UniqueID + currentFlightID[1]);
                        if (!string.IsNullOrEmpty(boleto.TicketNumber))
                        {
                            NewTicketInterjet(boleto.TicketNumber);
                        }
                        else
                        {
                            boleto.TicketNumber = pax.UniqueID + currentFlightID[1];
                        }

                        LogTicketsBL.LogTicketsInterjetInsert(boleto.TicketNumber, DateTime.Now, Ticket.RecordLocator, string.Empty);

                        string command = string.Format(InterJetAddAccountingLineCommand.ACCOUNT_LINE_STRING_TEMPLATE,
                                                       boleto.TicketNumber,
                                                       decimal.Truncate(SeniorCountingLine.TotalBasePriceSum),
                                                       decimal.Truncate(SeniorCountingLine.TotalTuaSum),
                                                       decimal.Truncate(SeniorCountingLine.TotalIVASuma),
                                                       this.Ticket.PaymentForm,
                                                       pax.AccountLineParameter,
                                                       theFlight.IsInternational ? "F" : "D",
                                                       decimal.Truncate(SeniorCountingLine.TotalExtraSum));

                        if (ListTaxesInterjet.Conexion)
                        {
                            string quality = string.Format("5.</C80-{0}*{1}/>",
                                                           boleto.TicketNumber,
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[0]).Information.DepartureStation + "." +
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[0]).Information.ArrivalStation + "." +
                                                           ((Entities.InterJetSegment)theFlight.Segments.GetAll()[1]).Information.ArrivalStation);

                            InterjetQualityControleEighty.c80.Add(quality);
                        }


                        commands.Add(command);
                        comando = comando + " " + command;

                        decimal C11 = SeniorCountingLine.TotalBasePriceSum + SeniorCountingLine.TotalIVASuma + SeniorCountingLine.TotalTuaSum + SeniorCountingLine.TotalExtraSum;
                        amountC11[cont] = amountC11[cont] + C11;
                        amountC16[cont] = amountC16[cont] + SeniorCountingLine.TotalBasePriceSum;
                        cont++;
                    }
                }
            }
            //quitar
            ImpuestosBajoCosto.LineaContable = comando;
            ImpuestosBajoCostoBL.UpdateImpuestosBajoCosto(ImpuestosBajoCosto.Id, ImpuestosBajoCosto.ImpuestosObtenidos, ImpuestosBajoCosto.PNRBajoCosto, ImpuestosBajoCosto.ImpuestosMostrados, ImpuestosBajoCosto.LineaContable, string.Empty);
            return(commands.ToArray());
        }