Example #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["trinhdotinhoc"] != null)
         {
             try
             {
                 int tinhocID = Convert.ToInt32(this.Page.RouteData.Values["trinhdotinhoc"]);
                 Models.TrinhDoTinHocEntity thEntity = new Models.TrinhDoTinHocEntity();
                 Models.TrinhDoTinHoc       tinhoc   = thEntity.Find(tinhocID);
                 if (tinhoc == null)
                 {
                     Response.Redirect("~/");
                 }
             }
             catch
             {
                 Response.Redirect("~/");
             }
         }
         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)
                 {
                     Response.Redirect("~/");
                 }
             }
             catch
             {
                 Response.Redirect("~/");
             }
         }
         else
         {
             Response.Redirect("~/");
         }
     }
     else
     {
         Response.Redirect("~/");
     }
 }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Page.RouteData.Values["trinhdotinhoc"] != null)
     {
         this.UpdateStatus();
         _tinhocID = Convert.ToInt32(this.Page.RouteData.Values["trinhdotinhoc"]);
         Models.TrinhDoTinHoc tinhoc = _tinhocEntity.Find(_tinhocID);
         _nhanvienID = tinhoc.NVID;
         if (!this.Page.IsPostBack)
         {
             txtTen.Text = tinhoc.TDTHTen;
             rblChungChi.SelectedValue = tinhoc.TDChungChi.ToString();
         }
     }
     else
     {
         this.CreateStatus();
         _nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]);
     }
 }