Ejemplo n.º 1
0
 public void actualizargrilla()
 {
     try
     {
         dataGridView1.DataSource = FactorCN.GetFactores();
     }
     catch { MessageBox.Show("ERROR EN EL ACCESO A LA BASE DE DATOS"); }
 }
Ejemplo n.º 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (textBox4.Text.Length > 0)
            {
                try
                {
                    FactorCN.deleteFactor(Int32.Parse(textBox4.Text));
                    MessageBox.Show("Factor eliminado correctamente");
                    actualizargrilla();
                }
                catch { MessageBox.Show("ERROR EN EL ACCESO A LA BASE DE DATOS"); }

                vaciarEntradas();
            }
        }
Ejemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if ((textBox1.Text.Length > 6) &&
                (textBox2.Text.Length > 5) &&
                (textBox3.Text.Length > 6))
            {
                Factor fact = new Factor();
                fact.nombre  = textBox1.Text;
                fact.estado  = textBox2.Text;
                fact.detalle = textBox3.Text;
                try
                {
                    FactorCN.CreateFactor(fact);
                    MessageBox.Show("Factor " + fact.nombre + " dado de alta correctamente");
                    actualizargrilla();
                }
                catch { MessageBox.Show("ERROR DE ACCESO A BASE DE DATOS"); }

                vaciarEntradas();
            }
        }
Ejemplo n.º 4
0
        private void button3_Click(object sender, EventArgs e)
        {
            if ((textBox1.Text.Length > 6) &&
                ((textBox4.Text.Length) > 0) &&
                (textBox2.Text.Length > 6) &&
                (textBox3.Text.Length > 6))
            {
                Factor fact = new Factor();
                fact.nombre   = textBox1.Text;
                fact.estado   = textBox2.Text;
                fact.detalle  = textBox3.Text;
                fact.idFactor = Int32.Parse(textBox4.Text);

                try
                {
                    FactorCN.UpdateFactor(fact);
                    MessageBox.Show("Factor " + fact.nombre + " actualizado correctamente");
                    actualizargrilla();
                }
                catch { MessageBox.Show("ERROR DE ACCESO A LA BASE DE DATOS"); }

                vaciarEntradas();
            }
        }