Esempio n. 1
0
 public int NhapKho(KhoHang kh)
 {
     try
     {
         KhoHang k = db.KhoHangs.SingleOrDefault(n => n.idsanpham == kh.idsanpham && n.size == kh.size);
         if(k!= null)
         {
             k.soluong = k.soluong + kh.soluong;
             db.SubmitChanges();
         }
         else
         {
             db.KhoHangs.InsertOnSubmit(kh);
             db.SubmitChanges();
         }
     }
     catch
     {
         return -1;
     }
     return 1;
 }
Esempio n. 2
0
 public int UpdateKhoHang(KhoHang kh)
 {
     try
     {
         KhoHang k = db.KhoHangs.SingleOrDefault(n => n.idsanpham == kh.idsanpham && n.size == kh.size);
         k.soluong = k.soluong - kh.soluong;
         db.SubmitChanges();
     }
     catch
     {
         return -1;
     }
     return 1;
 }
Esempio n. 3
0
 partial void DeleteKhoHang(KhoHang instance);
Esempio n. 4
0
 partial void UpdateKhoHang(KhoHang instance);
Esempio n. 5
0
 partial void InsertKhoHang(KhoHang instance);
Esempio n. 6
0
		private void detach_KhoHangs(KhoHang entity)
		{
			this.SendPropertyChanging();
			entity.Product = null;
		}
Esempio n. 7
0
		private void attach_KhoHangs(KhoHang entity)
		{
			this.SendPropertyChanging();
			entity.Product = this;
		}