private void btnNuevoCliente_Click(object sender, EventArgs e)
 {
     using (EditarCliente nuevo = new EditarCliente())
     {
         nuevo.ShowDialog(this);
         ActualizaClientes();
     }
 }
예제 #2
0
        public async Task <IActionResult> Editar([FromServices] EditarCliente editarCliente,
                                                 EditarClienteViewModel editarClienteVm)
        {
            if (!ModelState.IsValid)
            {
                return(View(editarClienteVm));
            }

            await editarCliente.Executar(editarClienteVm);

            return(RedirectToAction(nameof(Index)));
        }
예제 #3
0
 private void Opc_Modificar_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (clienteSeleccionado != null)
     {
         EditarCliente ventana = new EditarCliente
         {
             ClienteAEditar = clienteSeleccionado,
             ventanaPadre   = this
         };
         ventana.ShowDialog();
     }
     else
     {
         mostrarMensajeAceptar("Primero debe seleccionar un cliente.");
     }
 }
예제 #4
0
 private void dgvClientes_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == dgvClientes.Columns["Editar"].Index && e.RowIndex >= 0)
     {
         int           idAEditar     = Convert.ToInt32(dgvClientes.Rows[e.RowIndex].Cells["id"].Value);
         EditarCliente editarCliente = new EditarCliente(idAEditar);
         editarCliente.Show();
         return;
     }
     if (e.ColumnIndex == dgvClientes.Columns["Borrar"].Index && e.RowIndex >= 0)
     {
         SqlServer sql             = new SqlServer();
         var       listaParametros = new Dictionary <string, string>();
         listaParametros.Add("id", dgvClientes.Rows[e.RowIndex].Cells["id"].Value.ToString());
         DataTable tabla = sql.EjecutarSp("SP_Baja_Cliente_By_Id", listaParametros);
         if (tabla.Rows.Count > 0 && tabla.Rows[0].ItemArray[0].ToString() == "ERROR")
         {
             MessageBox.Show(tabla.Rows[0].ItemArray[1].ToString());
         }
         ActualizarClienteForm();
         return;
     }
 }