private void btngrabar_Click(object sender, EventArgs e) { if (U_Validacion()) { var tmpcursor = new DataTable(); var BL = new tb_plla_rubrosingresoBL(); var BE = new tb_plla_rubrosingreso(); 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) { var BL1 = new tb_plla_rubrosingresoBL(); var BE1 = new tb_plla_rubrosingreso(); BE1.rubroid = txtsigla.Text.ToString().Trim() + txtcodigo.Text.ToString().Trim(); BE1.tipoplla = cmbtipoplanilla.SelectedValue.ToString(); BE1.norden = 1; BE1.incluir_blanco = 0; BE1.nestado = 1; tmpcursor = BL1.GetAll_CONSULTA1(VariablesPublicas.EmpresaID, BE1).Tables[0]; if (tmpcursor.Rows.Count > 0) { var BLm = new tb_plla_rubrosingresoBL(); var BEm = new tb_plla_rubrosingreso(); BEm.tipo = GlobalVars.GetInstance().TipoRubroPlanillaIngreso; BEm.tipoplla = cboTipoplanilla.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]["rubroname"] = txtdescripcion.Text; tmpcursor.Rows[0]["status"] = (chkactivo.Checked ? "0" : "9"); tmpcursor.Rows[0]["tipoplla"] = cmbtipoplanilla.SelectedValue; tmpcursor.Rows[0]["edita"] = (chkeditable.Checked ? 1 : 0); tmpcursor.Rows[0]["visible"] = (chkvisible.Checked ? 1 : 0); tmpcursor.Rows[0]["modalidad"] = cmbmodalidad.SelectedValue; tmpcursor.Rows[0]["tipocalculo"] = cmbtipocalculo.SelectedValue; tmpcursor.Rows[0]["tiporubro"] = cmbtipo.SelectedValue; tmpcursor.Rows[0]["rubropdt"] = cmbrubrorpts.SelectedValue; tmpcursor.Rows[0]["montofijo"] = VariablesPublicas.StringtoDecimal(txtmontofijo.Text); tmpcursor.Rows[0]["redondeo"] = VariablesPublicas.StringtoDecimal(txtredondeo.Text); tmpcursor.AcceptChanges(); var BLIU = new tb_plla_rubrosingresoBL(); if (BLIU.Insert_Update(VariablesPublicas.EmpresaID, tmpcursor)) { seguridadlog(); U_CancelarEdicion(0); } else { Frm_Class.ShowError(BLIU.Sql_Error, this); } } }