/// <summary> /// ตรวจสอบ ว่า สินค้าของ user เต็ม หรือไม่ /// </summary> /// <param name="data"></param> /// <returns></returns> public bool ValidateFullProduct(int CompID, int CompLevel) { if (CompLevel == 1) { #region Check Is Max Product In Free Package var svPackage = new Order.PackageService(); var max = svPackage.GetMaxProduct(1); var count = CountData <b2bProduct>(" * ", CreateWhereAction(ProductAction.All, CompID)); if (count < max) { IsResult = true; } else { IsResult = false; Exception ex = new Exception("Your package have full product. "); MsgError.Add(ex); } #endregion } else { IsResult = true; } return(IsResult); }
public void GetMaxProduct(int CompLevel) { var svPackage = new Order.PackageService(); var MaxProduct = 999999; if (CompLevel == 1) { MaxProduct = svPackage.GetMaxProduct(CompLevel); } ViewBag.MaxProduct = MaxProduct; }