コード例 #1
0
 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;
     string xcodcosto = "";
     if (chkccosto.Checked)
     {
         if ((cmbfiltroccosto.SelectedValue != null))
         {
             xcodcosto = cmbfiltroccosto.SelectedValue.ToString();
             cmbccosto.SelectedValue = cmbfiltroccosto.SelectedValue;
         }
     }
     else
     {
         if ((cmbccosto.SelectedValue != null))
         {
             xcodcosto = cmbccosto.SelectedValue.ToString();
         }
     }
     if (xcodcosto.Trim().Length > 0)
     {
         tb_plla_cargosBL BL = new tb_plla_cargosBL();
         tb_plla_cargos BE = new tb_plla_cargos();
         BE.cencosid = xcodcosto;
         txtcodigo.Text = BL.GetAll_MaxCodigo(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0].Rows[0]["maximo_codigo"].ToString();
     }
     else
     {
         cmbccosto.SelectedValue = "";
         txtcodigo.Text = "";
     }
     chkactivo.Checked = true;
     rbdirecto.Checked = true;
     txtdescripcion.Focus();
 }
コード例 #2
0
 public void u_GeneraNuevoCodigo()
 {
     string xcodcosto = "";
     if ((cmbccosto.SelectedValue != null))
     {
         xcodcosto = cmbccosto.SelectedValue.ToString();
     }
     if (xcodcosto.Trim().Length == 0)
     {
         xcodcosto = "..:";
     }
     tb_plla_cargosBL BL = new tb_plla_cargosBL();
     tb_plla_cargos BE = new tb_plla_cargos();
     BE.cencosid = cmbccosto.SelectedValue.ToString();
     txtcodigo.Text = BL.GetAll_MaxCodigo(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0].Rows[0]["maximo_codigo"].ToString();
     //txtcodigo.Text = ocapa.UFC_MAXCODIGOPAG2100(GlobalVars.GetInstance.Company, xcodcosto);
 }
コード例 #3
0
        private void btngrabar_Click(object sender, EventArgs e)
        {
            if (U_Validacion())
            {
                DataTable tmpcursor = new DataTable();
                tb_plla_cargosBL BL = new tb_plla_cargosBL();
                tb_plla_cargos BE = new tb_plla_cargos();
                BE.cencosid = cmbccosto.SelectedValue.ToString();
                BE.cargoid = txtcodigo.Text.Trim();
                BE.norden = 0;
                BE.ver_blanco = 0;
                tmpcursor = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0];

                if (u_n_opsel == 1)
                {
                    tmpcursor = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0];

                    if (tmpcursor.Rows.Count > 0)
                    {
                        tb_plla_cargosBL BLMX = new tb_plla_cargosBL();
                        tb_plla_cargos BEMX = new tb_plla_cargos();
                        BEMX.cencosid = cmbccosto.SelectedValue.ToString();
                        txtcodigo.Text = BLMX.GetAll_MaxCodigo(VariablesPublicas.EmpresaID.ToString(), BEMX).Tables[0].Rows[0]["maximo_codigo"].ToString();
                    }
                    tmpcursor.Rows.Add(VariablesPublicas.InsertIntoTable(tmpcursor));
                    tmpcursor.Rows[0]["cargoid"] = txtcodigo.Text;
                    tmpcursor.Rows[0]["status"] = 1;
                }
                tmpcursor.Rows[0]["cargoname"] = txtdescripcion.Text;
                tmpcursor.Rows[0]["status"] = (chkactivo.Checked ? 1 : 0);
                tmpcursor.Rows[0]["cencosid"] = cmbccosto.SelectedValue;
                tmpcursor.Rows[0]["ocupaid"] = txtcodrtps.Text;
                tmpcursor.Rows[0]["tipogasto"] = (rbdirecto.Checked ? '1' : '2');
                tmpcursor.AcceptChanges();
                if (BL.Insert_Update(VariablesPublicas.EmpresaID, BE, tmpcursor))
                {
                    seguridadlog();
                    U_CancelarEdicion(0);
                }
                else
                {
                    Frm_Class.ShowError(BL.Sql_Error, this);
                }
            }
        }