Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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();
     }
 }