示例#1
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     // �ڴ˴������û������Գ�ʼ��ҳ��
     if(!IsPostBack)
     {
         //ȡ����ƷID
         int st_productid = 0;
         try
         {
             st_productid = int.Parse(Request.QueryString["st_productid"]);
         }
         catch
         {
             return;
         }
         //ȡ����Ʒ�Ļ�����Ϣ�������빺�ﳵ��
         ST_BookBiz.ST_Product st_product = new STGROUP.ST_BookBiz.ST_Product();
         ST_BookBiz.ST_ProductEntity st_entity = st_product.GetProductInfoByID(st_productid);
         ST_BookBiz.ST_Cart cart = null;
         ST_BookBiz.ST_OrderProduct op = new STGROUP.ST_BookBiz.ST_OrderProduct(st_productid);
         op.ST_Price = st_entity.ST_Price;
         op.ST_ProductID = st_productid;
         op.ST_ProductName = st_entity.ST_ProductName;
         op.ST_Quantity = 1;
         op.ST_SoldPrice = st_entity.ST_SoldPrice;
         if (Session["Cart"] == null)
         {
             cart = new ST_BookBiz.ST_Cart();
             cart.Add(op);
             Session["Cart"] = cart;
         }
         else
         {
             cart = (ST_BookBiz.ST_Cart)Session["Cart"];
             cart.Add(op);
         }
         Page.RegisterStartupScript("AddSucc","<script languange=javascript>alert('�ɹ������Ʒ�����ﳵ!');</script>");
     }
 }
 protected void Page_Load(object sender, System.EventArgs e)
 {
     // �ڴ˴������û������Գ�ʼ��ҳ��
     Response.Cache.SetCacheability(HttpCacheability.NoCache);//ȥ��ҳ�滺��
     if(!IsPostBack)
     {
         //����Ʒ��Ϣ
         ST_BookBiz.ST_Product st_product = new STGROUP.ST_BookBiz.ST_Product();
         if(Request["Action"]=="Edit" && Request["id"]!=null)
         {
             st_entity = st_product.GetProductInfoByID(int.Parse(Request["id"]));
             txtNumber.Text = st_entity.ST_ProductID.ToString();
             txtName.Text = st_entity.ST_ProductName;
             txtPrice.Text = st_entity.ST_Price.ToString("F2");
             txtSoldPrice.Text = st_entity.ST_SoldPrice.ToString("F2");
             txtPublisher.Text = st_entity.ST_Publisher;
             txtISBN.Text = st_entity.ST_ISBN;
             txtPage.Text = st_entity.ST_Page.ToString();
             txtPublishDate.Text = st_entity.ST_PublishDate.ToString("yyyy-MM-dd");
             txtAuthor.Text = st_entity.ST_Author;
         }
     }
 }