BookShop.Web/Detail.aspx.cs

(完整代码) 2KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using CTL.Common;
using BookShop.Model;

namespace BookShop.Web
{
    public partial class Detail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                int bookid = Utils.StrToInt(Requests.Query("bookid"));

                Book model = BookBLL.GetBookInfo(bookid);

                if (model != null)
                {
                    txtPhoto.Src = model.Photo;
                    txtRemark.Text = model.Remark;
                    txtCateNav.Text = BookShopUtils.GetCateInfo(model.CateID);
                    txtMarketPrice.Text = model.MarketPrice.ToString();
                    price.Text = model.Price.ToString();
                    bookname.Text = model.Name;
                    publish.Text = model.PressName;
                    author.Text = model.Author;
                    txtbookid.Value = model.BookID.ToString();
                    txtStock.Text = model.Stock.ToString();
                    txtPoint.Text = model.Point.ToString();
                    txtISBN.Text = model.ISBN;
                    txtPublishTime.Text = model.PublishTime.ToString("yyyy-MM-dd");
                    decimal bookGradeAverage = 5.00M;
                    txtRateTotal.Text = model.RateTotal.ToString();
                    if (model.RateTotal > 0)
                    {
                        bookGradeAverage = Utils.GetPriceByRound(2, model.GradeTotal / Utils.StrToDecimal(model.RateTotal));
                    }

                    //grade.Text = "<em>" + (bookGradeAverage).ToString() + "</em>&nbsp;分&nbsp;(<a href='bookratelist.aspx?bookid=" + model.BookID + "'>已有" + model.RateTotal + "人留言评论</a>)";

                    decimal grade = Utils.GetPriceByRound(0, bookGradeAverage * 14);

                    txtGrade.Text = "<span class=\"t_stat1 w" + grade + "\"></span>";
                    tGrade.Text = "&nbsp;<em>" + Utils.GetPriceByRound(1,bookGradeAverage) + "</em>&nbsp;(<a href=\"javascript:;\" class=\"t_0\"> 已有" + model.RateTotal + "人评价</a>)";
                    model.Visits += 1;

                    BookBLL.UpdateBook(model);
                }
            }

        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。