void data_cbo_coleccionid()
 {
     try
     {
         tb_pt_coleccionBL BL = new tb_pt_coleccionBL();
         tb_pt_coleccion BE = new tb_pt_coleccion();
         coleccionid.DataSource = BL.GetAll(EmpresaID, BE).Tables[0];
         coleccionid.ValueMember = "coleccionid";
         coleccionid.DisplayMember = "coleccionname";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void Update()
        {
            try
            {
                if (coleccionid.Text.Trim().Length != 3)
                {
                    MessageBox.Show("Falta Codigo Coleccion !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    if (coleccionname.Text.Trim().Length == 0)
                    {
                        MessageBox.Show("Ingrese Nombre de Coleccion", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        var BL = new tb_pt_coleccionBL();
                        var BE = new tb_pt_coleccion();

                        BE.coleccionid = coleccionid.Text.Trim().PadLeft(3, '0');
                        BE.coleccionname = coleccionname.Text.ToUpper();
                        BE.usuar = VariablesPublicas.Usuar.Trim();

                        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 Delete()
        {
            try
            {
                if (coleccionid.Text.Trim().Length != 3)
                {
                    MessageBox.Show("Falta Codigo Coleccion !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    var BL = new tb_pt_coleccionBL();
                    var BE = new tb_pt_coleccion();
                    BE.coleccionid = coleccionid.Text.Trim().PadLeft(3, '0');

                    if (BL.Delete(EmpresaID, BE))
                    {
                        SEGURIDAD_LOG("E");
                        MessageBox.Show("Datos Eliminados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        NIVEL_FORMS();
                        form_bloqueado(false);
                        data_Tablacoleccion();
                        btn_nuevo.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void form_cargar_datos(String posicion)
        {
            try
            {
                var BL = new tb_pt_coleccionBL();
                var BE = new tb_pt_coleccion();
                var dt = new DataTable();
                if (coleccionid.Text.Trim().Length > 0)
                {
                    BE.coleccionid = coleccionid.Text.Trim().PadLeft(3, '0');
                }
                BE.posicion = posicion.Trim();

                dt = BL.GetAll_paginacion(EmpresaID, BE).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    limpiar_documento();
                    ssModo = "EDIT";

                    coleccionid.Text = dt.Rows[0]["coleccionid"].ToString().Trim();
                    coleccionname.Text = dt.Rows[0]["coleccionname"].ToString().Trim();

                    btn_editar.Enabled = true;
                    btn_eliminar.Enabled = true;
                    btn_imprimir.Enabled = true;

                    btn_primero.Enabled = true;
                    btn_anterior.Enabled = true;
                    btn_siguiente.Enabled = true;
                    btn_ultimo.Enabled = true;

                    btn_log.Enabled = true;
                    btn_salir.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void data_Tablacoleccion()
        {
            try
            {
                if (Tablacoleccion.Rows.Count > 0)
                {
                    Tablacoleccion.Rows.Clear();
                }
                var BL = new tb_pt_coleccionBL();
                var BE = new tb_pt_coleccion();

                BE.coleccionname = txt_criterio.Text.Trim().ToUpper();

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