public void Loaduser()
 {
     try
     {
         int _chucVu  = Utils.CIntDef(ddlChucVu.SelectedValue);
         int _diaDiem = Utils.CIntDef(ddlDiaDiem.SelectedValue);
         var list     = (from a in db.USERs
                         join b in db.GROUPs on a.GROUP_ID equals b.GROUP_ID
                         where ((a.USER_NAME.Contains(txtKeyword.Value) || txtKeyword.Value == "") &&
                                (a.USER_CHINHANH == _diaDiem || 0 == _diaDiem) &&
                                (b.GROUP_TYPE == _chucVu || 0 == _chucVu))
                         select new
         {
             a.USER_ID,
             a.USER_NAME,
             a.USER_UN,
             a.USER_EMAIL,
             a.USER_PHONE,
             a.USER_ADDRESS,
             a.USER_GIOITINH,
             a.USER_NGAYSINH,
             a.USER_DANTOC,
             a.USER_NGUYENQUAN,
             a.USER_CMND,
             a.USER_CMND_NGAYCAP,
             a.USER_CMND_NOICAP,
             a.USER_NOIDK_HK,
             a.USER_EMAIL_CANHAN,
             a.USER_PHONE_CANHAN,
             a.USER_TRINHDO,
             a.NT_HOTEN,
             a.NT_MOIQUANHE,
             a.NT_SDT,
             a.USER_ACTIVE,
             a.USER_CHINHANH,
             b.GROUP_TYPE
         }).OrderByDescending(n => n.USER_ID).OrderBy(n => n.USER_ACTIVE == 0).ToList();
         if (list.Count > 0)
         {
             HttpContext.Current.Session["ktoan.listuser"] = list;
             ASPxGridView1_user.DataSource = list;
             ASPxGridView1_user.DataBind();
         }
         else
         {
             HttpContext.Current.Session["ktoan.listuser"] = null;
             ASPxGridView1_user.DataSource = list;
             ASPxGridView1_user.DataBind();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Load_ChucVu();
         Loaduser();
     }
     else
     {
         if (HttpContext.Current.Session["ktoan.listuser"] != null)
         {
             ASPxGridView1_user.DataSource = HttpContext.Current.Session["ktoan.listuser"];
             ASPxGridView1_user.DataBind();
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isPermission = _UnitDataRepo.checkPermissionPage("danh-sach-quan-tri.aspx", Utils.CIntDef(Session["groupId"]), Utils.CIntDef(Session["groupType"]));

            if (!isPermission)
            {
                Response.Write("<script>alert('Bạn không có quyền truy cập vào trang này');location.href='trang-chu.aspx';</script>");
            }
            if (!IsPostBack)
            {
                Loaduser();
            }
            else
            {
                if (HttpContext.Current.Session["ktoan.listuser"] != null)
                {
                    ASPxGridView1_user.DataSource = HttpContext.Current.Session["ktoan.listuser"];
                    ASPxGridView1_user.DataBind();
                }
            }
        }
 public void Loaduser()
 {
     try
     {
         var list = (from a in db.USERs
                     //join b in db.GROUPs on a.GROUP_ID equals b.GROUP_ID
                     where (a.USER_NAME.Contains(txtKeyword.Value) || txtKeyword.Value == "")
                     select new
         {
             a.USER_ID,
             a.USER_NAME,
             a.USER_UN,
             a.USER_EMAIL,
             a.USER_PHONE,
             a.USER_ADDRESS,
             a.USER_ACTIVE,
             a.GROUP_ID,
             //b.GROUP_TYPE
         }).OrderByDescending(n => n.USER_ID).ToList();
         if (list.Count > 0)
         {
             HttpContext.Current.Session["ktoan.listuser"] = list;
             ASPxGridView1_user.DataSource = list;
             ASPxGridView1_user.DataBind();
         }
         else
         {
             HttpContext.Current.Session["ktoan.listuser"] = null;
             ASPxGridView1_user.DataSource = list;
             ASPxGridView1_user.DataBind();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }