Exemplo n.º 1
0
 private void Tsbguardar_Click(object sender, EventArgs e)
 {
     if (!ValidarCampos())
     {
         return;
     }
     if (nuevo)
     {
         CADCliente.InsertCliente(txtNombre.Text,
                                  txtApellidos.Text,
                                  txtObservaciones.Text);
     }
     else
     {
         CADCliente.UpdateCliente(txtNombre.Text,
                                  txtApellidos.Text,
                                  txtObservaciones.Text,
                                  Convert.ToInt32(txtIdCliente.Text));
     }
     DeshabilitarCampos();
     dgvDatos.DataSource = null;
     dgvDatos.DataSource = CADCliente.GetData();
     if (nuevo)
     {
         TsbUltimo_Click(sender, e);
     }
     MostrarRegistro();
 }
 private void tsbGuardar_Click(object sender, EventArgs e)
 {
     if (!ValidarCampos())
     {
         return;
     }
     if (nuevo)
     {
         CADCliente.InsertCliente(
             (int)cmbTipoDocumento.SelectedValue,
             txtDocumento.Text,
             txtNombreComercial.Text,
             txtNombresContacto.Text,
             txtApellidosContacto.Text,
             txtDireccion.Text,
             txtTelefono1.Text,
             txtTelefono2.Text,
             txtCorreo.Text,
             txtNotas.Text,
             dtpAniversario.Value
             );
     }
     else
     {
         CADCliente.UpdateCliente(
             (int)cmbTipoDocumento.SelectedValue,
             txtDocumento.Text,
             txtNombreComercial.Text,
             txtNombresContacto.Text,
             txtApellidosContacto.Text,
             txtDireccion.Text,
             txtTelefono1.Text,
             txtTelefono2.Text,
             txtCorreo.Text,
             txtNotas.Text,
             dtpAniversario.Value,
             Convert.ToInt32(txtIDCliente.Text)
             );
     }
     DeshabilitarCampos();
     dgvDatos.DataSource = null;
     dgvDatos.DataSource = CADCliente.GetData();
     if (nuevo)
     {
         tsbUltimo_Click(sender, e);
     }
     MostrarRegistro();
 }