コード例 #1
0
 public SalesWSResult AddPricingRecord(List<PricingRecord> newPricingRecords, int productID)
 {
     SalesWSResult result = new SalesWSResult();
     result.CounterUpdated = 0;
     result.IsSuccess = false;
     result.Message = "No initilization";
     try
     {
         if (newPricingRecords.Count > 0)
         {
             SVMSalesWSDB SVM = new SVMSalesWSDB();
             foreach (PricingRecord PR in newPricingRecords)
             {
                 PR.ProductID = productID;
                 SVM.PricingRecords.AddObject(PR);
                 result.CounterUpdated++;
             }
             SVM.SaveChanges();
         }
         else
         {
             result.IsSuccess = false;
             result.Message = "The values cannot be null or empty";
         }
         result.IsSuccess = true;
         result.Message = string.Empty;
     }
     catch (Exception ex)
     {
         result.IsSuccess = false;
         result.Message = ex.Message;
     }
     return result;
 }
コード例 #2
0
 public SalesWSResult UpdateBranchProduct(string Branch, int ProductID, int newNumVisits)
 {
     SalesWSResult result = new SalesWSResult();
     result.IsSuccess = true;
     try
     {
         SVMSalesWSDB SVM = new SVMSalesWSDB();
         List<Branch_Product> ListBranchProducts = SVM.Branch_Product.Where(b => b.ProductID == ProductID && b.BranchID == Branch).ToList();
         foreach (Branch_Product BP in ListBranchProducts)
         {
             BP.NumVisits = newNumVisits;
             SVM.SaveChanges();
         }
     }
     catch(Exception ex)
     {
         result.IsSuccess = false;
         result.Message = ex.Message;
     }
     return result;
 }