static void Main(string[] args)
        {
            Console.WriteLine("procesar Excel");
            Console.WriteLine("V1.0");
            Console.WriteLine("Powered by Víctor Martinez");
            Console.WriteLine("01/03/2021");
            Console.WriteLine(DateTime.Now);

            string     rutaDelArchivo;
            int        row;
            SLDocument sLDocument;

            row            = 2;
            rutaDelArchivo = @"C:\Users\vmartinez\Downloads\ListaDeInformacionApp (1).xlsx";
            sLDocument     = new SLDocument(rutaDelArchivo);

            while (!string.IsNullOrEmpty(sLDocument.GetCellValueAsString(row, 1)))
            {
                string        claveDeLaAgencia;
                string        nombreDeLaAgencia;
                string        tipo;
                string        ciudad;
                string        numeroDeSerieDeAt9000;
                string        numeroDeSerieDecsd200;
                AgenciaEntity entity;

                claveDeLaAgencia  = sLDocument.GetCellValueAsString(row, 1);
                nombreDeLaAgencia = sLDocument.GetCellValueAsString(row, 2);
                tipo   = sLDocument.GetCellValueAsString(row, 3);
                ciudad = sLDocument.GetCellValueAsString(row, 4);
                numeroDeSerieDeAt9000 = sLDocument.GetCellValueAsString(row, 5);
                numeroDeSerieDecsd200 = sLDocument.GetCellValueAsString(row, 6);
                entity = new AgenciaEntity
                {
                    Ciudad          = ciudad,
                    Clave           = claveDeLaAgencia,
                    Nombre          = nombreDeLaAgencia,
                    TipoDeAgenciaId = 1,// GetTipoDeAgenciaId(tipo),
                    ProyectoId      = 1,
                    UsuarioId       = 1
                };
                entity.Id = AgenciaDao.Add(entity);
                AddAT90000(entity.Id, numeroDeSerieDeAt9000);
                //AddCs200(entity.Id, numeroDeSerieDecsd200);
                Console.WriteLine($"{row} {entity.Clave} {numeroDeSerieDeAt9000} {numeroDeSerieDecsd200}");
                row++;
            }
            Console.WriteLine(DateTime.Now);
            Console.WriteLine("Carga terminada, pulse enter para salir");
            Console.ReadLine();
        }
Esempio n. 2
0
        public static int Add(Agencia item)
        {
            try
            {
                AgenciaEntity entity;

                entity    = AgenciaMapper.Get(item);
                entity.Id = AgenciaDao.Add(entity);

                return(entity.Id);
            }
            catch (Exception)
            {
                throw;
            }
        }