コード例 #1
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            try
            {
                using (SICOVE1Entities db = new SICOVE1Entities())
                {
                    string Id  = dgvProveedores.CurrentRow.Cells[0].Value.ToString();
                    int    IdC = int.Parse(Id);
                    proveedores                 = db.tb_Proveedores.Where(VerificarId => VerificarId.IdProveedor == IdC).First();
                    proveedores.Nombre          = txtNombre.Text;
                    proveedores.Direccion       = txtDireccion.Text;
                    proveedores.Celular         = txtCelular.Text;
                    proveedores.DUI             = txtDUI.Text;
                    proveedores.FechaRegistro   = Convert.ToDateTime(dtpFechaReg.Text);
                    db.Entry(proveedores).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
                MessageBox.Show("El Proveedor se ha Actualizado con éxito");
                dgvProveedores.Rows.Clear();
                cargardatos();
                limpiartxt();

                btnGuardar.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Algo salio mal... Intente de nuevo");
            }
        }
コード例 #2
0
 private void btnEditar_Click(object sender, EventArgs e)
 {
     try
     {
         using (SICOVE1Entities db = new SICOVE1Entities())
         {
             string Id  = dgvRoles.CurrentRow.Cells[0].Value.ToString();
             int    IdC = int.Parse(Id);
             roles                 = db.tb_Roles.Where(VerificarId => VerificarId.IdRol == IdC).First();
             roles.Nombre          = txtRol.Text;
             db.Entry(roles).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
         }
         MessageBox.Show("El Rol se ha Actuliazado con éxito");
         dgvRoles.Rows.Clear();
         cargardatos();
         txtRol.Clear();
         txtRol.Focus();
         btnGuardar.Enabled = true;
         btnNuevo.Enabled   = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Algo salio mal " + ex.ToString());
     }
 }
コード例 #3
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            try
            {
                using (SICOVE1Entities db = new SICOVE1Entities())
                {
                    string Id  = dgvProductos.CurrentRow.Cells[0].Value.ToString();
                    int    IdC = int.Parse(Id);
                    productos         = db.tb_Productos.Where(VerificarId => VerificarId.IdProducto == IdC).First();
                    productos.Nombre  = txtNombre.Text;
                    productos.Detalle = txtDetalle.Text;

                    productos.FechaRegistro = Convert.ToDateTime(dtpFechaReg.Text);

                    String comboCategoria = cmbCategoria.SelectedValue.ToString();
                    productos.IdCategoria = Convert.ToInt32(comboCategoria);


                    db.Entry(productos).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
                MessageBox.Show("Se Actualizo con éxito");
                dgvProductos.Rows.Clear();
                cargarGridview();
                limpiardatos();
                CargarCombo();

                btnGuardar.Enabled = true;
                btnNuevo.Enabled   = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Algo Salio Mal, intente de nuevo. ");
            }
        }
コード例 #4
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            try
            {
                using (SICOVE1Entities db = new SICOVE1Entities())
                {
                    string Id  = dgvCategoria.CurrentRow.Cells[0].Value.ToString();
                    int    IdC = int.Parse(Id);
                    categorias                 = db.tb_Categorias.Where(VerificarId => VerificarId.IdCategoria == IdC).First();
                    categorias.Nombre          = txtCategoria.Text;
                    categorias.FechaRegistro   = Convert.ToDateTime(dtpFechaReg.Text);
                    db.Entry(categorias).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
                MessageBox.Show("La categoría se ha Actualizo con éxito");
                dgvCategoria.Rows.Clear();
                cargardatos();
                txtCategoria.Clear();
                txtCategoria.Focus();

                btnGuardar.Enabled = true;
                btnNuevo.Enabled   = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Algo salio mal " + ex.ToString());
            }
        }
コード例 #5
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            try
            {
                using (SICOVE1Entities db = new SICOVE1Entities())
                {
                    string Id  = dgvFPagos.CurrentRow.Cells[0].Value.ToString();
                    int    IdC = int.Parse(Id);
                    formaPago                 = db.tb_FormaPago.Where(VerificarId => VerificarId.IdFormaPago == IdC).First();
                    formaPago.Nombre          = txtFPago.Text;
                    db.Entry(formaPago).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
                MessageBox.Show("La Forma de Pago se ha Actualizado con éxito");
                dgvFPagos.Rows.Clear();
                cargardatos();
                txtFPago.Clear();
                txtFPago.Focus();

                btnGuardar.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(" Algo salio mal...  ¡Intente de nuevo! ");
            }
        }
コード例 #6
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            try
            {
                using (SICOVE1Entities db = new SICOVE1Entities())
                {
                    string Id  = dgvUsuarios.CurrentRow.Cells[0].Value.ToString();
                    int    IdC = int.Parse(Id);
                    user         = db.tb_Usuarios.Where(VerificarId => VerificarId.IdUsuario == IdC).First();
                    user.Usuario = txtUsuario.Text;
                    user.Clave   = txtClave.Text;

                    String comboRol = cmbRol.SelectedValue.ToString();
                    user.IdRol = Convert.ToInt32(comboRol);

                    String comboEmpleado = cmbEmpleado.SelectedValue.ToString();
                    user.IdEmpleado = Convert.ToInt32(comboEmpleado);

                    user.FechaRegistro = Convert.ToDateTime(dtpFechaReg.Text);

                    db.Entry(user).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
                MessageBox.Show("Se Actualizo con éxito");
                dgvUsuarios.Rows.Clear();
                cargarGridview();
                limpiardatos();
                CargarCombo();

                btnGuardar.Enabled = true;
                btnNuevo.Enabled   = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Algo Salio Mal, intente de nuevo. " + ex.ToString());
            }
        }