private void ValidaPerfil2()
        {
            if (idper2.Text.Trim().Length == 9)
            {
                if ( idper.Text.Trim().Substring(0, 6) == idper2.Text.Trim().Substring(0, 6) )
                {
                    var BL = new perfilBL();
                    var BE = new tb_perfil();
                    var dt = new DataTable();

                    BE.idper = idper2.Text.Trim();

                    dt = BL.GetAll(EmpresaID, BE).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        idper2.Text = dt.Rows[0]["idper"].ToString().Trim();
                        nbper2.Text = dt.Rows[0]["nbper"].ToString().Trim();
                    }
                    else
                    {
                        idper2.Text = string.Empty;
                        nbper2.Text = string.Empty;
                    }
                }
                else
                {
                    MessageBox.Show("Perfil Destino no tiene el mismo DOMINIO y MODULO que el Perfil Origen !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    idper2.Text = string.Empty;
                    nbper2.Text = string.Empty;
                }
            }
            else
            {
                idper2.Text = string.Empty;
                nbper2.Text = string.Empty;
            }
        }
        private void ValidaPerfil()
        {
            if (idper.Text.Trim().Length == 9)
            {
                var BL = new perfilBL();
                var BE = new tb_perfil();
                var dt = new DataTable();

                BE.idper = idper.Text.Trim();

                dt = BL.GetAll(EmpresaID, BE).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    idper.Text = dt.Rows[0]["idper"].ToString().Trim();
                    nbper.Text = dt.Rows[0]["nbper"].ToString().Trim();
                }
                else
                {
                    idper.Text = string.Empty;
                    nbper.Text = string.Empty;
                }
            }
            else
            {
                idper.Text = string.Empty;
                nbper.Text = string.Empty;
            }
        }
        private void data_Tablaperfil()
        {
            try
            {
                if (Tablaperfil != null)
                {
                    Tablaperfil.Rows.Clear();
                }
                var BL = new perfilBL();
                var BE = new tb_perfil();

                var xaa = dominioid.SelectedValue.ToString().Trim() + moduloid.SelectedValue.ToString().Trim();
                BE.idper = xaa;

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