Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["account"] != null)
     {
         Models.AccountEntity accEntity = new Models.AccountEntity();
         string         email           = Session["account"].ToString();
         Models.Account account         = accEntity.FindByEmail(email);
         if (account == null || account.ACCChucNang > 1)
         {
             Response.Redirect("~/");
         }
         else if (this.Page.RouteData.Values["chinhsach"] != null)
         {
             try
             {
                 int chinhsachID = Convert.ToInt32(this.Page.RouteData.Values["chinhsach"]);
                 Models.ChinhSachEntity csEntity  = new Models.ChinhSachEntity();
                 Models.ChinhSach       chinhsach = csEntity.Find(chinhsachID);
                 if (chinhsach == null)
                 {
                     this.RedirectToIndex();
                 }
             }
             catch
             {
                 this.RedirectToIndex();
             }
         }
         else if (this.Page.RouteData.Values["nhanvien"] != null)
         {
             try
             {
                 int nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]);
                 Models.NhanVienEntity nvEntity = new Models.NhanVienEntity();
                 Models.NhanVien       nhanvien = nvEntity.Find_NhanVien(nhanvienID);
                 if (nhanvien == null)
                 {
                     this.RedirectToIndex();
                 }
             }
             catch
             {
                 this.RedirectToIndex();
             }
         }
         else
         {
             this.RedirectToIndex();
         }
     }
     else
     {
         Response.Redirect("~/");
     }
 }