Exemplo n.º 1
0
 private int Esquema()
 {
     Datos colores = new Datos("Config.txt");
     string[] config = colores.ObtenerVector("color");
     int color = int.Parse(config[1]);
     return color;
 }
Exemplo n.º 2
0
        public void GenerarReporte(DateTime desde, DateTime hasta, string[] columnas, string formato, string opcion, Datos tipo)
        {
            StreamWriter write = new StreamWriter(rutaReporte);
            List<string[]> todos = tipo.LeerArchivo();
            string separador = "";
            string encabezados = String.Format(formato, columnas);

            foreach (char letra in encabezados)
                separador += "-";

            write.WriteLine("\t Reporte de {0} desde {1} hasta {2}", opcion, desde.ToShortDateString(), hasta.ToShortDateString());
            write.WriteLine();
            write.WriteLine("Reporte generado: {0} - {1}", DateTime.Now.ToLongDateString(), DateTime.Now.ToLongTimeString());
            write.WriteLine();

            write.WriteLine(separador);
            write.WriteLine(encabezados);
            write.WriteLine(separador);

            foreach (string[] fila in todos)
            {
                DateTime fechaAccion = DateTime.Parse(fila[fila.Length - 1]);
                if (desde == hasta)
                    if (fechaAccion == desde)
                        write.WriteLine(String.Format(formato, fila));
                else
                    if ((fechaAccion > desde && fechaAccion < hasta) || (fechaAccion == desde && fechaAccion < hasta) || (fechaAccion > desde && fechaAccion == hasta))
                        write.WriteLine(String.Format(formato, fila));
            }
            write.WriteLine(separador);

            write.Close();
            Process.Start(rutaReporte);
        }
Exemplo n.º 3
0
 public frmMenu(Usuarios user)
 {
     FormColor color = new FormColor(this);
     Datos emp = new Datos("Empleados.txt");
     usuarioActivo = user;
     empleado = emp.ObtenerVector(usuarioActivo.Usuario);
     InitializeComponent();
 }
Exemplo n.º 4
0
 private void NewColor(int color)
 {
     Datos newColor = new Datos("Config.txt");
     string[] linea = newColor.ObtenerVector("color");
     linea[1] = Convert.ToString(color);
     newColor.Modificar("color", newColor.VectorToLine(linea));
     FormColor fColor = new FormColor(this);
 }
Exemplo n.º 5
0
 private string GenerarId()
 {
     Datos config = new Datos("Config.txt");
     string newId = txtNombres.Text.Substring(0, 1).ToUpper() + txtApellidos.Text.Substring(0, 1).ToUpper();
     string[] linea = config.ObtenerVector("datos");
     int correlativo = int.Parse(linea[1]) + 1;
     linea[1] = correlativo.ToString();
     config.Modificar("datos", config.VectorToLine(linea));
     return newId += Convert.ToString(correlativo).PadLeft(4, '0');
 }
Exemplo n.º 6
0
        public void GenerarReporte(string IdEmpleado, string[] columnas, string formato, string opcion, Datos tipo)
        {
            StreamWriter write = new StreamWriter(rutaReporte);
            List<string[]> todos = tipo.LeerArchivo();
            string separador = "";
            string encabezados = String.Format(formato, columnas);

            foreach (char letra in encabezados)
                separador += "-";

            write.WriteLine("\t\t Reporte de {0} por el empleado {1}", opcion, IdEmpleado);
            write.WriteLine();
            write.WriteLine("Reporte generado: {0} - {1}", DateTime.Now.ToLongDateString(), DateTime.Now.ToLongTimeString());
            write.WriteLine();

            write.WriteLine(separador);
            write.WriteLine(encabezados);
            write.WriteLine(separador);

            foreach (string[] fila in todos)
            {
                if (fila[fila.Length - 2] == IdEmpleado)
                    write.WriteLine(String.Format(formato, fila));
            }
            write.WriteLine(separador);

            write.Close();
            Process.Start(rutaReporte);
        }