예제 #1
0
        private void Agregar_Proveedor_Load(object sender, EventArgs e)
        {
            timer1.Enabled = true;
            n_proveedor reg = new n_proveedor();

            dgv_proveedor.DataSource = reg.getTabla();
            n_producto pro = new n_producto();

            dgv_productos.DataSource = pro.getTabla();
            int resu;

            resu            = reg.obtenerregistroproveedor();
            resu            = resu + 1;
            textBox_id.Text = resu.ToString();
        }
예제 #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            int cont = 0;

            if (string.IsNullOrEmpty(textBox_nombre.Text))
            {
                textBox_nombre.BackColor = Color.Red;
                cont++;
            }
            if (string.IsNullOrEmpty(textBox_direccion.Text))
            {
                textBox_direccion.BackColor = Color.Red;
                cont++;
            }
            if (string.IsNullOrEmpty(textBox_id.Text))
            {
                textBox_id.BackColor = Color.Red;
                cont++;
            }
            if (string.IsNullOrEmpty(textBox_localidad.Text))
            {
                textBox_localidad.BackColor = Color.Red;
                cont++;
            }
            if (string.IsNullOrEmpty(textBox_telefono.Text))
            {
                textBox_telefono.BackColor = Color.Red;
                cont++;
            }

            if (cont > 0)
            {
                MessageBox.Show("Falta ingresar campos");
            }
            /// MODIFICACION JOSE 8/02/2019
            //for (int i = 0; i < dgv_proveedor.Rows.Count; i++)
            //{
            //    //items.Cells[5].Value.Equals(item.Cells[5].Value)
            //    //textBox_id.Text.Equals(dgv_proveedor.Rows[i].Cells[0].Value.ToString())
            //    if (textBox_id.Text.Equals(dgv_proveedor.Rows[i].Cells[0].Value.ToString()))
            //    {
            //        MessageBox.Show("El ID del proveedor ya existe.");
            //        return;
            //    }
            //}
            /// MODIFICACION JOSE 8/02/2019

            if (textBox_id.Text != "" & textBox_nombre.Text != "" /*& textBox_apellido.Text != ""*/
                & textBox_direccion.Text != "" & textBox_telefono.Text != ""
                & textBox_localidad.Text != "")
            {
                n_proveedor reg = new n_proveedor();

                reg.AgregarProveedor(textBox_id.Text, tbx_idProducto.Text, textBox_nombre.Text, textBox_direccion.Text, textBox_telefono.Text, textBox_localidad.Text);
                MessageBox.Show("Proveedor Agregado correctamente");
                tbx_idProducto.Text    = string.Empty;
                textBox_apellido.Text  = string.Empty;
                textBox_direccion.Text = string.Empty;
                textBox_id.Text        = string.Empty;
                textBox_localidad.Text = string.Empty;
                textBox_nombre.Text    = string.Empty;
                textBox_telefono.Text  = string.Empty;

                int resu;
                resu            = reg.obtenerregistroproveedor();
                resu            = resu + 1;
                textBox_id.Text = resu.ToString();
            }
        }