public async Task Editar(int id) { try { var cliente = await _context.Clientes.FindAsync(id); if (cliente == null) { MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); clienteId = 0; return; } funciones.ResetForm(panelFormulario); clienteId = 0; clienteId = int.Parse(dgvClientes.SelectedRows[0].Cells[0].Value.ToString()); txtIdentificacion.Text = cliente.Identificacion; txtNombre.Text = cliente.Nombre; txtTelefono.Text = cliente.Telefono; txtCorreo.Text = cliente.Correo; chbActivo.Checked = cliente.Activo; txtDireccion.Text = cliente.Direccion; txtComentario.Text = cliente.Comentario; txtFecha.Text = cliente.Fecha.ToString("dd/MM/yyyy"); lblGanancias.Text = cliente.Empenos.Where(m => m.Pagos.Count() > 0).SelectMany(m => m.Pagos).Sum(p => p.Monto).ToString("N2"); lblEmpeños.Text = cliente.Empenos.Where(m => !m.IsDelete).Count().ToString(); funciones.BlockTextBox(panelFormulario, true); funciones.EditTextColor(panelFormulario); funciones.ShowLabels(panelFormulario); funciones.TextBoxColorBlank(panelFormulario); funciones.IntelligHolders(panelFormulario); } catch (Exception) { } }
public async Task Editar() { if (dgvEmpleados.SelectedRows.Count > 0) { var empleado = await _context.Empleados.FindAsync(dgvEmpleados.SelectedRows[0].Cells[0].Value); if (empleado == null) { MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); empleadoId = 0; return; } funciones.ResetForm(panelFormulario); empleadoId = 0; empleadoId = int.Parse(dgvEmpleados.SelectedRows[0].Cells[0].Value.ToString()); txtNombre.Text = empleado.Nombre; txtTelefono.Text = empleado.Telefono; txtCorreo.Text = empleado.Correo; chbActivo.Checked = empleado.Activo; txtUsuario.Text = empleado.Usuario; var user = await _context.User.Include(u => u.Perfil).SingleOrDefaultAsync(u => u.Usuario == empleado.Usuario); if (user != null) { cbPerfil.Text = user.Perfil.Nombre; txtPassword.Text = user.Password; txtPassword.UseSystemPasswordChar = true; txtPIN.Text = user.Codigo; } funciones.BlockTextBox(panelFormulario, true); funciones.EditTextColor(panelFormulario); funciones.ShowLabels(panelFormulario); funciones.TextBoxColorBlank(panelFormulario); txtUsuario.Enabled = false; txtPassword.Enabled = false; txtPassword.UseSystemPasswordChar = true; } }
public async Task Editar() { if (dgvLista.SelectedRows.Count > 0) { var interes = await _context.Interes.FindAsync(dgvLista.SelectedRows[0].Cells[0].Value); if (interes != null) { interesId = interes.InteresId; txtNombre.Text = interes.Nombre; txtValor.Text = interes.Porcentaje.ToString(); txtBodega.Text = interes.Bodega.ToString(); txtMayor.Text = interes.Mayor.ToString(); txtMenor.Text = interes.Menor.ToString(); txtIgual.Text = interes.Igual.ToString(); chbActivo.Checked = interes.Activo; funciones.ShowLabels(panelFormulario); funciones.BlockTextBox(panelFormulario, true); funciones.EditTextColor(panelFormulario); } } }