/// <summary>
        /// Returns Most Popular Recipes Side Menu
        /// </summary>
        public ExtendedCollection <Recipe> GetPopularRecipe()
        {
            //Instantiate Action Stored Procedure object
            Blogic FetchData = new Blogic();

            ExtendedCollection <Recipe> GetRecipe = new ExtendedCollection <Recipe>();

            string Key = "MostPopular_RecipesSideMenu_" + CatID.ToString();

            if (Caching.Cache[Key] != null)
            {
                GetRecipe = (ExtendedCollection <Recipe>)Caching.Cache[Key];
            }
            else
            {
                IDataReader dr = FetchData.GetMostpopularRecipesSideMenu(CatID, Top);

                while (dr.Read())
                {
                    Recipe item = new Recipe();

                    item.ID = (int)dr["ID"];

                    if (dr["Name"] != DBNull.Value)
                    {
                        item.RecipeName = (string)dr["Name"];
                    }
                    if (dr["Category"] != DBNull.Value)
                    {
                        item.Category = (string)dr["Category"];
                    }
                    if (dr["HITS"] != DBNull.Value)
                    {
                        item.Hits = (int)dr["HITS"];
                    }

                    GetRecipe.Add(item);

                    Caching.CahceData(Key, GetRecipe);
                }

                dr.Close();
            }

            return(GetRecipe);

            FetchData = null;
        }
Example #2
0
        public ExtendedCollection <Recipe> GetNewestRecipe()
        {
            string Key = "Newest_RecipesSideMenu_" + CatID.ToString();

            ExtendedCollection <Recipe> GetRecipe = new ExtendedCollection <Recipe>();

            if (Caching.Cache[Key] != null)
            {
                GetRecipe = (ExtendedCollection <Recipe>)Caching.Cache[Key];
            }
            else
            {
                IDataReader dr = GetData;

                while (dr.Read())
                {
                    Recipe item = new Recipe();

                    item.ID = (int)dr["ID"];

                    if (dr["Name"] != DBNull.Value)
                    {
                        item.RecipeName = (string)dr["Name"];
                    }
                    if (dr["Category"] != DBNull.Value)
                    {
                        item.Category = (string)dr["Category"];
                    }
                    if (dr["Date"] != DBNull.Value)
                    {
                        item.Date = (DateTime)(dr["Date"]);
                    }
                    if (dr["HITS"] != DBNull.Value)
                    {
                        item.Hits = (int)dr["HITS"];
                    }

                    GetRecipe.Add(item);

                    Caching.CahceData(Key, GetRecipe);
                }

                dr.Close();
            }

            return(GetRecipe);
        }