private Dictionary <string, object> prepareProductParameters(clsProducts prProducts)
        {
            Dictionary <string, object> par = new Dictionary <string, object>(10);

            par.Add("ProductName", prProducts.Name);
            par.Add("Origin", prProducts.Origin);
            par.Add("ProductCondition", prProducts.ProductCondition);
            par.Add("Brand", prProducts.Brand);
            par.Add("Quantity", prProducts.Quantity);
            return(par);
        }
 public string PutProduct(clsProducts prProduct)
 {   // update
     try
     {
         int lcRecCount = clsDBConnection.Execute("UPDATE tblProduct SET " +
                                                  "ProductName = @ProductName, Origin = @Origin, ProductCondition = @ProductCondition, Brand = @Brand, Quantity = @Quantity",
                                                  prepareProductParameters(prProduct));
         if (lcRecCount == 1)
         {
             return("One product updated");
         }
         else
         {
             return("Unexpected product update count: " + lcRecCount);
         }
     }
     catch (Exception ex)
     {
         return(ex.GetBaseException().Message);
     }
 }
 public string PostProduct(clsProducts prWork)
 {   // insert
     try
     {
         int lcRecCount = clsDBConnection.Execute("INSERT INTO tblProduct " +
                                                  "(ProductName, Origin, ProductCondition, Brand, Quantity) " +
                                                  "VALUES (@ProductName, @Origin, @ProductCondition, @Brand, @Quantity)",
                                                  prepareProductParameters(prWork));
         if (lcRecCount == 1)
         {
             return("One Product inserted");
         }
         else
         {
             return("Unexpected product insert count: " + lcRecCount);
         }
     }
     catch (Exception ex)
     {
         return(ex.GetBaseException().Message);
     }
 }