public int insertPc(ePhanCong pc) { List <ePhanCong> p = new List <ePhanCong>(); var rpc = (from a in db.PhanCongs select new ePhanCong { MAPB = a.MAPB, MACT = a.MACT, MANV = a.MANV, SLNGAYCONG = a.SLNGAYCONG, }); p = rpc.ToList(); foreach (ePhanCong e in p) { if (e.MANV == pc.MANV && e.MAPB == pc.MAPB && e.MACT == pc.MACT) { return(0); } } PhanCong b = new PhanCong(); b.MACT = pc.MACT; b.MANV = pc.MANV; b.MAPB = pc.MAPB; b.SLNGAYCONG = pc.SLNGAYCONG; db.PhanCongs.InsertOnSubmit(b); db.SubmitChanges(); return(1); }
public int change1PhanCong(ePhanCong pc) { var tmp = db.PhanCongs.Where(x => (x.MANV == pc.MANV && x.MAPB == pc.MAPB && x.MACT == pc.MACT)).FirstOrDefault(); if (tmp == null) { return(0); } db.PhanCongs.DeleteOnSubmit(tmp); PhanCong b = new PhanCong(); b.MACT = pc.MACT; b.MANV = pc.MANV; b.MAPB = pc.MAPB; b.SLNGAYCONG = pc.SLNGAYCONG; db.PhanCongs.InsertOnSubmit(b); db.SubmitChanges(); return(1); }
private void attach_PhanCongs(PhanCong entity) { this.SendPropertyChanging(); entity.NhanVien = this; }
private void detach_PhanCongs(PhanCong entity) { this.SendPropertyChanging(); entity.NhanVien = null; }
partial void DeletePhanCong(PhanCong instance);
partial void UpdatePhanCong(PhanCong instance);
partial void InsertPhanCong(PhanCong instance);
private void detach_PhanCongs(PhanCong entity) { this.SendPropertyChanging(); entity.CongTrinh = null; }
private void attach_PhanCongs(PhanCong entity) { this.SendPropertyChanging(); entity.CongTrinh = this; }