예제 #1
0
 private void categoriesform_Load(object sender, EventArgs e)
 {
     populate();
     CatID.Hide();
     label3.Hide();
     label9.Hide();
     label10.Hide();
 }
        /// <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;
        }
예제 #3
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);
        }
예제 #4
0
 public void cleartext()
 {
     CatID.Clear();
     Catname.Clear();
     CatDes.Clear();
 }