private void LlenarCombo() { eFact_I_Bj.DB.Plantilla db = new eFact_I_Bj.DB.Plantilla(Aplicacion.Sesion); List<eFact_I_Bj.Entidades.Plantilla> listPlantillas = new List<eFact_I_Bj.Entidades.Plantilla>(); db.Lista(listPlantillas); DescrPlantillaComboBox.ValueMember = "IdPlantilla"; DescrPlantillaComboBox.DisplayMember = "DescrPlantilla"; DescrPlantillaComboBox.DataSource = listPlantillas; DescrPlantillaComboBox.SelectedIndex = -1; }
private void EjecutarButton_Click(object sender, EventArgs e) { eFact_I_Bj.DB.Plantilla db = new eFact_I_Bj.DB.Plantilla(Aplicacion.Sesion); eFact_I_Bj.Entidades.Plantilla plantilla = new eFact_I_Bj.Entidades.Plantilla(); plantilla.DescrPlantilla = DescrPlantillaTextBox.Text; plantilla.Leyenda1 = Leyenda1TextBox.Text; plantilla.Leyenda2 = Leyenda2TextBox.Text; plantilla.Leyenda3 = Leyenda3TextBox.Text; plantilla.Leyenda4 = Leyenda4TextBox.Text; plantilla.Leyenda5 = Leyenda5TextBox.Text; plantilla.LeyendaMoneda = LeyendaMonedaTextBox.Text; plantilla.LeyendaBanco = LeyendaBancoTextBox.Text; if (eFact_I_Bj.RN.Plantilla.Modo.Alta == modo) { db.Insertar(plantilla); MessageBox.Show("Alta efectuada", "Atención", MessageBoxButtons.OK); } else { plantilla.IdPlantilla = Convert.ToInt32(DescrPlantillaComboBox.SelectedValue.ToString()); db.Modificar(plantilla); MessageBox.Show("Modificación efectuada", "Atención", MessageBoxButtons.OK); } }
private void DescrPlantillaComboBox_SelectedValueChanged(object sender, EventArgs e) { eFact_I_Bj.DB.Plantilla db = new eFact_I_Bj.DB.Plantilla(Aplicacion.Sesion); eFact_I_Bj.Entidades.Plantilla plantilla = new eFact_I_Bj.Entidades.Plantilla(); if (DescrPlantillaComboBox.SelectedValue != null) { plantilla.IdPlantilla = Convert.ToInt32(DescrPlantillaComboBox.SelectedValue.ToString()); db.Leer(plantilla); if (plantilla.DescrPlantilla != "") { EjecutarButton.Enabled = true; DescrPlantillaTextBox.Text = plantilla.DescrPlantilla; Leyenda1TextBox.Text = plantilla.Leyenda1; Leyenda2TextBox.Text = plantilla.Leyenda2; Leyenda3TextBox.Text = plantilla.Leyenda3; Leyenda4TextBox.Text = plantilla.Leyenda4; Leyenda5TextBox.Text = plantilla.Leyenda5; LeyendaMonedaTextBox.Text = plantilla.LeyendaMoneda; LeyendaBancoTextBox.Text = plantilla.LeyendaBanco; EjecutarButton.Enabled = true; } } }