Exemplo n.º 1
0
    private void DisplayMilkInfo(int bid)
    {
        Milk milk = MilkManager.GetMilkById(bid);

        lblTitle.Text = milk.Name;
        IList <MilkRatings> ratings = MilkRatingManager.GetMilkRatingsInfo(bid);

        if (ratings.Count > 0)
        {
            foreach (MilkRatings r in ratings)
            {
                lblRating.Text += r.User.Name + "<br/>" + r.Rating + "星" + "<br/>" + r.Comment + "<br/>";
            }
        }
    }
Exemplo n.º 2
0
    protected void btnAddComment_Click(object sender, EventArgs e)
    {
        MilkRatings rating = new MilkRatings();
        int         bid    = int.Parse(ViewState["MilkId"].ToString());

        rating.MilkId  = bid;
        rating.Rating  = rtBook.CurrentRating;
        rating.Comment = txbComment.Text;
        if (Session["AdminUser"] != null)
        {
            Users currentUser = (Users)Session["AdminUser"];
            rating.User = currentUser;
        }
        else
        {
            Response.Redirect("~/LoginUpdateProgress.aspx");
        }
        MilkRatingManager.AddMilkRating(rating);
        lblRating.Text  = "";
        txbComment.Text = "";
        DisplayMilkInfo(bid);
    }