Ejemplo n.º 1
0
        private void Agregar_Cliente_Load(object sender, EventArgs e)
        {
            timer1.Enabled = true;
            n_cliente reg  = new n_cliente();
            int       resu = reg.obtenerregistrocliente();

            resu             = resu + 1;
            tbx_cliente.Text = resu.ToString();
        }
Ejemplo n.º 2
0
        private void btn_cargar_Click(object sender, EventArgs e)
        {
            int cont = 0;

            if (string.IsNullOrEmpty(tbx_cliente.Text))
            {
                tbx_cliente.BackColor = Color.Red;
                cont++;
            }
            if (string.IsNullOrEmpty(tbx_dni.Text))
            {
                tbx_dni.BackColor = Color.Red;
                cont++;
            }
            if (string.IsNullOrEmpty(tbx_nombre.Text))
            {
                tbx_nombre.BackColor = Color.Red;
                cont++;
            }
            if (string.IsNullOrEmpty(tbx_direccion.Text))
            {
                tbx_direccion.BackColor = Color.Red;
                cont++;
            }
            if (string.IsNullOrEmpty(tbx_telefono.Text))
            {
                tbx_telefono.BackColor = Color.Red;
                cont++;
            }

            if (cont > 0)
            {
                MessageBox.Show("Falta ingresar campos");
            }

            else
            {
                n_cliente reg = new n_cliente();
                reg.getagregar_cliente(tbx_cliente.Text, tbx_dni.Text, tbx_nombre.Text, tbx_direccion.Text, tbx_telefono.Text);
                MessageBox.Show("Cliente Agregado correctamente");
                tbx_cliente.Text   = string.Empty;
                tbx_direccion.Text = string.Empty;
                tbx_dni.Text       = string.Empty;
                tbx_nombre.Text    = string.Empty;
                tbx_telefono.Text  = string.Empty;

                int resu = reg.obtenerregistrocliente();
                resu             = resu + 1;
                tbx_cliente.Text = resu.ToString();
            }
        }