Esempio n. 1
0
            public String FechaToTextSQL(DateTime Fecha)
            {
                String strD = LeftRightMid.Right("0" + Fecha.Day.ToString(), 2);
                String strM = LeftRightMid.Right("0" + Fecha.Month.ToString(), 2);
                String strY = Fecha.Year.ToString();

                return(strY + strM + strD);
            }
Esempio n. 2
0
        private int secondsSinceMidnight()
        {
            string tmpStr            = DateTime.Now.ToString("HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
            int    hour              = Convert.ToInt32(LeftRightMid.Left(tmpStr, 2));
            int    mins              = Convert.ToInt32(LeftRightMid.Mid(tmpStr, 3, 2));
            int    secs              = Convert.ToInt32(LeftRightMid.Right(tmpStr, 2));
            int    secsSinceMidnight = (hour * 3600) + (mins * 60) + secs;

            return(secsSinceMidnight);
        }
Esempio n. 3
0
            private static string AlineaTexto(string Texto, int Tamaño, bool Justificar, string NamePrinter)
            {
                string Todo, Linea, Parte, TextoReal;
                int    Desde, Hasta, Previo, Posicion, Intro;
                bool   Insertar, HayBlancos;

                char[] charsToTrim = { ' ' };
                Todo = Texto.Trim(charsToTrim) + " ";

                // si no biene datos regresamos espacio
                if (Texto.Length == 0)
                {
                    return("");
                }


                TieneIntros :;
                TextoReal = "";

                Intro = Todo.IndexOf('/');

                if (Intro >= 0)
                {
                    Parte = LeftRightMid.Left(Todo, Intro - 1);
                    Todo  = LeftRightMid.Mid(Todo, Intro + 2, Todo.Length - (Intro + 2));
                    Linea = Parte + "\n" + Todo;
                    RawPrinterHelper.SendStringToPrinter(NamePrinter, Linea); // imprime texto
                    goto TieneIntros;
                }

                Previo = 1;
                do
                {
                    if (Todo.IndexOf(" ", 0) < 0)
                    {
                        TextoReal = TextoReal + Todo + "\n";
                    }
                    Desde = 1;
                    MasAun :;
                    Hasta = Todo.IndexOf(' ', Desde) + 1;

                    if (LeftRightMid.Left(Todo, Hasta).Length < Tamaño)
                    {
                        Previo = Hasta;       //'El último corte que encaja en el ancho
                        Desde  = Hasta + 1;
                        if (Hasta < Todo.Length)
                        {
                            goto MasAun;
                        }
                    }

                    char[] espacio = { ' ' };
                    Linea = (LeftRightMid.Left(Todo, Previo - 1).Trim(espacio));
                    Todo  = LeftRightMid.Mid(Todo, Previo, Todo.Length - (Previo));

                    //si no quiere justicicar saltamo
                    if (Justificar == false)
                    {
                        goto ExitWile;
                    }
                    Ajustar :;

                    Posicion = 1;
                    if (Linea.IndexOf(' ') >= 0)
                    {
                        HayBlancos = true;
                    }
                    else
                    {
                        HayBlancos = false;
                    }

                    Insertar = false;

                    do
                    {
                        string buscar = LeftRightMid.Mid(Linea, Posicion - 1, 1);
                        if (buscar.IndexOf(" ", 0) < 0)
                        {
                            Insertar = true;
                        }
                        else
                        {
                            if (Insertar == true)
                            {
                                Linea    = LeftRightMid.Left(Linea, Posicion) + " " + LeftRightMid.Mid(Linea, Posicion, (Linea.Length - Posicion));
                                Insertar = false;
                            }
                        }
                        Posicion = Posicion + 1;
                    } while (!((HayBlancos == false) || (Linea.Length >= Tamaño) || (Posicion == Linea.Length)));

                    if (Linea.Length < Tamaño && HayBlancos && Todo.Length > 0)
                    {
                        goto Ajustar;
                    }
                    ExitWile :;
                    Linea += "\n";
                    RawPrinterHelper.SendStringToPrinter(NamePrinter, Linea); // imprime texto
                } while (Todo.IndexOf(" ", 0) >= 0);
                return(TextoReal);
            }