コード例 #1
0
        private Dictionary <string, object> prepareCategoryParameters(clsCategory prCategory)
        {
            Dictionary <string, object> par = new Dictionary <string, object>(3);

            par.Add("Category", prCategory.Category);
            par.Add("Description", prCategory.Description);
            return(par);
        }
コード例 #2
0
 public string PutCategory(clsCategory prCategory)
 {   // update
     try
     {
         int lcRecCount = clsDBConnection.Execute(
             "UPDATE tblCategory SET Category = @Category, WHERE Description = @Description",
             prepareCategoryParameters(prCategory));
         if (lcRecCount == 1)
         {
             return("One category updated");
         }
         else
         {
             return("Unexpected category update count: " + lcRecCount);
         }
     }
     catch (Exception ex)
     {
         return(ex.GetBaseException().Message);
     }
 }
コード例 #3
0
 public string PostCategory(clsCategory prCategory)
 {
     try
     {
         int lcRecCount = clsDBConnection.Execute(
             "Insert Into Category(Category,Description) Values(@Category, @Description)",
             prepareCategoryParameters(prCategory));
         if (lcRecCount == 1)
         {
             return("One category inserted");
         }
         else
         {
             return("Unexpected category insert count: " + lcRecCount);
         }
     }
     catch (Exception ex)
     {
         return(ex.GetBaseException().Message);
     }
 }