Exemple #1
0
    public static void Log(string log, LogChannel channel, bool includeUp)
    {
        if (logToConsole)
        {
            if (includeUp && ((int)LogManager.channel >= (int)channel))
            {
                Debug.Log(log);
            }
            else if (LogManager.channel == channel)
            {
                Debug.Log(log);
            }
        }

        if (writeToText)
        {
            if (includeUp && ((int)LogManager.channel >= (int)channel))
            {
                TextToFile.WriteToFile(log, debugLog);
            }
            else if (LogManager.channel == channel)
            {
                TextToFile.WriteToFile(log, debugLog);
            }
        }
    }
Exemple #2
0
 public static void Reset(TextType debugLog = TextType.None, string fileName = "", bool colorful = false)
 {
     if (debugLog != TextType.None)
     {
         TextToFile.Reset(debugLog, fileName, colorful);
     }
 }
Exemple #3
0
    public static void Log(string log, LogChannel channel, bool includeUp, LogType logType)
    {
        if (logToConsole)
        {
            if ((includeUp && ((int)LogManager.channel >= (int)channel)) || LogManager.channel == channel)
            {
                if (logType == LogType.Log)
                {
                    Debug.Log(log);
                }
                else if (logType == LogType.Error)
                {
                    Debug.LogError(log);
                }
                else
                {
                    Debug.LogWarning(log);
                }
            }
        }

        if (writeToText)
        {
            if (includeUp && ((int)LogManager.channel >= (int)channel))
            {
                TextToFile.WriteToFile(log, debugLog);
            }
            else if (LogManager.channel == channel)
            {
                TextToFile.WriteToFile(log, debugLog);
            }
        }
    }
Exemple #4
0
        public bool Cargar()
        {
            bool blnRespuesta = false;

            try
            {
                OpenFileDialog fdCargar = new OpenFileDialog();
                fdCargar.InitialDirectory = AccesoDatos.DirBACKUP;
                fdCargar.Title            = "Cargar base de datos...";
                fdCargar.Filter           = "Base de datos(.sdf)|*.sdf";
                if (fdCargar.ShowDialog() == DialogResult.OK)
                {
                    string strBackupOrigen  = fdCargar.FileName;
                    string strBackupDestino = AccesoDatos.DirBD;

                    File.Copy(strBackupOrigen, strBackupDestino, true);
                    blnRespuesta = true;
                }
            }
            catch (Exception ex)
            {
                TextToFile.Errores(TextToFile.Error(ex));
            }
            return(blnRespuesta);
        }
Exemple #5
0
        public bool Resguardar()
        {
            bool blnRespuesta = false;

            try
            {
                string         strFecha       = Validators.FechaParaSaveFile(DateTime.Now.ToString());
                SaveFileDialog sfdGuardarComo = new SaveFileDialog();
                sfdGuardarComo.InitialDirectory = AccesoDatos.DirBD;

                sfdGuardarComo.Title    = "Guardar Back Up de base de datos como...";
                sfdGuardarComo.Filter   = "Base de datos(.sdf)|*.sdf";
                sfdGuardarComo.FileName = "BaseDeDatos_" + strFecha + ".sdf";
                if (sfdGuardarComo.ShowDialog() == DialogResult.OK)
                {
                    string strBackupDestino = sfdGuardarComo.FileName;
                    string strBackupOrigen  = AccesoDatos.DirBD;
                    System.IO.File.Copy(strBackupOrigen, strBackupDestino, sfdGuardarComo.OverwritePrompt);
                    blnRespuesta = true;
                }
            }
            catch (Exception ex)
            {
                TextToFile.Errores(TextToFile.Error(ex));
            }
            return(blnRespuesta);
        }
