Пример #1
0
 public void setHuySL(int id)
 {
     using (QLNTEntities1 db = new QLNTEntities1())
     {
         NongSan p = db.NongSan.Where(c => c.MaNS == id).SingleOrDefault();
         p.SanLuongTonKho = 0;
         db.SaveChanges();
     }
 }
Пример #2
0
 public void Delete(string id)
 {
     using (QLNTEntities1 db = new QLNTEntities1())
     {
         int     ma   = Convert.ToInt32(id);
         NongSan temp = db.NongSan.Where(p => p.MaNS == ma).SingleOrDefault();
         db.NongSan.Remove(temp);
         db.SaveChanges();
     }
 }
Пример #3
0
 public void Edit(NongSan o)
 {
     using (QLNTEntities1 db = new QLNTEntities1())
     {
         int     ma   = o.MaNS;
         NongSan temp = db.NongSan.Find(ma);
         temp.ThoiGianBaoQuan = o.ThoiGianBaoQuan;
         temp.SanLuongTonKho  = o.SanLuongTonKho;
         temp.DonGia          = o.DonGia;
         temp.MaLoaiCay       = o.MaLoaiCay;
         db.SaveChanges();
     }
 }
Пример #4
0
 public void Add(NongSan o)
 {
     /*using (QLNTEntities1 db = new QLNTEntities1())
      * {
      *
      *  db.NongSans.Add(new NongSan() { TenPB ="Nis", Loai="Vô cơ", NgaySX= new DateTime(2019,7,1),HanSD = new  DateTime(2020, 7, 1),SoLuong=12,DonGia=100000,KhoiLuong=500 });
      *  db.SaveChanges();
      * }*/
     using (QLNTEntities1 db = new QLNTEntities1())
     {
         db.NongSan.Add(o);
         db.SaveChanges();
     }
 }