Esempio n. 1
0
        private void NewTicketVolais(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.LogTicketsVolaris(newTicket);
            if (!string.IsNullOrEmpty(boleto.TicketNumber))
            {
                NewTicketVolais(boleto.TicketNumber);
            }
            else
            {
                boleto.TicketNumber = newTicket;
            }
        }
        public LogTickets LogTicketsVolaris(string ticketNumber, string connectionName)
        {
            Database  db        = DatabaseFactory.CreateDatabase(connectionName);
            DbCommand dbCommand = db.GetStoredProcCommand(Resources.LogTicketsResources.SP_GetLogTicketsVolaris);

            db.AddInParameter(dbCommand, Resources.LogTicketsResources.PARAM_TicketNumber, DbType.String, ticketNumber);
            LogTickets item = new LogTickets();

            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                while (dr.Read())
                {
                    int _ticketNumber = dr.GetOrdinal(Resources.LogTicketsResources.PARAM_GetTicketNumber);
                    item.TicketNumber = (dr[_ticketNumber] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_ticketNumber);
                }
            }
            return(item);
        }
        public static LogTickets LogTicketsVolaris(string ticketNumber)
        {
            LogTicketsDAL objLogApplication = new LogTicketsDAL();
            LogTickets    obj = new LogTickets();

            try
            {
                try
                {
                    obj = objLogApplication.LogTicketsVolaris(ticketNumber, CommonENT.MYCTSDB_CONNECTION);
                }
                catch (Exception ex)
                {
                    new EventsManager.EventsManager(ex, EventsManager.EventsManager.OrigenError.BaseDeDatos);
                    obj = objLogApplication.LogTicketsVolaris(ticketNumber, CommonENT.MYCTSDBBACKUP_CONNECTION);
                }
            }
            catch
            { }
            return(obj);
        }
