コード例 #1
0
        /// <summary>
        /// Purpose: Grabs category information based on ID
        /// Accepts: Int
        /// Returns: Hashtable
        /// </summary>
        public Hashtable GetCategoryByID(int id)
        {
            Category obj = new Category();
            QuickStart_DBEntities dbContext;
            Hashtable hsh = new Hashtable();
            try
            {
                dbContext = new QuickStart_DBEntities();
                obj = dbContext.Categories.FirstOrDefault(c => c.CategoryID == id);
                if (obj != null)
                {
                    hsh["categoryid"] = obj.CategoryID;
                    hsh["name"] = obj.Name;
                    hsh["description"] = obj.Description;
                    hsh["parentcategoryid"] = obj.ParentCategoryID;
                    hsh["created"] = obj.Created;
                    hsh["modified"] = obj.Modified;
                    hsh["isactive"] = obj.IsActive;
                }
            }
            catch (Exception ex)
            {
                ErrorLoggerData.ErrorRoutine(ex, "CategoryData", "GetCategoryByID");
            }

            return hsh;
        }
コード例 #2
0
 /// <summary>
 /// Create a new Category object.
 /// </summary>
 /// <param name="categoryID">Initial value of the CategoryID property.</param>
 public static Category CreateCategory(global::System.Int32 categoryID)
 {
     Category category = new Category();
     category.CategoryID = categoryID;
     return category;
 }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCategories(Category category)
 {
     base.AddObject("Categories", category);
 }