//更改二级类目名 protected void Update2_Click(object sender, EventArgs e) { if (dlistSecondClumName.SelectedItem.Value == "" && dlistSecondClumName.SelectedItem == null) { this.lblCheck.Text = "请选择修改项"; } else { SecondClassDm mSecondClassDmOld = new SecondClassDm(); SecondClassDm mSecondClassDmNew = new SecondClassDm(); mSecondClassDmOld.SecondClassDmName = this.dlistSecondClumName.SelectedItem.Text; mSecondClassDmNew.SecondClassDmName = this.TextBox2.Text; if (mSecondClassDmNew.SelectSecondClass() == true) { if (mSecondClassDmOld.UpdateSecondClass(mSecondClassDmNew.SecondClassDmName)) { this.lblCheck.Text = "修改成功!"; } else { this.lblCheck.Text = "修改失败!"; } } else { this.lblCheck.Text = "修改内容已存在!修改无效!"; } } }
protected void Delete1_Click(object sender, EventArgs e) { if (dlistFirstClumName.SelectedItem.Value == "") { this.lblCheck.Text = " 选择删除项为空"; } else { FirstClassDm first = new FirstClassDm(); SecondClassDm Second = new SecondClassDm(); first.FirstClassDmName = dlistFirstClumName.SelectedItem.Text; GA ga = new GA(); GAController GA = new GAController(); if (FirstClassDm.FcShowContent(first, Second).Count != 0) { this.lblCheck.Text = "二级类目存在内容!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "二级类目存在内容" + "');</script>"); } else { if (GA.DeleteFirstClass(ga, first)) { 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 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 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 dplFirstClum_SelectedIndexChanged(object sender, EventArgs e) { this.dplSecondClum.Items.Clear(); List <SecondClassDm> secondlist = new List <SecondClassDm>(); FirstClassDm firstclum = new FirstClassDm(); firstclum.FirstClassDmName = dplFirstClum.SelectedItem.Text; SecondClassDm secondclum = new SecondClassDm(); secondlist = FirstClassDm.FcShowContent(firstclum, secondclum); for (int i = 0; i < secondlist.Count; i++) { this.dplSecondClum.Items.Add(new ListItem(secondlist[i].SecondClassDmName, i.ToString())); } this.dplSecondClum.Items.Insert(0, new ListItem("选择二级类目")); }
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="Gadmin">商品管理员对象</param> /// <returns>是否删除成功</returns> public bool DeleteSecondClass(GA Gadmin, SecondClassDm second) { return(Gadmin.DeleteSecondclassdm(second)); }