protected void Page_Load(object sender, EventArgs e) { Models.NhanVienEntity nvEntity = new Models.NhanVienEntity(); if (this.Page.RouteData.Values["danhgia"] != null) { this.UpdateStatus(); _danhgiaID = Convert.ToInt32(this.Page.RouteData.Values["danhgia"]); Models.DanhGiaLaoDong danhgia = _dgEntity.Find(_danhgiaID); _nhanvienID = danhgia.NVID; if (!this.Page.IsPostBack) { dpkNgayThang.SelectedDate = danhgia.DGLDNgay; txtNam.Text = danhgia.DGLDNam.ToString(); txtChucDanh.Text = danhgia.DGLDChucDanh; txtDonVi.Text = danhgia.DGLDDonVi; txtNgheNghiep.Text = danhgia.DGLDNgheNghiep; txtBac.Text = danhgia.DGLDBac.ToString(); txtHeSoLuong.Text = danhgia.DGLDHeSoLuong.ToString(); txtKetQua.Text = danhgia.DGLDKetQua; txtDaoDuc.Text = danhgia.DGLDDaoDuc; txtTrachNhiem.Text = danhgia.DGLDTrachNhiem; txtNghiaVu.Text = danhgia.DGLDNghiaVu; txtUuDiem.Text = danhgia.DGLDUuDiem; ddlDanhGia.SelectedValue = danhgia.DGLDUuDiem; txtYKien.Text = danhgia.DGLDYKien; ddlThongNhat.SelectedValue = danhgia.DGLDThongNhat; } } else { this.CreateStatus(); _nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]); if (!this.Page.IsPostBack) { dpkNgayThang.SelectedDate = DateTime.Now; } } Models.NhanVien nhanvien = nvEntity.Find_NhanVien(_nhanvienID); lblHoTen.Text = nhanvien.NVTen; }
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) { this.RedirectToIndex(); } else if (account.ACCChucNang > 1) { if (!account.ACCUpDanhGia) { this.RedirectToIndex(); } else if (this.Page.RouteData.Values["danhgia"] != null) { try { int danhgiaID = Convert.ToInt32(this.Page.RouteData.Values["danhgia"]); Models.DanhGiaLaoDongEntity dgEntity = new Models.DanhGiaLaoDongEntity(); Models.DanhGiaLaoDong danhgia = dgEntity.Find(danhgiaID); if (danhgia == null) { this.RedirectToIndex(); } else if (danhgia.NVID != account.NVID) { this.RedirectToIndex(); } else { btExport.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["danhgia"] != null) { try { int danhgiaID = Convert.ToInt32(this.Page.RouteData.Values["danhgia"]); Models.DanhGiaLaoDongEntity dgEntity = new Models.DanhGiaLaoDongEntity(); Models.DanhGiaLaoDong danhgia = dgEntity.Find(danhgiaID); if (danhgia == null) { this.RedirectToIndex(); } else { btExport.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 { this.RedirectToIndex(); } }