protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["User"] != null)
         {
             NguoidungModel nguoidung = Session["User"] as NguoidungModel;
             if (nguoidung != null)
             {
                 if (nguoidung.PK_iNguoidungID > 0)
                 {
                     List<NguoidungModel> glstNguoidung = new TaiKhoanController().NguoidungGetbyPK(nguoidung.PK_iNguoidungID);
                     if (glstNguoidung.Count < 1)
                     {
                         Response.Redirect("~/Login.aspx");
                     }
                 }
             }
         }
         else
         {
             Response.Redirect("~/Login.aspx");
         }
     }
 }
Example #2
0
 protected void rptTaikhoan_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         NguoidungModel nguoidung = e.Item.DataItem as NguoidungModel;
         if (nguoidung != null)
         {
             Literal ltrQuyen = e.Item.FindControl("ltrQuyen") as Literal;
             if (ltrQuyen != null)
             {
                 TaiKhoanController    taikhoanController = new TaiKhoanController();
                 List <PhanquyenModel> glstPhanquyen      = taikhoanController.PhanquyenGetbyFK_iNguoidungID(nguoidung.PK_iNguoidungID);
                 if (glstPhanquyen.Count > 0)
                 {
                     List <QuyenModel> glstQuyen = taikhoanController.QuyenGetbyPK(glstPhanquyen[0].FK_iQuyenID);
                     if (glstQuyen.Count > 0)
                     {
                         ltrQuyen.Text = glstQuyen[0].sTenQuyen;
                     }
                 }
             }
         }
     }
 }