public void Delete(int _phutrachID) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.PhuTrachChamCong phutrach = db.PhuTrachChamCongs.FirstOrDefault(x => x.PTCCID == _phutrachID); db.PhuTrachChamCongs.Remove(phutrach); db.SaveChanges(); db.Dispose(); }
public void Update(int _phutrachID, int _accountID, int _donviID, bool _trangthai) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.PhuTrachChamCong phutrach = db.PhuTrachChamCongs.FirstOrDefault(x => x.PTCCID == _phutrachID); phutrach.ACCID = _accountID; phutrach.DVID = _donviID; phutrach.PCCCStatus = _trangthai; db.SaveChanges(); db.Dispose(); }
private string ConvertStatus(Models.PhuTrachChamCong _ptcc) { if (_ptcc.PCCCStatus) { return("Kích hoạt"); } else { return("Khóa"); } }
public void Insert(int _accountID, int _donviID, bool _trangthai) { Models.EmployeeManagementEntities db = new EmployeeManagementEntities(); Models.PhuTrachChamCong phutrach = db.PhuTrachChamCongs.FirstOrDefault(x => x.ACCID == _accountID && x.DVID == _donviID); if (phutrach != null) { db.PhuTrachChamCongs.Remove(phutrach); } phutrach = new PhuTrachChamCong(); phutrach.ACCID = _accountID; phutrach.DVID = _donviID; phutrach.PCCCStatus = _trangthai; db.PhuTrachChamCongs.Add(phutrach); db.SaveChanges(); db.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { if (this.Page.RouteData.Values["phutrach"] != null) { try { int phutrachID = Convert.ToInt32(this.Page.RouteData.Values["phutrach"]); Models.PhuTrachChamCongEntity ptccEntity = new Models.PhuTrachChamCongEntity(); Models.PhuTrachChamCong phutrach = ptccEntity.Find(phutrachID); if (phutrach == null) { this.RedirectToHomePage(); } else { PTCCForm.PhuTrachChamCong = phutrach; } }catch { this.RedirectToHomePage(); } } }