Example #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;
 }
Example #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;
 }
Example #3
0
 partial void DeleteKhoHang(KhoHang instance);
Example #4
0
 partial void UpdateKhoHang(KhoHang instance);
Example #5
0
 partial void InsertKhoHang(KhoHang instance);
Example #6
0
		private void detach_KhoHangs(KhoHang entity)
		{
			this.SendPropertyChanging();
			entity.Product = null;
		}
Example #7
0
		private void attach_KhoHangs(KhoHang entity)
		{
			this.SendPropertyChanging();
			entity.Product = this;
		}