private void button9_Click(object sender, EventArgs e) { try { Database.SetInitializer(new DropCreateDatabaseIfModelChanges<AccesoADatos>()); var factor = new Factor { Nombre = textBox7.Text, Ponderacion = textBox6.Text, Habilitado = checkBox1.Checked, //Id = 1, }; using (var context = new AccesoADatos()) { context.Factor.Add(factor); context.SaveChanges(); MessageBox.Show(";)"); } } catch (Exception ex) { MessageBox.Show(ex.InnerException.ToString()); } }
private void button7_Click(object sender, EventArgs e) { try { Database.SetInitializer(new DropCreateDatabaseIfModelChanges<ManejadorDeDatos>()); var factor = new Factor { Nombre = textBox11.Text, Ponderacion = textBox15.Text, Habilitado = checkBox1.Checked //Gerente_Id = Convert.ToInt32(textBox16.Text), //Id = 1, }; using (var context = new ManejadorDeDatos()) { context.Factor.Add(factor); context.SaveChanges(); MessageBox.Show("Agregado con exito"); } } catch (Exception ex) { //MessageBox.Show(ex.InnerException.ToString()); } }