Exemplo n.º 1
0
        private Dictionary <string, object> prepareCategoryParameters(clsCategory prCategory)
        {
            Dictionary <string, object> par = new Dictionary <string, object>(3);

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