public void Delete(string id) { using (QLNTEntities1 db = new QLNTEntities1()) { int ma = Convert.ToInt32(id); KeHoach temp = db.KeHoach.Where(p => p.MaKeHoach == ma).SingleOrDefault(); db.KeHoach.Remove(temp); db.SaveChanges(); } }
public void Edit(int id, string noiDung, string chuThich) { using (QLNTEntities1 db = new QLNTEntities1()) { KeHoach temp = db.KeHoach.Find(id); temp.NoiDung = noiDung; temp.ChuThich = chuThich; db.SaveChanges(); } }
public void setSoLuongCongViec(int MaKH) { using (QLNTEntities1 db = new QLNTEntities1()) { KeHoach k = db.KeHoach.Find(MaKH); int count = (from c in db.ChiTietKH where c.MaKH == MaKH select c).Count(); k.SoLuongCongViec = count; db.SaveChanges(); } }
public int Add(KeHoach o, List <int> loai) { int idKH = 0; using (QLNTEntities1 db = new QLNTEntities1()) { db.KeHoach.Add(o); db.SaveChanges(); db.Entry(o).GetDatabaseValues(); idKH = o.MaKeHoach; // thêm trong chi tiết loại kế hoạch ChiTietKHDB ct = new ChiTietKHDB(); ct.Add(loai, idKH); } return(idKH); }
public int Add(KeHoach kh, List <int> loai) { KeHoachDB db = new KeHoachDB(); return(db.Add(kh, loai)); }