protected void dplThirdClum_SelectedIndexChanged(object sender, EventArgs e) { ThirdClassDm third = new ThirdClassDm(); third.ThirdClassDmName = dplThirdClum.SelectedItem.Text; GA gAdmin = new GA(); third.ThirdClassDmID = gAdmin.TcNameGetID(third); PropertyClassDm propertyclass = new PropertyClassDm(); List <Property> prolist = new List <Property>(); prolist = PropertyClassDm.TcIDGetPoID(third); DataList1.DataSource = Property.PoIDGetPoNameList(prolist); DataList1.DataBind(); for (int i = 0; i < prolist.Count; i++) { PropertyContent proCont = new PropertyContent(); proCont.PropertyID = prolist[i].PropertyID; List <PropertyContent> proConList = new List <PropertyContent>(); proConList = PropertyContent.PoIDGetPcName(proCont); DropDownList ddl = (DropDownList)DataList1.Items[i].FindControl("dpl_PropertyContent"); for (int j = 0; j < proConList.Count; j++) { ddl.Items.Add(new ListItem(proConList[j].PropertyContentName, j.ToString())); } ddl.Items.Insert(0, new ListItem("选择属性内容")); ddl.DataBind(); } this.lbl_tip.Text = ""; }
protected void Page_Load(object sender, EventArgs e) { str = this.Request.QueryString["ThirdName"]; ThirdClassDm mThirdClassDm = new ThirdClassDm(); mThirdClassDm.ThirdClassDmName = str; DataList1.DataSource = ThirdClassDm.Getlist(str); DataList1.DataBind(); GA gAdmin = new GA(); Good lGood = new Good(); lGood.ThirdClassDmID = gAdmin.TcNameGetID(mThirdClassDm); List <Good> lGoodList = new List <Good>(); lGoodList = Good.TcIDGetGoodID(lGood); List <ImgInfo> lImgInfo = new List <ImgInfo>(); datalist_good.DataSource = ImgInfo.GoodIDGetImgInfo(lGoodList); datalist_good.DataBind(); //得到属性ID mThirdClassDm.ThirdClassDmID = mThirdClassDm.GetThirdClassDmId(str).ToString(); PropertyNameandContent mpnc = new PropertyNameandContent(); //this.dlProperty.DataSource = mpnc.GetPropertyAll(PropertyClassDm.TcIDGetPoID(mThirdClassDm)); //this.dlProperty.DataBind(); }
protected void Delete3_Click(object sender, EventArgs e) { try { if (dlistThirdClumName.SelectedItem.Value == "" && dlistThirdClumName.SelectedItem == null) { this.lblCheck.Text = "选择删除项为空"; } else { ThirdClassDm Third = new ThirdClassDm(); GA ga = new GA(); GAController GA = new GAController(); Third.ThirdClassDmName = dlistThirdClumName.SelectedItem.Text; if (GA.DeleteThirdClass(ga, Third)) { 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>"); } } } catch { this.lblCheck.Text = "选择删除项为空"; } }
//更改三级类目名 protected void Update3_Click(object sender, EventArgs e) { if (dlistThirdClumName.SelectedItem.Value == "" && dlistThirdClumName.SelectedItem == null) { this.lblCheck.Text = "请选择修改项"; } else { ThirdClassDm mThirdClassDmOld = new ThirdClassDm(); ThirdClassDm mThirdClassDmNew = new ThirdClassDm(); mThirdClassDmOld.ThirdClassDmName = this.dlistThirdClumName.SelectedItem.Text; mThirdClassDmNew.ThirdClassDmName = this.TextBox3.Text; if (mThirdClassDmNew.SelectThirdClass() == true) { if (mThirdClassDmOld.UpdateThirdClass(mThirdClassDmNew.ThirdClassDmName) == true) { this.lblCheck.Text = "修改成功!"; } else { this.lblCheck.Text = "修改失败!"; } } else { this.lblCheck.Text = "修改内容已存在!修改无效!"; } } }
protected void Add3_Click(object sender, EventArgs e) { if (TextBox3.Text == "") { this.lblCheck.Text = "添加项为空!"; } else { SecondClassDm secondclassdm = new SecondClassDm(); ThirdClassDm thirdclassdm = new ThirdClassDm(); secondclassdm.SecondClassDmName = dlistSecondClumName.SelectedItem.Text; GA gAdmin = new GA(); secondclassdm.SecondClassDmID = gAdmin.ScNameGetID(secondclassdm); thirdclassdm.ThirdClassDmName = this.TextBox3.Text; if (gAdmin.TcIsRepeat(thirdclassdm) == true) { if (gAdmin.AddClum(thirdclassdm, secondclassdm) > 0) { 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>"); } } }
protected void btnAdd_Click(object sender, EventArgs e) { if (tbxAddproname.Text != "") { Property property = new Property(); GA gAdmin = new GA(); ThirdClassDm thirdclassdm = new ThirdClassDm(); thirdclassdm.ThirdClassDmName = this.drpThirdclass.SelectedItem.Text; thirdclassdm.ThirdClassDmID = gAdmin.TcNameGetID(thirdclassdm); property.PropertyName = this.tbxAddproname.Text; property.PropertyID = gAdmin.PoNameGetID(property); if (gAdmin.PoIsRepeat(property) == true) //判断属性名字是否重复 TRUE为不重复 { if (gAdmin.AddProperty(thirdclassdm, property) == true) //判断添加属性和绑定关系是否成功 { 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 { if (gAdmin.IsTcPoComb(property, thirdclassdm) == true) //判断存不存在绑定关系 TRUE为不存在 { if (gAdmin.AddTcPoComb(property, thirdclassdm) == true) //判断添加绑定关系是否成功 { 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 = "添加不能为空!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "添加不能为空" + "');</script>"); } }
protected void dplSecondClum_SelectedIndexChanged(object sender, EventArgs e) { this.dplThirdClum.Items.Clear(); List <ThirdClassDm> thirdlist = new List <ThirdClassDm>(); SecondClassDm secondclum = new SecondClassDm(); secondclum.SecondClassDmName = dplSecondClum.SelectedItem.Text; ThirdClassDm thirdclum = new ThirdClassDm(); thirdlist = SecondClassDm.FcShowContent(thirdclum, secondclum); for (int i = 0; i < thirdlist.Count; i++) { this.dplThirdClum.Items.Add(new ListItem(thirdlist[i].ThirdClassDmName, i.ToString())); } this.dplThirdClum.Items.Insert(0, new ListItem("选择三级类目")); }
protected void drpThirdclass_SelectedIndexChanged(object sender, EventArgs e) { ListBox1.Items.Clear(); drpNewProname.Items.Clear(); ThirdClassDm thirdclassdm = new ThirdClassDm(); GA gAdmin = new GA(); thirdclassdm.ThirdClassDmName = drpThirdclass.SelectedItem.Text; thirdclassdm.ThirdClassDmID = gAdmin.TcNameGetID(thirdclassdm); string[] str = Property.PoIDGetPoName(PropertyClassDm.TcIDGetPoID(thirdclassdm)); for (int i = 0; i < str.Length; i++) { ListBox1.Items.Add(str[i]); drpNewProname.Items.Add(new ListItem(str[i], i.ToString())); } drpNewProname.Items.Insert(0, new ListItem("选择属性")); }
protected void ddlThirdClum_SelectedIndexChanged(object sender, EventArgs e) { if (ddlThirdClum.SelectedItem.Text == "" || ddlThirdClum.SelectedItem.Text == "选择三级类目") { } else { GA lGoodinfo = new GA(); ThirdClassDm lThirdName = new ThirdClassDm(); GAController Gadmin = new GAController(); lThirdName.ThirdClassDmName = ddlThirdClum.SelectedItem.Text; string lThirdID = lGoodinfo.TcNameGetID(lThirdName); List <Good> GoodExamInfo = new List <Good>(); GoodExamInfo = Gadmin.GoodExam(lGoodinfo, lThirdID); dlistGoodShow.DataSource = GoodExamInfo; dlistGoodShow.DataBind(); int lPageCount = Gadmin.PageCount(lGoodinfo, lThirdID); if (lPageCount % 10 == 0) { mPageCount = lPageCount / 10; } if (lPageCount / 10 < 1) { mPageCount = 1; } if (lPageCount / 10 > 1) { int lPage = lPageCount % 10; mPageCount = (lPageCount + (10 - lPage)) / 10; } if (GoodExamInfo.Count <= 10) { btnNextpage.Enabled = false; btnUppage.Enabled = false; } else { btnUppage.Enabled = false; } btnNextpage.Visible = true; btnUppage.Visible = true; ShwoPages.Text = "第" + mPage + "页/共" + mPageCount.ToString() + "页"; } }
protected void btnUppage_Click(object sender, EventArgs e) { mPage--; GA lGoodinfo = new GA(); ThirdClassDm lThirdName = new ThirdClassDm(); GAController Gadmin = new GAController(); lThirdName.ThirdClassDmName = ddlThirdClum.SelectedItem.Text; string lThirdID = lGoodinfo.TcNameGetID(lThirdName); List <Good> GoodExamInfo = new List <Good>(); GoodExamInfo = Gadmin.Uppage(lGoodinfo, lThirdID, mPage); dlistGoodShow.DataSource = GoodExamInfo; dlistGoodShow.DataBind(); btnNextpage.Enabled = true; if (mPage == 1) { btnUppage.Enabled = false; } ShwoPages.Text = "第" + mPage.ToString() + "页/共" + mPageCount.ToString() + "页"; }
protected void Delete2_Click(object sender, EventArgs e) { try { if (dlistSecondClumName.SelectedItem.Value == "") { this.lblCheck.Text = "选择删除项为空"; } else { SecondClassDm Second = new SecondClassDm(); ThirdClassDm Third = new ThirdClassDm(); Second.SecondClassDmName = dlistSecondClumName.SelectedItem.Text; GA ga = new GA(); GAController GA = new GAController(); if (SecondClassDm.FcShowContent(Third, Second).Count != 0) { this.lblCheck.Text = "三级类目存在内容!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "三级类目存在内容" + "');</script>"); } else { if (GA.DeleteSecondClass(ga, Second)) { 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>"); } } } } catch { this.lblCheck.Text = "选择删除项为空"; } }
protected void Page_Load(object sender, EventArgs e) { str = Request.QueryString["SecondName"]; SecondClassDm secondclassdm = new SecondClassDm(); secondclassdm.SecondClassDmName = str; ThirdClassDm thirdclassdm = new ThirdClassDm(); this.DataList1.DataSource = SecondClassDm.FcShowContent(thirdclassdm, secondclassdm); this.DataList1.DataBind(); GA gAdmin = new GA(); Good lGood = new Good(); lGood.SecondClassDmID = gAdmin.ScNameGetID(secondclassdm); List <Good> lGoodList = new List <Good>(); lGoodList = Good.ScIDGetGoodID(lGood); List <ImgInfo> lImgInfo = new List <ImgInfo>(); datalist_good.DataSource = ImgInfo.GoodIDGetImgInfo(lGoodList); datalist_good.DataBind(); }
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 = "添加项不能为空!"; } }
/// <summary> /// 删除三级类目 /// </summary> /// <param name="Gadim">商品管理员对象</param> /// <returns>是否删除成功</returns> public bool DeleteThirdClass(GA Gadim, ThirdClassDm third) { return(Gadim.DeleteThirddm(third)); }