Пример #1
0
        /// <summary>
        /// Get recipe name, author, date, hits, rating, ingredients, instructions and other field from the DB matching the Recipe ID provided.
        /// </summary>
        public override void fillup()
        {
            //Instantiate Action Stored Procedure object
            Blogic FetchData = new Blogic();

            try
            {
                IDataReader dr = FetchData.GetRandomRecipeSideMenu(CatID);

                dr.Read();

                if (dr["ID"] != DBNull.Value)
                {
                    this._ID = (int)dr["ID"];
                }
                if (dr["Name"] != DBNull.Value)
                {
                    this._RecipeName = (string)dr["Name"];
                }
                if (dr["CAT_ID"] != DBNull.Value)
                {
                    this._CatID = (int)dr["CAT_ID"];
                }
                if (dr["NO_RATES"] != DBNull.Value)
                {
                    this._NoRates = dr["NO_RATES"].ToString();
                }
                if (dr["HITS"] != DBNull.Value)
                {
                    this._Hits = (int)dr["HITS"];
                }
                if (dr["Rates"] != DBNull.Value)
                {
                    this._Rating = dr["Rates"].ToString();
                }
                if (dr["Category"] != DBNull.Value)
                {
                    this._Category = (string)dr["Category"];
                }

                //Release allocated memory
                dr.Close();
                dr = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            FetchData = null;
        }