protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["ImageAddress"] == null) { Response.Redirect("../GoodDisplay/ProductShow.aspx"); } else { if (Session["UserName"] == null || Session["UserName"] == "") { mUserName = null; } else { mUserName = Session["UserName"].ToString(); } StoreUser User = new StoreUser(); StoreUserController User1 = new StoreUserController(); string ImageAddress = Request.QueryString["ImageAddress"]; imgGoodShow.Src = ImageAddress; ImgInfo imgInfo = new ImgInfo(); imgInfo.ImgAddress = ImageAddress; int GoodID = ImgInfo.ImgAddressGetGoodID(imgInfo); SingleGoodInfo singleGoodinfo = new SingleGoodInfo(); singleGoodinfo.GoodID = GoodID; int SingleGoodID = SingleGoodInfo.mGoodIDGetSingleGoodID(singleGoodinfo); mSingleGoodID = SingleGoodID; if (GoodID == 0 || GoodID == null) { Response.Redirect("../GoodDisplay/ProductShow.aspx"); } List <Good> goodInfo = new List <Good>(); List <ImgInfo> imgTiele = new List <ImgInfo>(); Order Goodinfo = new Order(); OrderController GoodInfo = new OrderController(); goodInfo = GoodInfo.Goodinfo(Goodinfo, GoodID); imgTiele = GoodInfo.GoodTitle(Goodinfo, GoodID); lbGoodPrice.Text = goodInfo[0].GoodPrice; lbGoodID.Text = goodInfo[0].GoodID.ToString(); lbFirstName.Text = goodInfo[0].GoodName; lbSecondName.Text = imgTiele[0].ImgTitle; lbMoney.Text = lbGoodPrice.Text; mGoodCount = Convert.ToDouble(lbGoodPrice.Text); mGoodIncontory = goodInfo[0].GoodIncentory; this.linkbtn_FirstName.Text = Good.GoodIDGetFirstClassName(GoodID); this.linkbtn_SecondName.Text = Good.GoodIDGetSecondClassName(GoodID); this.linkbtn_ThirdName.Text = Good.GoodIDGetThirdClassName(GoodID); this.linkbtn_FirstName.PostBackUrl = "~/formerstage/GoodDisplay/FirstClass.aspx?FirstName=" + this.linkbtn_FirstName.Text + ""; this.linkbtn_SecondName.PostBackUrl = "~/formerstage/GoodDisplay/SecondClass.aspx?SecondName=" + this.linkbtn_SecondName.Text + ""; this.linkbtn_ThirdName.PostBackUrl = "~/formerstage/GoodDisplay/ThirdClass.aspx?ThirdName=" + this.linkbtn_ThirdName.Text + ""; this.DataList1.DataSource = SingleGoodInfo.GetSingleGoodInfo(GoodID); DataList1.DataBind(); } } }
protected void palConfirmInfo_Load(object sender, EventArgs e) { if (IsPostBack) { if (Session["UserName"] == null) { //this.Response.Redirect("../UserRegister/Login.aspx"); } else { StoreUser User = new StoreUser(); StoreUserController User1 = new StoreUserController(); string ImageAddress = Request.QueryString["ImageAddress"]; ImgInfo imgInfo = new ImgInfo(); imgInfo.ImgAddress = ImageAddress; int GoodID = ImgInfo.ImgAddressGetGoodID(imgInfo); SingleGoodInfo singleGoodinfo = new SingleGoodInfo(); singleGoodinfo.GoodID = GoodID; int SingleGoodID = SingleGoodInfo.mGoodIDGetSingleGoodID(singleGoodinfo); mSingleGoodID = SingleGoodID; User.UserName = Session["UserName"].ToString(); List <StoreUser> order = new List <StoreUser>(); order = User1.OrderConfirm(User); lbUserName.Text = order[0].UserTrueName; tbxUserPhone.Text = order[0].Phone; lbMoney.Text = mGoodCount.ToString(); if (tbxUserPhone.Text != "") { if (order[0].Address1 != "") { tbxAddress1.Text = order[0].Address1; if (order[0].IsDafult1 == "1") { rbtnAddress1.Checked = true; } } if (order[0].Address2 != "") { tbxAddress2.Text = order[0].Address2; if (order[0].IsDafult2 == "1") { rbtnAddress2.Checked = true; } } if (order[0].Address3 != "") { tbxAddress3.Text = order[0].Address3; if (order[0].IsDafult3 == "1") { rbtnAddress3.Checked = true; } } } } } }
protected void btnOK_Click(object sender, EventArgs e) { if (this.tbxName.Text != "" && this.tbxCount.Text != "" && this.tbxPicexplain.Text != "" && this.tbxPrice.Text != "" && this.tbxPriurl.Text != "") { GA gAdmin = new GA(); Good good = new Good();//定义对象 good.GoodName = this.tbxName.Text; good.GoodIncentory = Convert.ToInt32(this.tbxCount.Text); good.GoodPrice = this.tbxPrice.Text; FirstClassDm first = new FirstClassDm(); first.FirstClassDmName = this.dplFirstClum.SelectedItem.Text; SecondClassDm second = new SecondClassDm(); second.SecondClassDmName = this.dplSecondClum.SelectedItem.Text; ThirdClassDm Third = new ThirdClassDm(); Third.ThirdClassDmName = this.dplThirdClum.SelectedItem.Text; good.FirstClassDmID = gAdmin.FcNameGetID(first);//传一、二、三级类目ID good.SecondClassDmID = gAdmin.ScNameGetID(second); good.ThirdClassDmID = gAdmin.TcNameGetID(Third); if (gAdmin.AddGood(good) == true) //添加商品表 { for (int GoodCount = 0; GoodCount < good.GoodIncentory; GoodCount++) //添加单个商品 { SingleGoodInfo singleGoodinfo = new SingleGoodInfo(); singleGoodinfo.StaffID = Convert.ToInt32(Session["hStaffID"].ToString()); singleGoodinfo.GoodID = Good.GoodNameGetID(good); gAdmin.AddSingleGoodInfo(singleGoodinfo); SaveSingleGoodInfo saveSinGoodinfo = new SaveSingleGoodInfo(); saveSinGoodinfo.StaffID = Convert.ToInt32(Session["hStaffID"].ToString()); saveSinGoodinfo.GoodID = Good.GoodNameGetID(good); gAdmin.AddSaveSingleGoodInfo(saveSinGoodinfo); } ImgInfo imginfo = new ImgInfo(); imginfo.GoodID = Good.GoodNameGetID(good); imginfo.ImgAddress = this.tbxPriurl.Text; imginfo.ImgTitle = this.tbxPicexplain.Text; if (gAdmin.AddImginfo(imginfo) == true)//添加商品图片信息表 { GoodPropertyComb goodprocomb = new GoodPropertyComb(); ThirdClassDm third = new ThirdClassDm(); third.ThirdClassDmName = dplThirdClum.SelectedItem.Text; third.ThirdClassDmID = gAdmin.TcNameGetID(third); PropertyClassDm propertyclass = new PropertyClassDm(); List <Property> prolist = new List <Property>(); prolist = PropertyClassDm.TcIDGetPoID(third); int count = 0; for (int i = 0; i < prolist.Count; i++) { PropertyContent proCont = new PropertyContent(); goodprocomb.GoodID = Good.GoodNameGetID(good); goodprocomb.PropertyID = prolist[i].PropertyID; DropDownList ddl = (DropDownList)DataList1.Items[i].FindControl("dpl_PropertyContent"); //在datalist中找dropdownlist goodprocomb.PropertyContent = ddl.SelectedItem.Text; if (gAdmin.AddGoodPropertyComb(goodprocomb)) //绑定属性、属性内容、和商品的关系 { count += 1; } } if (count == prolist.Count) { this.lblCheck.Text = "添加成功!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language=javascript>alert('" + "添加成功" + "'); </script>"); } } else { this.lblCheck.Text = "添加失败"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language=javascript>alert('" + "添加失败" + "'); </script>"); } } else { this.lblCheck.Text = "添加失败!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language=javascript>alert('" + "添加失败" + "'); </script>"); } } else { this.lblCheck.Text = "添加项不能为空!"; } }