Esempio n. 1
0
        private Dictionary <string, object> prepareBrandParameters(clsBrand prBrand)
        {
            Dictionary <string, object> par = new Dictionary <string, object>(3);

            par.Add("brand_name", prBrand.brand_name);
            par.Add("brand_description", prBrand.brand_description);
            return(par);
        }
Esempio n. 2
0
        public List <clsBrand> GetBagBrands()
        {
            DataTable       lcResult = clsDbConnection.GetDataTable("SELECT * FROM Bag_brand", null);
            List <clsBrand> lcNames  = new List <clsBrand>();

            foreach (DataRow dr in lcResult.Rows)
            {
                clsBrand b = new clsBrand();
                b.brand_name        = (string)dr["bag_brand"];
                b.brand_description = (string)dr["bag_description"];
                lcNames.Add(b);
            }
            return(lcNames);
        }
Esempio n. 3
0
 public string PutBrand(clsBrand prBrand)
 {   // update
     try
     {
         int lcRecCount = clsDbConnection.Execute(
             "UPDATE Bag_brand SET bag_description = @brand_description WHERE bag_brand = @brand_name",
             prepareBrandParameters(prBrand));
         if (lcRecCount == 1)
         {
             return("One Brand updated");
         }
         else
         {
             return("Unexpected Brand update count: " + lcRecCount);
         }
     }
     catch (Exception ex)
     {
         return(ex.GetBaseException().Message);
     }
 }
Esempio n. 4
0
 public string PostBrand(clsBrand prBrand)
 {   // insert
     try
     {
         int lcRecCount = clsDbConnection.Execute(
             "Insert Into Bag_brand Values(@brand_name, @brand_description)",
             prepareBrandParameters(prBrand));
         if (lcRecCount == 1)
         {
             return("One Brand inserted");
         }
         else
         {
             return("Unexpected Brand insert count: " + lcRecCount);
         }
     }
     catch (Exception ex)
     {
         return(ex.GetBaseException().Message);
     }
 }