protected void Page_Load(object sender, EventArgs e)
    {
        //Instantiate utility object
            Utility Util = new Utility();

            //Instantiate recipe of the day database field
            RecipeoftheDay Recipe = new RecipeoftheDay();

            Recipe.fillup();

            RanCat.NavigateUrl = "category.aspx?catid=" + Recipe.CatID;
            RanCat.Text = Recipe.Category;
            RanCat.ToolTip = "Browse " + Recipe.Category + " category";

            rdetails.NavigateUrl = "recipedetail.aspx?id=" + Recipe.ID;
            rdetails.Text = "Read more...";
            rdetails.ToolTip = "Read full details of " + Recipe.RecipeName + " recipe";

            lbrecname.Text = Recipe.RecipeName;
            lbingred.Text = Util.FormatText(Recipe.Ingredients);
            lbinstruct.Text = Util.FormatText(Recipe.Instructions);
            lbhits.Text = Recipe.Hits.ToString();
            lblrating.Text = Recipe.Rating;
            lbvotes.Text = Recipe.NoRates.ToString();

            rateimage.ImageUrl = Utility.GetStarImage(Recipe.Rating);

            //Release allocated memory
            Util = null;
            Recipe = null;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //Instantiate object
        Utility Util = new Utility();

        //Instantiate database field
        RecipeDetails Recipe = new RecipeDetails();

        Recipe.WhatPageID = constant.intRecipeDetails; //1 = we are dealing with print.aspx use the same as recipedetails.
        Recipe.ID = (int)Util.Val(Request.QueryString["id"]);

        //Fill up database fields
        Recipe.fillup();

        lblingredientsdis.Text = "Ingredients:";
        lblinstructionsdis.Text = "Instructions:";
        lblname.Text = Recipe.RecipeName;
        lblIngredients.Text = Util.FormatText(Recipe.Ingredients);
        lblInstructions.Text = Util.FormatText(Recipe.Instructions);

        strRName = "Printing" + Recipe.RecipeName + " Recipe";

        //Release allocated memory
        Util = null;
        Recipe = null;
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //Validate admin session username and password by comparing them to the admin user database record.
            UserNameVal.ValidateAdminUserNameandPass();

            //Get admin username from the sessioan variable and place it in the label.
            lblusername.Text = "Welcome Admin: " + UserNameVal.AdminUsername;

            if (Request.QueryString["prevedit"] != null)
            {
                btn1.Visible = false;
                btn2.Visible = true;
            }
            else
            {
                btn1.Visible = true;
                btn2.Visible = false;
            }

            //Instantiate database field
            ArticleDetail Article = new ArticleDetail();

            Article.WhatPageID = (int)Util.Val(Request.QueryString["show"]); //Parameter 2 = we are dealing with the admin/updatearticle.aspx.
            Article.ID         = (int)Util.Val(Request.QueryString["aid"]);

            //Fill up database fields
            Article.fillup();

            string categoryname;
            categoryname = Article.Category;

            lbtitle.Text    = Article.Title;
            lbcatname2.Text = Article.Category;
            Title.Value     = Article.Title;
            Content.Value   = Util.FormatText(Article.Content);
            Summary.Value   = Util.FormatText(Article.Summary);
            Keyword.Value   = Article.Keyword;
            Author.Value    = Article.Author;
            CAT_ID.Value    = Article.CatID.ToString();

            //Release allocated memory
            myBL    = null;
            Util    = null;
            Article = null;
        }
    }