Example #1
0
    public static bool check_user_have_menu()
    {
        object v_obj_id_user_login = HttpContext.Current.Session[SESSION.UserID];
        if (v_obj_id_user_login == null) return false;
        else
        {
            if (get_chuc_nang_without_query() == "Default.aspx") return true;

            if (CIPConvert.ToDecimal(v_obj_id_user_login) == -1)
            {
                return false;
            }
            else
            {
                DS_HT_NGUOI_SU_DUNG v_ds_ht_nguoi_su_dung = new DS_HT_NGUOI_SU_DUNG();
                US_HT_NGUOI_SU_DUNG v_us_ht_nguoi_su_dung = new US_HT_NGUOI_SU_DUNG();
                v_us_ht_nguoi_su_dung.FillDataset(v_ds_ht_nguoi_su_dung, "where id = " + v_obj_id_user_login.ToString());
                if (v_ds_ht_nguoi_su_dung.HT_NGUOI_SU_DUNG.Count < 1) return false;
                v_us_ht_nguoi_su_dung = new US_HT_NGUOI_SU_DUNG(CIPConvert.ToDecimal(v_obj_id_user_login));
                US_HT_USER_GROUP v_us_ht_user_group = new US_HT_USER_GROUP(v_us_ht_nguoi_su_dung.dcID_USER_GROUP);
                US_HT_QUYEN_GROUP v_us_ht_quyen_group = new US_HT_QUYEN_GROUP();
                DS_HT_QUYEN_GROUP v_ds_ht_quyen_group = new DS_HT_QUYEN_GROUP();
                v_us_ht_quyen_group.FillDataset(v_ds_ht_quyen_group, "where id_user_group = " + v_us_ht_user_group.dcID +
                    " and id_quyen in (select id from ht_chuc_nang where url_form like N'%" + get_chuc_nang() + "%' and trang_thai_yn ='Y' and hien_thi_yn='Y')");
                if (v_ds_ht_quyen_group.HT_QUYEN_GROUP.Count < 1)
                {
                    v_ds_ht_quyen_group.Clear();
                    v_us_ht_quyen_group.FillDataset(v_ds_ht_quyen_group, "where id_user_group = " + v_us_ht_user_group.dcID +
                    " and id_quyen in (select id from ht_chuc_nang where url_form like N'%" + get_chuc_nang_without_query() + "%' and trang_thai_yn ='Y' and hien_thi_yn='Y')");
                    if (v_ds_ht_quyen_group.HT_QUYEN_GROUP.Count < 1) return false;
                };
            }

        }
        return true;
    }
    private void update_quyen_chuc_nang()
    {
        m_lbl_mess.Text = "";
            string v_str_id_chuc_nangs = "";
            foreach (ListItem ltTemp in this.m_lst_chuc_nang_user.Items)
            {

                v_str_id_chuc_nangs += ltTemp.Value + ",";
            }
            US_HT_QUYEN_GROUP v_us_quyen_group = new US_HT_QUYEN_GROUP();
            v_us_quyen_group.update_quyen_group(CIPConvert.ToDecimal(m_cbo_user_group.SelectedValue),v_str_id_chuc_nangs);
            m_lbl_mess.Text ="Cập nhật quyền sử dụng chức năng cho nhóm thành công";
    }