Exemple #1
0
 private void guardar()
 {
     if (!validar())
     {
         if (!validarExistencias())
         {
             utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas();
             cliente = new conexiones_BD.clases.clientes(txtCodigo.Text,
                                                         txtNombres.Text, txtApellidos.Text, txtDire.Text, txtDui.Text, txtNit.Text, txtNcr.Text,
                                                         txtRazon.Text, txtTel.Text, txtEmail.Text, listaDes.SelectedValue.ToString(),
                                                         fe.fechaMysql(fecha), listaGenero.SelectedIndex.ToString());
             if (cliente.guardar(true) > 0)
             {
                 vaciarDatos();
                 cargarTablas();
                 if (nuevoClientes)
                 {
                     ingresado = true;
                     this.Close();
                 }
                 else
                 {
                     txtNombres.Focus();
                 }
             }
         }
     }
 }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (!validar())
            {
                if (!validarExistencias())
                {
                    utilitarios.maneja_fechas fech = new utilitarios.maneja_fechas();
                    cliente = new conexiones_BD.clases.clientes(
                        codigo(),
                        txtNombres.Text,
                        txtApellidos.Text,
                        txtDire.Text,
                        "-",
                        "-",
                        "-",
                        "-",
                        "-",
                        "-",
                        "1",
                        fech.fechaMysql(fecha),
                        listaGenero.SelectedValue.ToString());


                    if (cliente.guardar(true) > 0)
                    {
                        ingresado = true;
                        nombre    = txtNombres.Text;
                        this.Close();
                    }
                }
            }
        }