Beispiel #1
0
 public void Delete(int _danhhieuID)
 {
     Models.EmployeeManagementEntities db       = new EmployeeManagementEntities();
     Models.PhongTangDanhHieu          danhhieu = db.PhongTangDanhHieux.FirstOrDefault(x => x.PTDHID == _danhhieuID);
     db.PhongTangDanhHieux.Remove(danhhieu);
     db.SaveChanges();
     db.Dispose();
 }
Beispiel #2
0
 public void Update(int _danhhieuID, string _danhhieu, DateTime _ngaythang, string _hoidong)
 {
     Models.EmployeeManagementEntities db       = new EmployeeManagementEntities();
     Models.PhongTangDanhHieu          danhhieu = db.PhongTangDanhHieux.FirstOrDefault(x => x.PTDHID == _danhhieuID);
     danhhieu.PTDHTen     = _danhhieu;
     danhhieu.PTDHNgay    = _ngaythang;
     danhhieu.PTDHHoiDong = _hoidong;
     db.SaveChanges();
     db.Dispose();
 }
Beispiel #3
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 #4
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"]);
     }
 }