コード例 #1
0
        private void SalvarCampo()
        {
            if (migrationTable == null)
            {
                Ambiente.Mensaje("Selecciona una tabla");
                return;
            }

            // migrationFields = migrationFieldController.SelectByTableId(migrationTable.MigrationTableId);

            foreach (DataGridViewRow row in Malla.Rows)
            {
                if (row.Cells[0].Value.Equals("NewId"))
                {
                    migrationField = new MigrationField();
                    migrationField.MigrationTableId = (int)row.Cells[1].Value;
                    migrationField.Campo            = row.Cells[2].Value.ToString().Trim();
                    migrationField.Expresion        = row.Cells[3].Value.ToString().Trim();
                    migrationField.CreatedBy        = Ambiente.LoggedUser.UsuarioId;
                    migrationFieldController.InsertOne(migrationField);
                }
            }

            if (Ambiente.BoolValue)
            {
                foreach (var item in migrationFields)
                {
                    migrationFieldController.Update(item);
                }

                Ambiente.BoolValue = false;
            }
            Ambiente.Mensaje("Proceso concluido");
        }
コード例 #2
0
 public bool InsertOne(MigrationField o)
 {
     try
     {
         using (var db = new DymContext())
         {
             db.Add(o);
             return(db.SaveChanges() > 0 ? true : false);
         }
     }
     catch (Exception ex)
     {
         Ambiente.Mensaje("Algo salio mal con: " + MethodBase.GetCurrentMethod().Name + "@" + GetType().Name + "\n" + ex.ToString());
     }
     return(false);
 }
コード例 #3
0
 public bool Update(MigrationField o)
 {
     try
     {
         using (var db = new DymContext())
         {
             db.Entry(o).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
             return(db.SaveChanges() > 0 ? true : false);
         }
     }
     catch (Exception ex)
     {
         Ambiente.Mensaje("Algo salio mal con: " + MethodBase.GetCurrentMethod().Name + "@" + GetType().Name + "\n" + ex.ToString());
     }
     return(false);
 }
コード例 #4
0
 public bool DeletePartidas(MigrationField devolucion)
 {
     try
     {
         using (var db = new DymContext())
         {
             var partidas = db.MigrationField.Where(x => x.MigrationTableId == devolucion.MigrationTableId).ToList();
             if (partidas != null)
             {
                 db.RemoveRange(partidas);
                 db.SaveChanges();
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {
         Ambiente.Mensaje(Ambiente.CatalgoMensajes[-1] + "@" + GetType().Name + "\n" + ex.ToString());
     }
     return(false);
 }
コード例 #5
0
        private void Initialize()
        {
            //Controllers
            productoSustanciaController = new ProductoSustanciaController();
            cierreInventariopController = new CierreInventariopController();
            productoImpuestoController  = new ProductoImpuestoController();
            cierreInventarioController  = new CierreInventarioController();
            migrationTableController    = new MigrationTableController();
            migrationFieldController    = new MigrationFieldController();
            presentacionController      = new PresentacionController();
            laboratorioController       = new LaboratorioController();
            categoriaController         = new CategoriaController();
            sustanciaController         = new SustanciaController();
            productoController          = new ProductoController();
            loteController   = new LoteController();
            movInvController = new MovInvController();
            //Objetos
            productoSustancia = null;
            productoImpuesto  = null;
            cierreInventario  = null;
            cierreInventariop = null;
            migrationTable    = null;
            migrationField    = null;
            presentacion      = null;
            laboratorio       = null;
            categoria         = null;
            sustancia         = null;
            producto          = null;
            lote = null;

            //Listas
            productoSustancias = new List <ProductoSustancia>();
            productoImpuestos  = new List <ProductoImpuesto>();
            migrationTables    = new List <MigrationTable>();
            migrationFields    = new List <MigrationField>();
            presentaciones     = new List <Presentacion>();
            laboratorios       = new List <Laboratorio>();
            categorias         = new List <Categoria>();
            sustancias         = new List <Sustancia>();
            productos          = new List <Producto>();
            lotes = new List <Lote>();


            try
            {
                //Conexion vfpro
                Sql              = "";
                dataTable        = new DataTable();
                connectionstring = "Provider=VFPOLEDB.1;Data Source=" + Ambiente.Empresa.MicroPvdb + ";";
                oleDbConnection  = new OleDbConnection(connectionstring);
                oleDbConnection.Open();


                //Llena combo tablas
                migrationTables        = migrationTableController.SelectAll();
                CboTabla.DataSource    = migrationTables;
                CboTabla.DisplayMember = "Tabla";
                CboTabla.ValueMember   = "MigrationTableId";
                CboTabla.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }