void CargarCateplan()
 {
     tb_me_categoriaplanillaBL BL = new tb_me_categoriaplanillaBL();
     tb_me_categoriaplanilla BE = new tb_me_categoriaplanilla();
     DataTable dt = new DataTable();
     dt = BL.GetAll(EmpresaID, BE).Tables[0];
     if (dt.Rows.Count > 0)
     {
         cmb_cateplan.DataSource = dt;
         cmb_cateplan.DisplayMember = "cateplanname";
         cmb_cateplan.ValueMember = "cateplanid";
     }
 }
        private void _CargarCategoria()
        {
            var BL = new tb_me_categoriaplanillaBL();
            var BE = new tb_me_categoriaplanilla();
            var tbCategoria = new DataTable();
            tbCategoria = BL.GetAll(EmpresaID, BE).Tables[0];

            if (tbCategoria.Rows.Count > 0)
            {
                cmb_categoria.DataSource = tbCategoria;
                cmb_categoria.ValueMember = "cateplanid";
                cmb_categoria.DisplayMember = "cateplanname";
            }
        }
        private void Update()
        {
            try
            {
                if (txtcatplanillaid.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Falta Codigo de Categoria !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    if (txtcatplanillaname.Text.Trim().Length == 0)
                    {
                        MessageBox.Show("Ingrese Nombre de Categoria", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        var BL = new tb_me_categoriaplanillaBL();
                        var BE = new tb_me_categoriaplanilla();

                        BE.cateplanid = txtcatplanillaid.Text.ToString();
                        BE.cateplanname = txtcatplanillaname.Text.ToString();

                        if (BL.Update(EmpresaID, BE))
                        {
                            SEGURIDAD_LOG("M");
                            MessageBox.Show("Datos Modificado Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            procesado = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void Insert()
        {
            try
            {
                if (txtcatplanillaname.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Ingrese Nombre de Categoria", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    var BL = new tb_me_categoriaplanillaBL();
                    var BE = new tb_me_categoriaplanilla();

                    BE.cateplanname = txtcatplanillaname.Text.ToString();

                    if (BL.Insert(EmpresaID, BE))
                    {
                        MessageBox.Show("Datos Grabados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        procesado = true;
                    }
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void Delete()
        {
            try
            {
                if (txtcatplanillaid.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Falta Codigo Categoria !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    var BL = new tb_me_categoriaplanillaBL();
                    var BE = new tb_me_categoriaplanilla();
                    BE.cateplanid = txtcatplanillaid.Text.ToString();

                    if (BL.Delete(EmpresaID, BE))
                    {
                        SEGURIDAD_LOG("E");
                        MessageBox.Show("Datos Eliminados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        NIVEL_FORMS();
                        form_bloqueado(false);
                        limpiar_documento();
                        data_Tablacategoria();
                        btn_nuevo.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void data_Tablacategoria()
        {
            try
            {
                if (Tablacategoria.Rows.Count > 0)
                {
                    Tablacategoria.Rows.Clear();
                }
                var BL = new tb_me_categoriaplanillaBL();
                var BE = new tb_me_categoriaplanilla();

                BE.cateplanname = txtbusqueda.Text.Trim().ToUpper();

                Tablacategoria = BL.GetAll(EmpresaID, BE).Tables[0];
                if (Tablacategoria.Rows.Count > 0)
                {
                    btn_imprimir.Enabled = true;
                    dgb_catplanilla.DataSource = Tablacategoria;
                    dgb_catplanilla.Rows[0].Selected = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }