public void Update(int _thamgiaID, int _tochucID, string _chucvu, DateTime _tungay, string _noidung) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.ThamGiaChinhTriXaHois thamgia = db.ThamGiaChinhTriXaHois.FirstOrDefault(x => x.TGCTXHID == _thamgiaID); thamgia.CTXHID = _tochucID; thamgia.TGCTXHChucVu = _chucvu; thamgia.TGCTXHTuNgay = _tungay; thamgia.TGCTXHNoiDung = _noidung; db.SaveChanges(); db.Dispose(); }
public bool IsOfNhanVien(int _ctxhID, int _nhanvienID) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.ThamGiaChinhTriXaHois tgctxh = db.ThamGiaChinhTriXaHois.FirstOrDefault(x => x.CTXHID == _ctxhID && x.NVID == _nhanvienID); if (tgctxh == null) { return(false); } else { return(true); } }
protected void Page_Load(object sender, EventArgs e) { if (this.Page.RouteData.Values["ctxh"] != null) { try { int thamgiaID = Convert.ToInt32(this.Page.RouteData.Values["ctxh"]); Models.ThamGiaChinhTriXaHoiEntity thamgiaEntity = new Models.ThamGiaChinhTriXaHoiEntity(); Models.ThamGiaChinhTriXaHois thamgia = thamgiaEntity.Find(thamgiaID); if (thamgia == null) { Response.Redirect("~/NhanSu"); } else { lblNhanVien.Text = thamgia.NhanVien.NVTen; } } catch (Exception) { Response.Redirect("~/NhanSu"); } } else if (this.Page.RouteData.Values["nhanvien"] != null) { try { int nhanvienID = nhanvienID = Convert.ToInt32(this.Page.RouteData.Values["nhanvien"]); Models.NhanVienEntity nhanvienEntity = new Models.NhanVienEntity(); Models.NhanVien nhanvien = nhanvienEntity.Find_NhanVien(nhanvienID); if (nhanvien == null) { Response.Redirect("~/NhanSu"); } else { lblNhanVien.Text = nhanvien.NVTen; } } catch (Exception) { } } else { Response.Redirect("~/NhanSu"); } }
public Models.ThamGiaChinhTriXaHois Find(int _thamgiatochucID) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.ThamGiaChinhTriXaHois thamgiaTC = db.ThamGiaChinhTriXaHois.FirstOrDefault(x => x.TGCTXHID == _thamgiatochucID); return(thamgiaTC); }