protected void Page_Load(object sender, EventArgs e) { if (this.Page.RouteData.Values["kekhai"] != null) { this.UpdateStatus(); _kekhaiID = Convert.ToInt32(this.Page.RouteData.Values["kekhai"]); Models.KeKhai kekhai = _kkEntity.Find(_kekhaiID); _nhanvienID = kekhai.NVID; if (!this.Page.IsPostBack) { txtNam.Text = kekhai.KKNam.ToString(); dpkNgayKeKhai.SelectedDate = kekhai.KKNgayKeKhai; dpkNgayNhap.SelectedDate = kekhai.KKNgayNhap; txtChucVu.Text = kekhai.KKChucVu; txtCoQuan.Text = kekhai.KKCoQuan; txtHoKhau.Text = kekhai.KKHoKhau; txtChoO.Text = kekhai.KKChoO; txtVoChong.Text = kekhai.KKVoChong; dpkVCDOB.SelectedDate = kekhai.KKVCDOB; txtVCChucVu.Text = kekhai.KKVCChucVu; txtVCCoQuan.Text = kekhai.KKVCCoQuan; txtVCHoKhau.Text = kekhai.KKVCHoKhau; txtVCChoO.Text = kekhai.KKVCChoO; } } else { this.CreateStatus(); _nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]); } }
public void Delete(int _kekhaiID) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.KeKhai kekhai = db.KeKhais.FirstOrDefault(x => x.KKID == _kekhaiID); db.KeKhais.Remove(kekhai); db.SaveChanges(); db.Dispose(); }
public void Update(int _kekhaiID, int _nam, DateTime _ngaykekhai, DateTime _ngaynhap, string _chucvu, string _coquan, string _hokhau, string _choo, string _vochong, DateTime _vcDOB, string _vcChucVu, string _vcCoQuan, string _vcHoKhau, string _vcChoO) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.KeKhai kekhai = db.KeKhais.FirstOrDefault(x => x.KKID == _kekhaiID); kekhai.KKNam = _nam; kekhai.KKNgayKeKhai = _ngaykekhai; kekhai.KKNgayNhap = _ngaynhap; kekhai.KKChucVu = _chucvu; kekhai.KKCoQuan = _coquan; kekhai.KKHoKhau = _hokhau; kekhai.KKChoO = _choo; kekhai.KKVoChong = _vochong; kekhai.KKVCDOB = _vcDOB; kekhai.KKVCChucVu = _vcChucVu; kekhai.KKVCCoQuan = _vcCoQuan; kekhai.KKVCHoKhau = _vcHoKhau; kekhai.KKVCChoO = _vcChoO; db.SaveChanges(); db.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["account"] != null) { string email = Session["account"].ToString(); Models.AccountEntity accEntity = new Models.AccountEntity(); Models.Account account = accEntity.FindByEmail(email); if (account == null) { this.RedirectToIndex(); } else if (account.ACCChucNang > 1) { if (!account.ACCUpKeKhai) { this.RedirectToIndex(); } else if (this.Page.RouteData.Values["giaitrinh"] != null) { try { int concaiID = Convert.ToInt32(this.Page.RouteData.Values["giaitrinh"]); Models.GiaiTrinhEntity gtEntity = new Models.GiaiTrinhEntity(); Models.GiaiTrinh giaitrinh = gtEntity.Find(concaiID); if (giaitrinh == null) { this.RedirectToIndex(); } else if (giaitrinh.KeKhai.NVID != account.NVID) { this.RedirectToIndex(); } } catch { this.RedirectToIndex(); } } else if (this.Page.RouteData.Values["kekhai"] != null) { try { int kekhaiID = Convert.ToInt32(this.Page.RouteData.Values["kekhai"]); Models.KeKhaiEntity kkEntity = new Models.KeKhaiEntity(); Models.KeKhai kekhai = kkEntity.Find(kekhaiID); if (kekhai == null) { this.RedirectToIndex(); } else if (kekhai.NVID != account.NVID) { this.RedirectToIndex(); } } catch { this.RedirectToIndex(); } } else { this.RedirectToIndex(); } } else if (this.Page.RouteData.Values["giaitrinh"] != null) { try { int concaiID = Convert.ToInt32(this.Page.RouteData.Values["giaitrinh"]); Models.GiaiTrinhEntity gtEntity = new Models.GiaiTrinhEntity(); Models.GiaiTrinh giaitrinh = gtEntity.Find(concaiID); if (giaitrinh == null) { this.RedirectToIndex(); } } catch { this.RedirectToIndex(); } } else if (this.Page.RouteData.Values["kekhai"] != null) { try { int kekhaiID = Convert.ToInt32(this.Page.RouteData.Values["kekhai"]); Models.KeKhaiEntity kkEntity = new Models.KeKhaiEntity(); Models.KeKhai kekhai = kkEntity.Find(kekhaiID); if (kekhai == null) { this.RedirectToIndex(); } } catch { this.RedirectToIndex(); } } else { this.RedirectToIndex(); } } else { this.RedirectToIndex(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["account"] != null) { string email = Session["account"].ToString(); Models.AccountEntity accEntity = new Models.AccountEntity(); Models.Account account = accEntity.FindByEmail(email); if (account == null) { this.RedirectToIndex(); } else if (account.ACCChucNang > 1) { if (!account.ACCUpKeKhai) { this.RedirectToIndex(); } else if (this.Page.RouteData.Values["taisan"] != null) { try { int taisanID = Convert.ToInt32(this.Page.RouteData.Values["taisan"]); Models.TaiSanNuocNgoaiEntity tsEntity = new Models.TaiSanNuocNgoaiEntity(); Models.TaiSanNuocNgoai taisan = tsEntity.Find(taisanID); if (taisan == null) { this.RedirectToIndex(); } else if (taisan.KeKhai.NVID != account.NVID) { this.RedirectToIndex(); } } catch { this.RedirectToIndex(); } } else if (this.Page.RouteData.Values["kekhai"] != null) { try { int kekhaiID = Convert.ToInt32(this.Page.RouteData.Values["kekhai"]); Models.KeKhaiEntity kkEntity = new Models.KeKhaiEntity(); Models.KeKhai kekhai = kkEntity.Find(kekhaiID); if (kekhai == null) { this.RedirectToIndex(); } else if (kekhai.NVID != account.NVID) { this.RedirectToIndex(); } } catch { this.RedirectToIndex(); } } else { this.RedirectToIndex(); } } else if (this.Page.RouteData.Values["taisan"] != null) { try { int taisanID = Convert.ToInt32(this.Page.RouteData.Values["taisan"]); Models.TaiSanNuocNgoaiEntity tsEntity = new Models.TaiSanNuocNgoaiEntity(); Models.TaiSanNuocNgoai taisan = tsEntity.Find(taisanID); if (taisan == null) { this.RedirectToIndex(); } } catch { this.RedirectToIndex(); } } else if (this.Page.RouteData.Values["kekhai"] != null) { try { int kekhaiID = Convert.ToInt32(this.Page.RouteData.Values["kekhai"]); Models.KeKhaiEntity kkEntity = new Models.KeKhaiEntity(); Models.KeKhai kekhai = kkEntity.Find(kekhaiID); if (kekhai == null) { this.RedirectToIndex(); } } catch { this.RedirectToIndex(); } } else { this.RedirectToIndex(); } } else { this.RedirectToIndex(); } }
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) //validate đăng nhập { this.RedirectToIndex(); } else if (account.ACCChucNang > 1) // nhân viên { if (!account.ACCUpKeKhai) { this.RedirectToIndex(); } else if (this.Page.RouteData.Values["kekhai"] != null) { try { _kekhaiID = Convert.ToInt32(this.Page.RouteData.Values["kekhai"]); Models.KeKhaiEntity kkEntity = new Models.KeKhaiEntity(); Models.KeKhai kekhai = kkEntity.Find(_kekhaiID); if (kekhai == null) { this.RedirectToIndex(); } else if (kekhai.NVID != account.NVID) { this.RedirectToIndex(); } else { pnlContent.Visible = true; } } catch { this.RedirectToIndex(); } } else if (this.Page.RouteData.Values["nhanvien"] != null) { try { int nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]); if (nhanvienID != account.NVID) { this.RedirectToIndex(); } else { 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 if (this.Page.RouteData.Values["kekhai"] != null) { try { _kekhaiID = Convert.ToInt32(this.Page.RouteData.Values["kekhai"]); Models.KeKhaiEntity kkEntity = new Models.KeKhaiEntity(); Models.KeKhai kekhai = kkEntity.Find(_kekhaiID); if (kekhai == null) { this.RedirectToIndex(); } else { pnlContent.Visible = true; } } 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("~/"); } }