protected void btnOK_Click(object sender, System.EventArgs e) { ST_BookBiz.ST_Product st_product = new STGROUP.ST_BookBiz.ST_Product(); st_entity.ST_ProductName = txtName.Text; st_entity.ST_Price = float.Parse(txtPrice.Text.Trim()); st_entity.ST_SoldPrice = float.Parse(txtSoldPrice.Text.Trim()); st_entity.ST_Publisher = txtPublisher.Text.Trim(); st_entity.ST_ISBN = txtISBN.Text.Trim(); st_entity.ST_Page = int.Parse(txtPage.Text.Trim()); st_entity.ST_PublishDate = DateTime.Parse(txtPublishDate.Text.Trim()); st_entity.ST_ClassID = int.Parse(Request.QueryString["st_classid"]); st_entity.ST_Author = txtAuthor.Text.Trim(); if(Request["Action"]=="add")//�����Ʒ { st_entity.ST_IsSelling = true; st_entity.ST_ProductID = st_product.InsertProduct(st_entity); if (txtFile.PostedFile.ContentLength > 0) { txtFile.PostedFile.SaveAs(ST_BookBiz.ST_Utility.ST_ImagePhyPath + st_entity.ST_ProductID + ".jpg"); } st_product.UpdateProductImg(st_entity.ST_ProductID + ".jpg", st_entity.ST_ProductID); } else//������Ʒ { st_entity.ST_ProductID = int.Parse(Request["id"]); st_entity.ST_Image = st_entity.ST_ProductID + ".jpg"; if (txtFile.PostedFile.ContentLength > 0) { txtFile.PostedFile.SaveAs(ST_BookBiz.ST_Utility.ST_ImagePhyPath + st_entity.ST_ProductID + ".jpg"); } st_product.UpdateProduct(st_entity); } string str = "<script language='javascript'>alert('���³ɹ�');window.close();</script>"; Response.Write(str); }
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; } } }