Esempio n. 4
0
        private string[] GetSabreCommandVolaris(List <VolarisFlight> flights)
        {
            int infante = 1;

            if (VolarisSession.PagoVolaris.MetodoDePago == "MC")
            {
                VolarisSession.PagoVolaris.MetodoDePago = "CA";
            }
            VolarisSession.ContAdult          = VolarisSession.contAdult;
            VolarisSession.BaseTotalPayAdult  = 0;
            VolarisSession.IVATotalPayAdult   = 0;
            VolarisSession.TUATotalPayAdult   = 0;
            VolarisSession.OtrosTotalPayAdult = 0;

            VolarisSession.BaseTotalPayAdult  = (VolarisSession.baseTotalPayAdult * VolarisSession.contAdult);
            VolarisSession.IVATotalPayAdult   = (VolarisSession.ivaTotalPayAdult * VolarisSession.contAdult);
            VolarisSession.TUATotalPayAdult   = (VolarisSession.tuaTotalPayAdult * VolarisSession.contAdult);
            VolarisSession.OtrosTotalPayAdult = (VolarisSession.otrosTotalPayAdult * VolarisSession.contAdult);
            VolarisSession.AdditionalAdult    = VolarisSession.additionalAdult;
            //quitar
            string comando = string.Empty;

            var commands = new List <string>();

            for (int i = 0; i < flights.Count; i++)
            {
                string        currentFlightID = "0" + 1;
                VolarisFlight theFlight       = flights.FirstOrDefault();

                if (VolarisSession.ContAdult > 0)
                {
                    var adultCountingLine = new
                    {
                        TotalBasePriceSum = ((VolarisSession.BaseTotalPayAdult - VolarisSession.DiscountTotalPayAdult) / VolarisSession.ContAdult),
                        TotalIVASuma      = (VolarisSession.IVATotalPayAdult / VolarisSession.ContAdult),
                        TotalTuaSum       = (VolarisSession.TUATotalPayAdult / VolarisSession.ContAdult),
                        TotalExtraSum     = (VolarisSession.OtrosTotalPayAdult / VolarisSession.ContAdult)
                    };
                    foreach (InterJetPassanger pax in VolarisSession.InterJetPassangers)
                    {
                        if (pax.IsAdult)
                        {
                            //boleto = LogTicketsBL.LogTicketsVolaris("7916309061"); //solo para pruebas
                            boleto = LogTicketsBL.LogTicketsVolaris(pax.UniqueID + currentFlightID[1]);
                            if (!string.IsNullOrEmpty(boleto.TicketNumber))
                            {
                                NewTicketVolais(boleto.TicketNumber);
                            }
                            else
                            {
                                boleto.TicketNumber = pax.UniqueID + currentFlightID[1];
                            }

                            LogTicketsBL.LogTicketsVolarisInsert(boleto.TicketNumber, DateTime.Now, VolarisSession.PNR, string.Empty);

                            string command = string.Format("AC/Y4/{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),
                                                           "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                           pax.AccountLineParameter,
                                                           VolarisSession.IsInternational ? "F" : "D",
                                                           decimal.Truncate(
                                                               adultCountingLine.TotalExtraSum));
                            string commandt = command.Trim();
                            commands.Add("" + commandt + "");
                            //quitar la linea
                            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++;
                            foreach (AdditionalAccountingLine add in VolarisSession.AdditionalAdult)
                            {
                                if (add.Description == "11" && add.Amount > 0)
                                {
                                    string command11Percent = string.Format("AC/Y4/{0}/P0/{1}/{2}/D{3}/D{7}/ONE/{4} {5}/1/{6}/E-V-Y4/P-SAL",
                                                                            string.Format("{0}{1}", "88", boleto.TicketNumber.Substring(2, 8)),
                                                                            decimal.Truncate((add.Amount * 100)),
                                                                            decimal.Truncate(0),
                                                                            decimal.Truncate((add.Iva * 100)),
                                                                            "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                                            pax.AccountLineParameter,
                                                                            VolarisSession.IsInternational ? "F" : "D",
                                                                            decimal.Truncate(0));
                                    commands.Add(command11Percent);
                                    comando = comando + "  " + command11Percent;
                                }
                                if (add.Description == "16" && add.Amount > 0)
                                {
                                    string command16Percent = string.Format("AC/Y4/{0}/P0/{1}/{2}/D{3}/D{7}/ONE/{4} {5}/1/{6}/E-V-Y4/P-SAL",
                                                                            string.Format("{0}{1}", "99", boleto.TicketNumber.Substring(2, 8)),
                                                                            decimal.Truncate((add.Amount * 100)),
                                                                            decimal.Truncate(0),
                                                                            decimal.Truncate((add.Iva * 100)),
                                                                            "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                                            pax.AccountLineParameter,
                                                                            VolarisSession.IsInternational ? "F" : "D",
                                                                            decimal.Truncate(0));
                                    commands.Add(command16Percent);
                                    comando = comando + "  " + command16Percent;
                                }

                                if (VolarisSession.ContInfant > 0 && infante <= VolarisSession.ContInfant)
                                {
                                    string command11Percent = string.Format("AC/Y4/{0}/P0/{1}/{2}/D{3}/D{7}/ONE/{4} {5}/1/{6}/E-V-Y4/P-SAL",
                                                                            string.Format("{0}{1}", "88", boleto.TicketNumber.Substring(2, 8)),
                                                                            decimal.Truncate(((VolarisSession.Extra / VolarisSession.ContInfant) * 100)),
                                                                            decimal.Truncate(0),
                                                                            decimal.Truncate((0)),
                                                                            "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                                            pax.AccountLineParameter,
                                                                            VolarisSession.IsInternational ? "F" : "D",
                                                                            decimal.Truncate(0));
                                    commands.Add(command11Percent);
                                    comando = comando + "  " + command11Percent;
                                    infante++;
                                }
                            }
                        }
                    }
                }

                if (VolarisSession.ContChild > 0)
                {
                    VolarisSession.ContChild          = VolarisSession.contChild;
                    VolarisSession.BaseTotalPayChild  = 0;
                    VolarisSession.IVATotalPayChild   = 0;
                    VolarisSession.TUATotalPayChild   = 0;
                    VolarisSession.OtrosTotalPayChild = 0;

                    VolarisSession.BaseTotalPayChild  = (VolarisSession.baseTotalPayChild * VolarisSession.ContChild);
                    VolarisSession.IVATotalPayChild   = (VolarisSession.ivaTotalPayChild * VolarisSession.ContChild);
                    VolarisSession.TUATotalPayChild   = (VolarisSession.tuaTotalPayChild * VolarisSession.ContChild);
                    VolarisSession.OtrosTotalPayChild = (VolarisSession.otrosTotalPayChild * VolarisSession.ContChild);
                    VolarisSession.AdditionalChild    = VolarisSession.additionalChild;


                    var childCountingLine = new
                    {
                        TotalBasePriceSum = ((VolarisSession.BaseTotalPayChild - VolarisSession.DiscountTotalPayChild) / VolarisSession.ContChild),
                        TotalIVASuma      = (VolarisSession.IVATotalPayChild / VolarisSession.ContChild),
                        TotalTuaSum       = (VolarisSession.TUATotalPayChild / VolarisSession.ContChild),
                        TotalExtraSum     = (VolarisSession.OtrosTotalPayChild / VolarisSession.ContChild)
                    };

                    foreach (InterJetPassanger pax in VolarisSession.InterJetPassangers)
                    {
                        if (pax.IsChild)
                        {
                            boleto = LogTicketsBL.LogTicketsVolaris(pax.UniqueID + currentFlightID[1]);
                            if (!string.IsNullOrEmpty(boleto.TicketNumber))
                            {
                                NewTicketVolais(boleto.TicketNumber);
                            }
                            else
                            {
                                boleto.TicketNumber = pax.UniqueID + currentFlightID[1];
                            }

                            LogTicketsBL.LogTicketsVolarisInsert(boleto.TicketNumber, DateTime.Now, VolarisSession.PNR, string.Empty);

                            string command = string.Format(InterJetAddAccountingLineCommand.ACCOUNT_LINE_STRING_TEMPLATE_VOLARIS,
                                                           boleto.TicketNumber,
                                                           decimal.Truncate(childCountingLine.TotalBasePriceSum),
                                                           decimal.Truncate(childCountingLine.TotalTuaSum),
                                                           decimal.Truncate(childCountingLine.TotalIVASuma),
                                                           "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                           pax.AccountLineParameter,
                                                           VolarisSession.IsInternational ? "F" : "D",
                                                           decimal.Truncate(childCountingLine.TotalExtraSum));
                            commands.Add(command);
                            decimal C11 = childCountingLine.TotalBasePriceSum + childCountingLine.TotalIVASuma + childCountingLine.TotalTuaSum + childCountingLine.TotalExtraSum;
                            amountC11[cont] = amountC11[cont] + C11;
                            amountC16[cont] = amountC16[cont] + childCountingLine.TotalBasePriceSum;
                            cont++;
                            //quitar la linea
                            comando = comando + "  " + command;

                            foreach (AdditionalAccountingLine add in VolarisSession.AdditionalChild)
                            {
                                if (add.Description == "11" && add.Amount > 0)
                                {
                                    string command11Percent = string.Format("AC/Y4/{0}/P0/{1}/{2}/D{3}/D{7}/ONE/{4} {5}/1/{6}/E-V-Y4/P-SAL",
                                                                            string.Format("{0}{1}", "88", boleto.TicketNumber.Substring(2, 8)),
                                                                            decimal.Truncate((add.Amount * 100)),
                                                                            decimal.Truncate(0),
                                                                            decimal.Truncate((add.Iva * 100)),
                                                                            "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                                            pax.AccountLineParameter,
                                                                            VolarisSession.IsInternational ? "F" : "D",
                                                                            decimal.Truncate(0));
                                    commands.Add(command11Percent);
                                    comando = comando + "  " + command11Percent;
                                }
                                if (add.Description == "16" && add.Amount > 0)
                                {
                                    string command16Percent = string.Format("AC/Y4/{0}/P0/{1}/{2}/D{3}/D{7}/ONE/{4} {5}/1/{6}/E-V-Y4/P-SAL",
                                                                            string.Format("{0}{1}", "99", boleto.TicketNumber.Substring(2, 8)),
                                                                            decimal.Truncate((add.Amount * 100)),
                                                                            decimal.Truncate(0),
                                                                            decimal.Truncate((add.Iva * 100)),
                                                                            "CC" + VolarisSession.PagoVolaris.MetodoDePago + VolarisSession.PagoVolaris.NumeroTarjeta,
                                                                            pax.AccountLineParameter,
                                                                            VolarisSession.IsInternational ? "F" : "D",
                                                                            decimal.Truncate(0));
                                    commands.Add(command16Percent);
                                    comando = comando + "  " + command16Percent;
                                }
                            }
                        }
                    }
                }
            }
            //quitar
            ImpuestosBajoCosto.LineaContable = comando;
            ImpuestosBajoCostoBL.UpdateImpuestosBajoCosto(ImpuestosBajoCosto.Id, ImpuestosBajoCosto.ImpuestosObtenidos, VolarisSession.PNR, ImpuestosBajoCosto.ImpuestosMostrados, ImpuestosBajoCosto.LineaContable, string.Empty);
            return(commands.ToArray());
        }