Exemple #6
0
        public BSP_Ticket GetTicket(string Linea, int Year)
        {
            BSP_Ticket oBSP_Ticket = null;

            try
            {
                oBSP_Ticket         = new BSP_Ticket();
                oBSP_Ticket.Billete = Convert.ToInt64(Linea.Substring(0, 10).Trim());
                oBSP_Ticket.Tipo    = Linea.Substring(13, 4).ToUpper();
                string FechaVenta = Linea.Substring(19, 5).Trim() + "/" + Year.ToString();
                if (Validators.IsDateTime(FechaVenta))
                {
                    oBSP_Ticket.FechaVenta = Convert.ToDateTime(FechaVenta);
                }
                oBSP_Ticket.TarContado = GetTicket_ObtenerDecimal(GetStringByIndex(Linea, 25, 10));
                oBSP_Ticket.TarCredito = GetTicket_ObtenerDecimal(GetStringByIndex(Linea, 35, 12));

                oBSP_Ticket.IVA105        = GetTicket_ObtenerDecimal(GetStringByIndex(Linea, 72, 11));
                oBSP_Ticket.ComPorcentaje = GetTicket_ObtenerDecimal(GetStringByIndex(Linea, 94, 7));
                oBSP_Ticket.ComValor      = GetTicket_ObtenerDecimal(GetStringByIndex(Linea, 101, 9));
                oBSP_Ticket.ComOver       = GetTicket_ObtenerDecimal(GetStringByIndex(Linea, 111, 11));
                oBSP_Ticket.ComIVA        = GetTicket_ObtenerDecimal(GetStringByIndex(Linea, 121, 12));
                oBSP_Ticket.Total         = GetTicket_ObtenerDecimal(GetStringByIndex(Linea, 133, 11));
            }
            catch (Exception ex)
            {
                TextToFile.Errores(TextToFile.Error(ex));
            }
            return(oBSP_Ticket);
        }
Exemple #7
0
        public void Guardar(Semana oSemana, BackgroundWorker backgroundWorker1)
        {
            try
            {
                if (oSemana == null)
                {
                    return;
                }

                using (SqlCeConnection conn = AccesoDatos.OpenConn())
                {
                    Semanas     semanas     = new Semanas(conn);
                    BSP_Tickets bsp_tickets = new BSP_Tickets(conn);
                    if (oSemana.ID > 0)
                    {
                        if (oSemana.TicketsBSP.Count > 0)
                        {
                            bsp_tickets.EliminarPorSemana(oSemana.ID);
                        }
                    }
                    else
                    {
                        semanas.Insertar(oSemana);
                    }

                    BSP_Ticket_Detalles bsp_Ticket_Detalles = new BSP_Ticket_Detalles(conn);
                    int intCont       = 0;
                    int intPorcentaje = 0;
                    foreach (BSP_Ticket Ticket in oSemana.TicketsBSP)
                    {
                        Ticket.SemanaID = oSemana.ID;
                        bsp_tickets.Insertar(Ticket);
                        foreach (BSP_Ticket_Detalle TicketDetalle in Ticket.Detalle)
                        {
                            TicketDetalle.TicketID = Ticket.ID;
                            bsp_Ticket_Detalles.Insertar(TicketDetalle);
                        }
                        intCont++;
                        intPorcentaje = intCont * 100 / oSemana.TicketsBSP.Count;
                        backgroundWorker1.ReportProgress(intPorcentaje, "Guardando BSP... " + intCont + " de " + oSemana.TicketsBSP.Count + " registros guardados.");
                    }
                }
            }
            catch (Exception ex)
            {
                TextToFile.Errores(TextToFile.Error(ex));
            }
        }
Exemple #8
0
    public static void Log(string log, LogChannel channel, bool includeUp, LogType logType, bool controlByInside, bool isWriteToText, bool isLogToConsole, LogColor logColor = LogColor.none)
    {
        if (controlByInside)
        {
            isWriteToText  = writeToText;
            isLogToConsole = logToConsole;
            includeUp      = LogManager.includeUp;
        }


        if (isLogToConsole)
        {
            if ((includeUp && ((int)LogManager.channel >= (int)channel)) || LogManager.channel == channel)
            {
                if (logColor != LogColor.none)
                {
                    log = string.Format(colorMap [logColor], log);
                }
                if (logType == LogType.Log)
                {
                    Debug.Log(log);
                }
                else if (logType == LogType.Error)
                {
                    Debug.LogError(log);
                }
                else
                {
                    Debug.LogWarning(log);
                }
            }
        }

        if (writeToText)
        {
            log = string.Format("{0}. {1}", lineNum, log);
            lineNum++;
            if (includeUp && ((int)LogManager.channel >= (int)channel))
            {
                TextToFile.WriteToFile(log, debugLog);
            }
            else if (LogManager.channel == channel)
            {
                TextToFile.WriteToFile(log, debugLog);
            }
        }
    }
