private void btngrabar_Click(object sender, EventArgs e) { if (U_Validacion()) { var tmpcursor = new DataTable(); var BL = new tb_plla_rubrospermanenteBL(); var BE = new tb_plla_rubrospermanente(); BE.rubro = 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_rubrospermanenteBL(); var BEm = new tb_plla_rubrospermanente(); BEm.tipo = GlobalVars.GetInstance().TipoRubroPlanillaPermanente; 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]["rubro"] = txtcodigo.Text; tmpcursor.Rows[0]["status"] = '0'; } tmpcursor.Rows[0]["tipoplla"] = cmbtipoplanilla.SelectedValue; tmpcursor.Rows[0]["tiporubro"] = cmbtipo.SelectedValue; tmpcursor.Rows[0]["rubroname"] = txtdescripcion.Text; tmpcursor.Rows[0]["modalidad"] = cmbmodalidad.SelectedValue; tmpcursor.Rows[0]["visible"] = (chkvisible.Checked ? 1 : 0); tmpcursor.Rows[0]["edita"] = (chkeditable.Checked ? 1 : 0); tmpcursor.Rows[0]["statusrubro"] = (chkrubro.Checked ? 1 : 0); tmpcursor.Rows[0]["status"] = (chkactivo.Checked ? '0' : '9'); if (cmbrubroingreso.SelectedValue != null) { tmpcursor.Rows[0]["codrubro"] = cmbrubroingreso.SelectedValue; } tmpcursor.AcceptChanges(); var BLIU = new tb_plla_rubrospermanenteBL(); if (BLIU.Insert_Update(VariablesPublicas.EmpresaID, tmpcursor)) { seguridadlog(); U_CancelarEdicion(0); } else { Frm_Class.ShowError(BLIU.Sql_Error, this); } } }