示例#1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                if (id != 0)
                {
                }
                int idUsuarioSeleccionado = id;

                if (idUsuarioSeleccionado > 0)
                {
                    panel_Clientes.Enabled = false;
                    Entidades.Clientes _cliente = CargarEntidadEdicion();
                    ProgressBar();
                    bool Exito = Negocio.Clientes.EditarCliente(_cliente, idUsuarioSeleccionado);
                    if (Exito == true)
                    {
                        const string message2 = "La edición del cliente se registro exitosamente.";
                        const string caption2 = "Éxito";
                        var          result2  = MessageBox.Show(message2, caption2,
                                                                MessageBoxButtons.OK,
                                                                MessageBoxIcon.Asterisk);
                        LimpiarCampos();
                    }
                }
                else
                {
                    panel_Clientes.Enabled = false;
                    Entidades.Clientes _cliente = CargarEntidad();
                    ProgressBar();
                    bool Exito = Negocio.Clientes.CargarCliente(_cliente);
                    if (Exito == true)
                    {
                        const string message2 = "Se registro el cliente exitosamente.";
                        const string caption2 = "Éxito";
                        var          result2  = MessageBox.Show(message2, caption2,
                                                                MessageBoxButtons.OK,
                                                                MessageBoxIcon.Asterisk);
                        LimpiarCampos();
                    }
                    else
                    {
                        HabilitarCampos();
                    }
                }
            }
            catch (Exception ex)
            {
                const string message = "Error en el sistema. Intente nuevamente o comuniquese con el administrador.";
                const string caption = "Atención";
                var          result  = MessageBox.Show(message, caption,
                                                       MessageBoxButtons.OK,
                                                       MessageBoxIcon.Warning);
                throw new Exception();
            }
        }
示例#2
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         if (idClienteSeleccionado > 0)
         {
             Entidades.Clientes _cliente = CargarEntidadEdicion();
             bool Exito = Negocio.Clientes.EditarCliente(_cliente, idClienteSeleccionado);
             if (Exito == true)
             {
                 ProgressBar();
                 const string message2 = "La edición del cliente se registro exitosamente.";
                 const string caption2 = "Éxito";
                 var          result2  = MessageBox.Show(message2, caption2,
                                                         MessageBoxButtons.OK,
                                                         MessageBoxIcon.Asterisk);
                 LimpiarCampos();
                 FuncionListarClientes();
             }
         }
         else
         {
             Entidades.Clientes _cliente = CargarEntidad();
             bool Exito = Negocio.Clientes.CargarCliente(_cliente);
             if (Exito == true)
             {
                 ProgressBar();
                 const string message2 = "Se registro el cliente exitosamente.";
                 const string caption2 = "Éxito";
                 var          result2  = MessageBox.Show(message2, caption2,
                                                         MessageBoxButtons.OK,
                                                         MessageBoxIcon.Asterisk);
                 LimpiarCampos();
                 FuncionListarClientes();
             }
         }
     }
     catch (Exception ex)
     {
     }
 }