示例#1
0
 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();
     }
 }
示例#2
0
 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();
     }
 }
示例#3
0
 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();
     }
 }
示例#4
0
        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);
        }
示例#5
0
        public int Add(KeHoach kh, List <int> loai)
        {
            KeHoachDB db = new KeHoachDB();

            return(db.Add(kh, loai));
        }