private void btnnuevo_Click(object sender, EventArgs e) { if (!(TabControl1.SelectedIndex == 0)) { TabControl1.SelectedIndex = 0; } u_n_opsel = 1; Blanquear(); U_RefrescaControles(); TabControl1.SelectedIndex = 0; TabControl1.SelectedIndex = 1; var BL = new tb_plla_rubrosaportacionesBL(); var BE = new tb_plla_rubrosaportaciones(); BE.tipo = GlobalVars.GetInstance().TipoRubroPlanillaAportacion; BE.tipoplla = cmbfiltrotipoplanilla.SelectedValue.ToString(); txtcodigo.Text = BL.GetMAX_CODIGORUBROPLANILLA(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0].Rows[0]["maximo_codigo"].ToString(); cmbtipoplanilla.SelectedValue = cmbfiltrotipoplanilla.SelectedValue; txtsigla.Text = GlobalVars.GetInstance().TipoRubroPlanillaAportacion; chkactivo.Checked = true; txtdescripcion.Focus(); }
private void btngrabar_Click(object sender, EventArgs e) { if (U_Validacion()) { var tmpcursor = new DataTable(); var BL = new tb_plla_rubrosaportacionesBL(); var BE = new tb_plla_rubrosaportaciones(); BE.rubroid = txtsigla.Text.ToString().Trim() + txtcodigo.Text.ToString().Trim(); BE.tipoplla = cmbtipoplanilla.SelectedValue.ToString(); BE.norden = 1; BE.incluir_blanco = 0; BE.nestado = 1; tmpcursor = BL.GetAll_CONSULTA1(VariablesPublicas.EmpresaID, BE).Tables[0]; if (u_n_opsel == 1) { tmpcursor = BL.GetAll_CONSULTA1(VariablesPublicas.EmpresaID, BE).Tables[0]; if (tmpcursor.Rows.Count > 0) { var BLm = new tb_plla_rubrosaportacionesBL(); var BEm = new tb_plla_rubrosaportaciones(); BEm.tipo = GlobalVars.GetInstance().TipoRubroPlanillaAportacion; BEm.tipoplla = cmbtipoplanilla.SelectedValue.ToString(); txtcodigo.Text = BLm.GetMAX_CODIGORUBROPLANILLA(VariablesPublicas.EmpresaID.ToString(), BEm).Tables[0].Rows[0]["maximo_codigo"].ToString(); } tmpcursor.Rows.Add(VariablesPublicas.InsertIntoTable(tmpcursor)); tmpcursor.Rows[0]["rubroid"] = txtsigla.Text + txtcodigo.Text; tmpcursor.Rows[0]["status"] = '0'; } tmpcursor.Rows[0]["tipoplla"] = cmbtipoplanilla.SelectedValue; tmpcursor.Rows[0]["rubroname"] = txtdescripcion.Text; tmpcursor.Rows[0]["tiporubro"] = cmbtipo.SelectedValue; tmpcursor.Rows[0]["redondeo"] = 0; tmpcursor.Rows[0]["montofijo"] = 0; tmpcursor.Rows[0]["visible"] = (chkvisible.Checked ? 1 : 0); tmpcursor.Rows[0]["edita"] = (chkeditable.Checked ? 1 : 0); tmpcursor.Rows[0]["rubropdt"] = cmbrubrorpts.SelectedValue; tmpcursor.Rows[0]["status"] = (chkactivo.Checked ? '0' : '9'); tmpcursor.AcceptChanges(); var BLIU = new tb_plla_rubrosaportacionesBL(); if (BLIU.Insert_Update(VariablesPublicas.EmpresaID, tmpcursor)) { seguridadlog(); U_CancelarEdicion(0); } else { Frm_Class.ShowError(BLIU.Sql_Error, this); } } }