Beispiel #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["phongtangdanhhieu"] != null)
         {
             try
             {
                 int danhhieuID = Convert.ToInt32(this.Page.RouteData.Values["phongtangdanhhieu"]);
                 Models.PhongTangDanhHieuEntity dhEntity = new Models.PhongTangDanhHieuEntity();
                 Models.PhongTangDanhHieu       danhhieu = dhEntity.Find(danhhieuID);
                 if (danhhieu == null)
                 {
                     this.RedirectToIndex();
                 }
             }
             catch
             {
                 this.RedirectToIndex();
             }
         }
         else if (this.Page.RouteData.Values["nhanvien"] != null)
         {
             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();
             }
         }
         else
         {
             this.RedirectToIndex();
         }
     }
     else
     {
         Response.Redirect("~/");
     }
 }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Page.RouteData.Values["phongtangdanhhieu"] != null)
     {
         this.UpdateStatus();
         _danhhieuID = Convert.ToInt32(this.Page.RouteData.Values["phongtangdanhhieu"]);
         Models.PhongTangDanhHieu danhhieu = _danhhieuEntity.Find(_danhhieuID);
         _nhanvienID = danhhieu.NVID;
         if (!this.Page.IsPostBack)
         {
             txtTen.Text     = danhhieu.PTDHTen;
             txtHoiDong.Text = danhhieu.PTDHHoiDong;
             if (danhhieu.PTDHNgay != DateTime.MinValue)
             {
                 dpkNgayThang.SelectedDate = danhhieu.PTDHNgay;
             }
         }
     }
     else
     {
         this.CreateStatus();
         _nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]);
     }
 }