Exemple #9
0
        public BSP_Ticket_Detalle GetTicketDetalle(string Linea)
        {
            BSP_Ticket_Detalle oBSP_Ticket_Detalle = new BSP_Ticket_Detalle();

            try
            {
                oBSP_Ticket_Detalle.ISO           = Linea.Substring(49, 2).Trim();
                oBSP_Ticket_Detalle.ImpContado    = GetTicket_ObtenerDecimal(GetStringByIndex(Linea, 52, 9));
                oBSP_Ticket_Detalle.ImpCredito    = GetTicket_ObtenerDecimal(GetStringByIndex(Linea, 61, 11));
                oBSP_Ticket_Detalle.IVA21         = GetTicket_ObtenerDecimal(GetStringByIndex(Linea, 83, 12));
                oBSP_Ticket_Detalle.Observaciones = GetStringByIndex(Linea, 144, 20).Trim();
            }
            catch (Exception ex)
            {
                TextToFile.Errores(TextToFile.Error(ex));
            }
            return(oBSP_Ticket_Detalle);
        }
Exemple #10
0
        public void BSP_ReadPdfFile_Cabecera(string fileName)
        {
            int     page = 0, index = 0;
            string  currentText   = "";
            int     paginaInicial = 0;
            int     IDAgencia     = 0;
            Agencia oAgencia      = null;
            Semana  oSemanaAux    = null;

            try
            {
                pageStart      = 0;
                semanaToImport = null;
                if (File.Exists(fileName))
                {
                    PdfReader pdfReader = new PdfReader(fileName);
                    Agencias  agencias  = new Agencias();
                    for (page = 1; page <= pdfReader.NumberOfPages && paginaInicial == 0; page++)
                    {
                        currentText = "";
                        currentText = PdfTextExtractor.GetTextFromPage(pdfReader, page, new SimpleTextExtractionStrategy());
                        currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(currentText)));

                        string[] arrLineas = currentText.Split(new char[] { '\n' });
                        if (BSPActions.EsAnalisisDeVenta(ref arrLineas))
                        {
                            string Linea4     = arrLineas[4];
                            string strAgencia = Linea4.Substring(Linea4.IndexOf("LIQUIDACION DE :") + ("LIQUIDACION DE :").Length, 70).Trim();
                            if (int.TryParse(strAgencia.Substring(0, strAgencia.IndexOf(" ") + 2).Replace(" ", ""), out IDAgencia))
                            {
                                oAgencia = agencias.GetByID(IDAgencia);
                                if (oAgencia == null)
                                {
                                    oAgencia = new Agencia {
                                        ID = IDAgencia, Nombre = strAgencia.Substring(11)
                                    };
                                    agencias.Insertar(oAgencia);
                                }

                                string Linea2 = arrLineas[2];
                                string Linea3 = arrLineas[3];
                                oSemanaAux = new Semana
                                {
                                    Periodo    = Convert.ToDateTime(Linea2.Substring(Linea2.LastIndexOf("PERIODO: ") + ("PERIODO: ").Length, 10).Trim()),
                                    FechaDesde = Convert.ToDateTime(Linea3.Substring(Linea3.LastIndexOf("DEL: ") + ("DEL: ").Length, 8).Trim()),
                                    FechaHasta = Convert.ToDateTime(Linea3.Substring(Linea3.LastIndexOf("AL ") + ("AL ").Length, 8).Trim()),
                                    Agencia    = oAgencia
                                };

                                if (Publics.Semana != null && Publics.Semana.Agencia.ID == oSemanaAux.Agencia.ID && Publics.Semana.Periodo == oSemanaAux.Periodo)
                                {
                                    oSemanaAux.ID         = Publics.Semana.ID;
                                    oSemanaAux.BSPCargado = Publics.Semana.BSPCargado;
                                    oSemanaAux.BOCargado  = Publics.Semana.BOCargado;
                                    oSemanaAux.TicketsBO  = Publics.Semana.TicketsBO;
                                }
                                else
                                {
                                    Semanas semanas      = new Semanas();
                                    Semana  oSemanaVerif = semanas.GetByAgenciaPeriodo(oSemanaAux.Agencia.ID, oSemanaAux.Periodo);
                                    semanas.CloseConnection();

                                    if (oSemanaVerif != null)
                                    {
                                        oSemanaAux.ID         = oSemanaVerif.ID;
                                        oSemanaAux.BSPCargado = oSemanaVerif.BSPCargado;
                                        if (oSemanaVerif.BOCargado)
                                        {
                                            oSemanaAux.BOCargado = true;
                                            BO_Tickets BO_Tickets = new BO_Tickets();
                                            oSemanaAux.TicketsBO = BO_Tickets.ObtenerPorSemana(oSemanaAux.ID);
                                            BO_Tickets.CloseConnection();
                                        }
                                    }
                                }

                                paginaInicial = page;
                            }
                        }
                    }
                    agencias.CloseConnection();
                }
            }
            catch (Exception Exception1)
            {
                TextToFile.Errores(TextToFile.Error(Exception1));
                MessageBox.Show("Error: " + Exception1.Message + "\nfileName: " + fileName + "\npage: " + page + "\nline: " + index, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //Semana actual: Semana del archivo seleccionado.
            semanaToImport = oSemanaAux;
            pageStart      = paginaInicial;
        }
Exemple #11
0
        public void BSP_ReadPdfFile(string fileName)
        {
            int    page = 0, index = 0;
            string currentText = "";

            BSP_Ticket         oBSP_Ticket         = null;
            BSP_Ticket_Detalle oBSP_Ticket_Detalle = null;

            Companias       companias          = new Companias();
            List <Compania> lstCompanias       = companias.GetAll();
            Compania        oCompaniaActual    = null;
            string          strFinCompania     = "";
            List <Compania> lstNuevasCompanias = new List <Compania>();

            Conceptos       conceptos       = new Conceptos();
            List <Concepto> lstConceptos    = conceptos.GetAll();
            Concepto        oConceptoActual = null;
            string          strFinConcepto  = "";

            BSP_Rg Tipo       = BSP_Rg.Ambas;
            int    CompaniaID = 0;

            string Linea = "";

            try
            {
                if (File.Exists(fileName))
                {
                    semanaToImport.TicketsBSP = new List <BSP_Ticket>();

                    PdfReader pdfReader = new PdfReader(fileName);
                    for (page = pageStart; page <= pdfReader.NumberOfPages; page++)
                    {
                        currentText = "";
                        currentText = PdfTextExtractor.GetTextFromPage(pdfReader, page, new SimpleTextExtractionStrategy());
                        currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(currentText)));

                        string[] arrLineas = currentText.Split(new char[] { '\n' });
                        if (BSPActions.EsAnalisisDeVenta(ref arrLineas))
                        {
                            string strTipo = arrLineas[3].Substring(21, 30).Trim();
                            Tipo = BSP_Rg.Ambas;
                            if (strTipo == "DOMESTICO")
                            {
                                Tipo = BSP_Rg.Doméstico;
                            }
                            else if (strTipo == "INTERNACIONAL")
                            {
                                Tipo = BSP_Rg.Internacional;
                            }

                            if (Tipo != BSP_Rg.Ambas)                               //Si no estoy en el resumen final
                            {
                                for (index = 10; index < arrLineas.Length; index++) //10: Salteo cabecera
                                {
                                    Linea = arrLineas[index];
                                    if (Linea.Trim() != "")
                                    {
                                        if (oCompaniaActual == null && index == 10 && Linea.Length >= 3 && int.TryParse(Linea.Substring(0, 3), out CompaniaID)) //Si no estoy dentro de una compañía aerea...
                                        {
                                            oCompaniaActual = lstCompanias.Find(x => x.ID == CompaniaID);
                                            if (oCompaniaActual == null)
                                            {
                                                oCompaniaActual = new Compania()
                                                {
                                                    ID = CompaniaID, Nombre = Linea.Substring(4).Trim()
                                                };
                                                companias.Insertar(oCompaniaActual);
                                                lstCompanias.Add(oCompaniaActual);
                                                lstNuevasCompanias.Add(oCompaniaActual);
                                            }
                                            strFinCompania = "TOT " + Linea.Substring(4).Trim();
                                        }
                                        else if (Linea.Length >= strFinCompania.Length && Linea.Substring(0, strFinCompania.Length) == strFinCompania) //Si estoy en el cierre de la compañía aerea...
                                        {
                                            oCompaniaActual = null;
                                        }
                                        else if (oConceptoActual == null) //Si estoy en la compañía aerea y no estoy dentro de un concepto...
                                        {
                                            oConceptoActual = lstConceptos.Find(x => x.Nombre.Length <= Linea.Length && x.Nombre.ToUpper() == Linea.Substring(0, x.Nombre.Length));
                                            if (oConceptoActual != null)
                                            {
                                                strFinConcepto = "TOT " + (oConceptoActual.Nombre.Length >= 21 ? oConceptoActual.Nombre.Substring(0, 21) : oConceptoActual.Nombre).Trim().ToUpper();
                                            }
                                        }
                                        else if (Linea.Length >= strFinConcepto.Length && Linea.Substring(0, strFinConcepto.Length) == strFinConcepto) //Si estoy en la compañía aerea y estoy en el cierre de un concepto
                                        {
                                            oConceptoActual = null;
                                        }
                                        else if (BSPActions.EsNuevoTicket(Linea)) //Si estoy en la compañía aerea y estoy en el concepto, y si los primeros 10 caracteres son long...
                                        {
                                            if (oBSP_Ticket != null)
                                            {
                                                semanaToImport.TicketsBSP.Add(oBSP_Ticket);
                                                oBSP_Ticket = null;
                                            }
                                            oBSP_Ticket          = BSPActions.GetTicket(Linea, semanaToImport.Periodo.Year);
                                            oBSP_Ticket.Concepto = oConceptoActual;
                                            oBSP_Ticket.Compania = oCompaniaActual;
                                            oBSP_Ticket.Rg       = Tipo;

                                            oBSP_Ticket_Detalle = BSPActions.GetTicketDetalle(Linea);

                                            //ACM y ADM
                                            if (listACM != null && oConceptoActual.Tipo == 'C')
                                            {
                                                ACM oACM = listACM.Find(x => x.Billete == oBSP_Ticket.Billete);
                                                if (oACM != null)
                                                {
                                                    oBSP_Ticket_Detalle.Observaciones += (string.IsNullOrEmpty(oBSP_Ticket_Detalle.Observaciones) ? "" : "|") + oACM.Observaciones;
                                                }
                                            }
                                            if (listADM != null && oConceptoActual.Tipo == 'D')
                                            {
                                                ADM oADM = listADM.Find(x => x.Billete == oBSP_Ticket.Billete);
                                                if (oADM != null)
                                                {
                                                    oBSP_Ticket_Detalle.Observaciones += (string.IsNullOrEmpty(oBSP_Ticket_Detalle.Observaciones) ? "" : "|") + oADM.Observaciones;
                                                }
                                            }

                                            oBSP_Ticket.Detalle.Add(oBSP_Ticket_Detalle);
                                            oBSP_Ticket_Detalle = null;
                                        }
                                        else if (oBSP_Ticket != null)
                                        {
                                            oBSP_Ticket_Detalle = BSPActions.GetTicketDetalle(Linea);
                                            oBSP_Ticket.Detalle.Add(oBSP_Ticket_Detalle);
                                            oBSP_Ticket_Detalle = null;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                Linea = arrLineas[10];
                                string strMoneda = Linea.Substring(("MONEDA: ").Length, 3);
                                Moneda Moneda    = strMoneda == "ARS" ? Moneda.Peso : Moneda.Dolar;
                                foreach (BSP_Ticket bsp_ticket in semanaToImport.TicketsBSP.Where(x => x.Moneda == null))
                                {
                                    bsp_ticket.Moneda = Moneda;
                                }
                                if (oBSP_Ticket != null)
                                {
                                    oBSP_Ticket.Moneda = Moneda;
                                }
                            }
                        }
                    }
                    if (oBSP_Ticket != null)
                    {
                        semanaToImport.TicketsBSP.Add(oBSP_Ticket);
                        oBSP_Ticket = null;
                    }
                    semanaToImport.TicketsBSP = semanaToImport.TicketsBSP.OrderBy(x => x.Compania.Codigo).ThenBy(x => x.Billete).ToList();
                    semanaToImport.BSPCargado = true;
                    pdfReader.Close();
                    if (lstNuevasCompanias.Count > 0)
                    {
                        string mensaje = "Se han encontrado Compañías Aéreas que no estaban registradas en el sistema:\n\n";
                        lstNuevasCompanias.ForEach(x => mensaje += "ID: " + x.ID + " | Nombre: " + x.Nombre + "\n");
                        mensaje += "\nÉstas han sido guardadas automáticamente, pero el código alfanumérico deberá ser ingresado manualmente.\n";
                        mensaje += "Por favor, ingrese al \"ABM de Compañías\" y complete la información solicitada.\n";
                        mensaje += "Muchas gracias.";
                        MessageBox.Show(mensaje, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception Exception1)
            {
                TextToFile.Errores(TextToFile.Error(Exception1));
                MessageBox.Show("Error: " + Exception1.Message + "\nfileName: " + fileName + "\npage: " + page + "\nline: " + index, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                companias.CloseConnection();
                conceptos.CloseConnection();
            }
        }
Exemple #12
0
 public static void CloseDegbug()
 {
     TextToFile.CloseDebug();
 }
Exemple #13
0
        public BO_Ticket GetDetalles(ref string Linea, int iLinea, List <Compania> lstCompanias)
        {
            BO_Ticket oBO_Detalle = null;

            try
            {
                Compania oCompaniaActual = null;

                string[] Columnas = Linea.Split(new char[] { ',', ';' });

                oBO_Detalle         = new BO_Ticket();
                oBO_Detalle.IATA    = Convert.ToInt64(GetColumn(Columnas, 0, true));
                oBO_Detalle.Billete = Convert.ToInt64(GetColumn(Columnas, 1, true));

                DateTime dtFecha;
                string   strFecha = GetColumn(Columnas, 2, false);

                /*if (!DateTime.TryParse(strFecha, out dtFecha))
                 *  dtFecha = new DateTime(DateTime.Today.Year, strFecha.Substring(strFecha.IndexOf("-") + 1)
                 * oBO_Detalle.Fecha = dtFecha;*/
                if (DateTime.TryParse(strFecha, out dtFecha))
                {
                    oBO_Detalle.Fecha = dtFecha;
                }

                oBO_Detalle.Void = GetColumn(Columnas, 3, false) == "1";

                string CompaniaCod = GetColumn(Columnas, 4, false);
                oCompaniaActual = lstCompanias.Find(x => x.Codigo == CompaniaCod);
                if (oCompaniaActual != null)
                {
                    oBO_Detalle.Compania = oCompaniaActual;
                }
                else
                {
                    oBO_Detalle.Compania = new Compania {
                        Codigo = CompaniaCod
                    }
                };

                oBO_Detalle.Tarifa     = Convert.ToDecimal(GetColumn(Columnas, 5, true), culture);
                oBO_Detalle.TarContado = Convert.ToDecimal(GetColumn(Columnas, 6, true), culture);
                oBO_Detalle.TarCredito = Convert.ToDecimal(GetColumn(Columnas, 7, true), culture);
                oBO_Detalle.Impuestos  = Convert.ToDecimal(GetColumn(Columnas, 8, true), culture);
                //oBO_Detalle.IVA21 = Convert.ToDecimal(GetColumn(Columnas, 9), culture);
                oBO_Detalle.Comision = Convert.ToDecimal(GetColumn(Columnas, 10, true), culture);
                oBO_Detalle.Total    = Convert.ToDecimal(GetColumn(Columnas, 11, true), culture);
                //oBO_Detalle.Final = Convert.ToDecimal(GetColumn(Columnas, 12), culture);
                oBO_Detalle.ComOver     = Convert.ToDecimal(GetColumn(Columnas, 13, true), culture);
                oBO_Detalle.Expediente  = GetColumn(Columnas, 14, true);
                oBO_Detalle.IVA105      = Convert.ToDecimal(GetColumn(Columnas, 15, true), culture);
                oBO_Detalle.IVAComision = Convert.ToDecimal(GetColumn(Columnas, 16, true), culture);
                oBO_Detalle.ComValor    = Convert.ToDecimal(GetColumn(Columnas, 17, true), culture);
                oBO_Detalle.Factura     = GetColumn(Columnas, 18, true);
                oBO_Detalle.Pasajero    = GetColumn(Columnas, 19, false);
                oBO_Detalle.Vendedor    = GetColumn(Columnas, 20, false);
                oBO_Detalle.Moneda      = Moneda.Peso;
            }
            catch (Exception ex)
            {
                TextToFile.Errores(TextToFile.Error(ex));
            }
            return(oBO_Detalle);
        }
Exemple #14
0
 public void ResetLogPath()
 {
     TextToFile.Reset(TextType.Discrete);
 }
    public void SaveData()
    {
        // Level info for saving to LevelInfo.txt
        var objectiveCopy     = markerPositions.Clone() as int[, ];
        var mirroredObjective = objectiveCopy.Mirror();

        var cubePositionsCopy    = cubePositions.Clone() as int[, ];
        var mirroredCubePosition = cubePositionsCopy.Mirror();

        int[,] currentInfo;

        for (int i = 1; i <= 2; i++)
        {
            currentInfo = i == 1 ? mirroredObjective : mirroredCubePosition;

            for (var line = 0; line < currentInfo.GetLength(0); line++)
            {
                levelInfo += "{ ";
                for (var col = 0; col < currentInfo.GetLength(1); col++)
                {
                    levelInfo += currentInfo[line, col];
                    if (col < currentInfo.GetLength(1) - 1)
                    {
                        levelInfo += ", ";
                    }
                    else
                    {
                        levelInfo += " ";
                    }
                }
                if (line < currentInfo.GetLength(0) - 1)
                {
                    levelInfo += "},\n";
                }
                else
                {
                    levelInfo += "}\n";
                }

                if (line == 0 && i == 1)
                {
                    TextToFile.WriteLine(levelInfo, true, false);
                }
                else if (line == 0 && i == 2)
                {
                    TextToFile.WriteLine(levelInfo, false, true);
                }
                else
                {
                    TextToFile.WriteLine(levelInfo);
                }

                levelInfo = string.Empty;
            }
        }

        TextToFile.WriteLine("Moves left: " + movesLeft, false, true);

        foreach (var i in solverMoveInfo)
        {
            TextToFile.WriteLine(i);
        }

        TextToFile.Write("Colors: ", true);

        /*TextToFile.Write (Constants.ColorsString [colorRange[0]] + ", ", false);
         * for (var i = 1; i < colorRange.Length; i++) {
         *
         *      if (colorCount [i - 1] > 0) {
         *              TextToFile.Write (Constants.ColorsString [colorRange[i]], false);
         *              if (i < colorRange.Length - 1)
         *                      TextToFile.Write (", ", false);
         *      }
         * }*/
    }