Example #1
0
        protected override bool AccionGuardar()
        {
            // Se valida
            if (!this.Validar())
            {
                return(false);
            }

            Cargando.Mostrar();

            BancoCuenta oReg;

            foreach (DataGridViewRow oFila in this.dgvDatos.Rows)
            {
                if (oFila.IsNewRow)
                {
                    continue;
                }

                int iId     = this.dgvDatos.ObtenerId(oFila);
                int iCambio = this.dgvDatos.ObtenerIdCambio(oFila);
                switch (iCambio)
                {
                case Cat.TiposDeAfectacion.Agregar:
                case Cat.TiposDeAfectacion.Modificar:
                    if (iCambio == Cat.TiposDeAfectacion.Agregar)
                    {
                        oReg = new BancoCuenta();
                    }
                    else
                    {
                        oReg = Datos.GetEntity <BancoCuenta>(c => c.BancoCuentaID == iId);
                    }

                    // Se llenan los datos
                    oReg.NumeroDeCuenta = Util.Cadena(oFila.Cells["NumeroDeCuenta"].Value);
                    oReg.NombreDeCuenta = Util.Cadena(oFila.Cells["NombreDeCuenta"].Value);
                    oReg.BancoID        = Util.Entero(oFila.Cells["BancoID"].Value);
                    oReg.UsoProveedores = Util.Logico(oFila.Cells["UsoProveedores"].Value);
                    oReg.UsoClientes    = Util.Logico(oFila.Cells["UsoClientes"].Value);
                    oReg.EsCpcp         = Util.Logico(oFila.Cells["EsCpcp"].Value);

                    Datos.Guardar <BancoCuenta>(oReg);
                    break;

                case Cat.TiposDeAfectacion.Borrar:
                    oReg = Datos.GetEntity <BancoCuenta>(c => c.BancoCuentaID == iId);
                    Datos.Eliminar <BancoCuenta>(oReg);
                    break;
                }
            }

            Cargando.Cerrar();
            this.CargarDatos();
            return(true);
        }
Example #2
0
        protected override bool AccionGuardar()
        {
            // Se valida
            if (!this.Validar())
                return false;

            Cargando.Mostrar();

            BancoCuenta oReg;
            foreach (DataGridViewRow oFila in this.dgvDatos.Rows)
            {
                if (oFila.IsNewRow) continue;

                int iId = this.dgvDatos.ObtenerId(oFila);
                int iCambio = this.dgvDatos.ObtenerIdCambio(oFila);
                switch (iCambio)
                {
                    case Cat.TiposDeAfectacion.Agregar:
                    case Cat.TiposDeAfectacion.Modificar:
                        if (iCambio == Cat.TiposDeAfectacion.Agregar)
                            oReg = new BancoCuenta();
                        else
                            oReg = Datos.GetEntity<BancoCuenta>(c => c.BancoCuentaID == iId);

                        // Se llenan los datos
                        oReg.NumeroDeCuenta = Util.Cadena(oFila.Cells["NumeroDeCuenta"].Value);
                        oReg.NombreDeCuenta = Util.Cadena(oFila.Cells["NombreDeCuenta"].Value);
                        oReg.BancoID = Util.Entero(oFila.Cells["BancoID"].Value);
                        oReg.UsoProveedores = Util.Logico(oFila.Cells["UsoProveedores"].Value);
                        oReg.UsoClientes = Util.Logico(oFila.Cells["UsoClientes"].Value);
                        oReg.EsCpcp = Util.Logico(oFila.Cells["EsCpcp"].Value);

                        Datos.Guardar<BancoCuenta>(oReg);
                        break;
                    case Cat.TiposDeAfectacion.Borrar:
                        oReg = Datos.GetEntity<BancoCuenta>(c => c.BancoCuentaID == iId);
                        Datos.Eliminar<BancoCuenta>(oReg);
                        break;
                }
            }

            Cargando.Cerrar();
            this.CargarDatos();
            return true;
        }