Esempio n. 5
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());
        }
        public async Task <int> GetTicketsByFetch()
        {
            using var dbContextTransaction = _db.Database.BeginTransaction();
            try
            {
                int result;
                var dt           = DateTime.UtcNow;
                var strStartTime = dt.AddSeconds(-30).ToString("yyyy-MM-dd HH:mm:ss");
                var strEndTime   = dt.ToString("yyyy-MM-dd HH:mm:ss");



                var data = await _intergration.GetTicketsByFetch(strStartTime, strEndTime);

                if (data.Success == true)
                {
                    if (data.Result.Tickets.Length > 0)
                    {
                        foreach (var ticket in data.Result.Tickets)
                        {
                            var userfound  = _db.MstUserGameAccount.Where(x => x.GameId == ticket.MemberName).FirstOrDefault();
                            var userwallet = _db.MstUserWallet.Where(x => x.MemberSrno == userfound.MemberSrno).FirstOrDefault();

                            var log_tickets = new LogTickets
                            {
                                MemberSrno      = userfound.MemberSrno,
                                TicketSessionId = ticket.TicketSessionID,
                                TicketId        = ticket.TicketID,
                                GameType        = ticket.GameType,
                                RoundId         = ticket.RoundID,
                                Stake           = ticket.Stake,
                                StakeMoney      = ticket.StakeMoney,
                                Result          = ticket.Result,
                                Currency        = ticket.Currency,
                                StatementDate   = Convert.ToDateTime(ticket.StatementDate),
                                PlayerWinLoss   = ticket.PlayerWinLoss,
                                Vendor          = ticket.Vendor,
                                Product         = ticket.Product,
                                CreatedDateTime = DateTime.Now,
                            };

                            var winlose = new MstWinlose
                            {
                                MemberSrno      = userfound.MemberSrno,
                                WinloseAmount   = ticket.PlayerWinLoss,
                                StakeAmount     = ticket.StakeMoney,
                                Vendor          = ticket.Vendor,
                                Currency        = ticket.Currency,
                                GameType        = ticket.GameType,
                                Product         = ticket.Product,
                                CreatedDateTime = DateTime.Now,
                            };

                            if (userwallet.TurnoverAmount > 0)
                            {
                                if (Math.Abs(ticket.PlayerWinLoss) > userwallet.TurnoverAmount)
                                {
                                    userwallet.TurnoverAmount = 0;
                                }
                                else
                                {
                                    userwallet.TurnoverAmount -= Math.Abs(ticket.PlayerWinLoss);
                                }
                            }


                            if (userwallet.TwelveTurnoverAmount > 0)
                            {
                                if (Math.Abs(ticket.PlayerWinLoss) > userwallet.TwelveTurnoverAmount)
                                {
                                    userwallet.TwelveTurnoverAmount = 0;
                                }
                                else
                                {
                                    userwallet.TwelveTurnoverAmount -= Math.Abs(ticket.PlayerWinLoss);
                                }
                            }


                            _db.MstWinlose.Add(winlose);
                            _db.LogTickets.Add(log_tickets);
                            await _db.SaveChangesAsync();
                        }
                    }


                    dbContextTransaction.Commit();
                    result = Models_General.SUCC_GET_TICKETS;
                    return(result);
                }


                dbContextTransaction.Rollback();
                return(Models_General.ERR_GET_TICKETS);
            }
            catch (Exception ex)
            {
                dbContextTransaction.Rollback();

                var new_error = new LogErrorSystem
                {
                    Title           = "Get Tickets By Fetch",
                    Details         = ex.Message + "/" + ex.StackTrace,
                    Context         = _accessor.ActionContext.HttpContext.Connection.RemoteIpAddress.ToString(),
                    CreatedDateTime = DateTime.Now,
                };
                _db.LogErrorSystem.Add(new_error);
                _db.SaveChanges();
                return(Models_General.ERR_SERVER_BUSY_INTERNAL_ERROR);
            }
        }