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