public void Xoa(DateTime ID, string MaNV, string MaCa, string MaKV) { try { ChamCong cc = db.ChamCong.Find(ID, MaNV, MaCa, MaKV); if (cc != null) { db.ChamCong.Remove(cc); db.SaveChanges(); } } catch { } }
public void Them(ChamCong cc) { try { var c = new ChamCong() { ID = cc.ID, MaNV = cc.MaNV, MaCa = cc.MaCa, MaKV = cc.MaKV, Thang = cc.Thang, Nam = cc.Nam, TinhTrang = cc.TinhTrang }; db.ChamCong.Add(c); db.SaveChanges(); } catch { } }
//Cập nhật public void CapNhat(ChamCong cc) { try { ChamCong c = db.ChamCong.Find(cc.ID, cc.MaNV, cc.MaCa, cc.MaKV); if (c != null) { c.ID = cc.ID; c.MaNV = cc.MaNV; c.MaCa = cc.MaCa; c.MaKV = cc.MaKV; c.Thang = cc.Thang; c.Nam = cc.Nam; c.TinhTrang = cc.TinhTrang; db.SaveChanges(); } } catch { } }