private void button_AsignarRegla_Click(object sender, EventArgs e) { String UpdateSql = "UPDATE com_asociacion SET IdReglaRec = " + dataGridView_ListaReglasActivas.SelectedCells[0].Value.ToString() + " WHERE IdAsociacion = " + id_asociacion; Persistencia.SentenciasSQL.InsertarGenerico(UpdateSql); MessageBox.Show("Regla Insertada"); form_anterior.cargarDatagrid(); this.Close(); }
private void button_Guardar_Click(object sender, EventArgs e) { String activo = "0"; String sqlInsertar, sqlActualizar; if (checkBox_Activa.Checked) { activo = "-1"; } if (id_regla != "0") { if (textBox_descripcion.Text != "") { sqlActualizar = "UPDATE com_reglasrec SET RefRegla = '" + textBox_Regla.Text + "' , Descripcion = '" + textBox_descripcion.Text + "' , IdComunero = " + id_comunero + ", IdFormaPago = " + comboBox_FPago.SelectedValue.ToString() + ", IdCC = " + comboBox_Cuenta.SelectedValue.ToString() + " , Activa = " + activo + " WHERE IdReglaRec = " + id_regla; } else { sqlActualizar = "UPDATE com_reglasrec SET RefRegla = '" + textBox_Regla.Text + "', IdComunero = " + id_comunero + ", IdFormaPago = " + comboBox_FPago.SelectedValue.ToString() + ", IdCC = " + comboBox_Cuenta.SelectedValue.ToString() + " , Activa = " + activo + " WHERE IdReglaRec = " + id_regla; } Persistencia.SentenciasSQL.InsertarGenerico(sqlActualizar); form_anterior.cargarDatagrid(); this.Close(); } else { if (textBox_descripcion.Text != "") { sqlInsertar = "INSERT INTO com_reglasrec (RefRegla, Descripcion, IdComunero, IdFormaPago, IdCC, Activa) VALUES ('" + textBox_Regla.Text + "','" + textBox_descripcion.Text + "'," + id_comunero + ", " + comboBox_FPago.SelectedValue.ToString() + " , " + comboBox_Cuenta.SelectedValue.ToString() + "," + activo + ")"; } else { sqlInsertar = "INSERT INTO com_reglasrec (RefRegla, IdComunero, IdFormaPago, IdCC, Activa) VALUES ('" + textBox_Regla.Text + "'," + id_comunero + ", " + comboBox_FPago.SelectedValue.ToString() + " , " + comboBox_Cuenta.SelectedValue.ToString() + "," + activo + ")"; } Persistencia.SentenciasSQL.InsertarGenerico(sqlInsertar); form_anterior.cargarDatagrid(); this.Close(); } }