protected void btnDownPage_Click(object sender, EventArgs e) { int lCurrentPage = Convert.ToInt32(ViewState["CurrentPage"]); for (int i = 0; i < cblistUpdate.Items.Count; i++)//读取CheckBoxList 选中的值,保存起来 { if (cblistUpdate.Items[i].Selected) { info[(lCurrentPage * 10) + i] = cblistUpdate.Items[i].Value; } } lCurrentPage++; if (lCurrentPage + 1 == Convert.ToInt32(ViewState["PageCount"])) { btnDownPage.Enabled = false; } GA Gadmin = new GA(); GAController gadmin = new GAController(); FirstClassDm firstClassName = new FirstClassDm(); firstClassName.FirstClassDmName = "服装"; string lfirstClassDmID = Gadmin.FcNameGetID(firstClassName); List <ImgInfo> Furniture = new List <ImgInfo>(); Furniture = gadmin.NextPage(Gadmin, lfirstClassDmID, lCurrentPage); cblistUpdate.DataSource = Furniture; cblistUpdate.DataTextField = "ImgTitle"; cblistUpdate.DataValueField = "GoodID"; cblistUpdate.DataBind(); dlistPictureShow.DataSource = Furniture; dlistPictureShow.DataBind(); btnUpPage.Enabled = true; ViewState["CurrentPage"] = lCurrentPage; lbPage.Text = "第" + (lCurrentPage + 1) + "页/共 " + ViewState["PageCount"].ToString() + "页"; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["PageCount"] = 0; ViewState["CurrentPage"] = 0; GA Gadmin = new GA(); GAController gadmin = new GAController(); FirstClassDm firstClassName = new FirstClassDm(); firstClassName.FirstClassDmName = "服装鞋帽"; string lfirstClassDmID = Gadmin.FcNameGetID(firstClassName); List <ImgInfo> Furniture = new List <ImgInfo>(); Furniture = gadmin.Furniture(Gadmin, lfirstClassDmID); cblistUpdate.DataSource = Furniture; for (int i = 0; i < Furniture.Count; i++) { cblistUpdate.DataTextField = "ImgTitle"; cblistUpdate.DataValueField = "GoodID"; } cblistUpdate.DataBind(); dlistPictureShow.DataSource = Furniture; dlistPictureShow.DataBind(); if (gadmin.UpdatePictureShow(Gadmin, 2).Count > 1) { drpdownlist.DataSource = gadmin.UpdatePictureShow(Gadmin, 2); drpdownlist.DataTextField = "ImgTitle"; drpdownlist.DataValueField = "GoodID"; drpdownlist.DataBind(); drpdownlist.Items.Insert(0, new ListItem("请选择替换商品")); } int lPageCount = 0; lPageCount = Convert.ToInt32(gadmin.Count(Gadmin, lfirstClassDmID)); mPageCount = lPageCount; info = new string[mPageCount]; if (lPageCount / 10 == 0) { lPageCount = lPageCount / 10; } if (lPageCount / 10 < 1) { lPageCount = 1; } if (lPageCount % 10 > 1) { int lPage = lPageCount % 10; lPageCount = (lPageCount + (10 - lPage)) / 10; } lbPage.Text = "第1页/共 " + lPageCount.ToString() + "页"; ViewState["PageCount"] = lPageCount; if (mPageCount <= 10) { btnUpPage.Enabled = false; btnDownPage.Enabled = false; } else { btnUpPage.Enabled = false; } } }
protected void Add1_Click(object sender, EventArgs e) { if (TextBox1.Text == "") { this.lblCheck.Text = "添加项为空!"; } else { FirstClassDm firstclassdm = new FirstClassDm(); GA gAdmin = new GA(); firstclassdm.FirstClassDmName = this.TextBox1.Text; if (gAdmin.FcIsRepeat(firstclassdm) == true) { if (gAdmin.AddClum(firstclassdm) > 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 Update1_Click(object sender, EventArgs e) { if (dlistFirstClumName.SelectedItem.Value == "" && dlistFirstClumName.SelectedItem == null) { this.lblCheck.Text = "请选择修改项"; } else { FirstClassDm mFirstClassOld = new FirstClassDm(); FirstClassDm mFirstClassNew = new FirstClassDm(); mFirstClassOld.FirstClassDmName = this.dlistFirstClumName.SelectedItem.Text; mFirstClassNew.FirstClassDmName = this.TextBox1.Text; GA gAdmin = new GA(); if (gAdmin.FcIsRepeat(mFirstClassNew) == true) { if (mFirstClassOld.UpdateFirstClass(mFirstClassNew.FirstClassDmName) == true) { 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 Add2_Click(object sender, EventArgs e) { if (TextBox2.Text == "") { this.lblCheck.Text = "添加项为空!"; } else { SecondClassDm secondclassdm = new SecondClassDm(); FirstClassDm firstclassdm = new FirstClassDm(); firstclassdm.FirstClassDmName = dlistFirstClumName.SelectedItem.Text; GA gAdmin = new GA(); firstclassdm.FirstClassDmID = gAdmin.FcNameGetID(firstclassdm); secondclassdm.SecondClassDmName = this.TextBox2.Text; if (gAdmin.ScIsRepeat(secondclassdm) == true) { if (gAdmin.AddClum(secondclassdm, firstclassdm) > 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 Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <FirstClassDm> firstlist = new List <FirstClassDm>(); firstlist = FirstClassDm.Getlist(); for (int i = 0; i < firstlist.Count; i++) { this.dplFirstClum.Items.Add(new ListItem(firstlist[i].FirstClassDmName, i.ToString())); } this.dplFirstClum.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 Page_Load(object sender, EventArgs e) { FirstClassDm LFirstName = new FirstClassDm(); LFirstName.FirstClassDmName = "家居家装"; List <SecondClassDm> lSecondClassName = new List <SecondClassDm>(); lSecondClassName = FirstClassDm.FcNameGetScName(LFirstName); dlistClassDm.DataSource = lSecondClassName; dlistClassDm.DataBind(); this.dlistProductShow.DataSource = ImgInfo.FurnitureCity(); this.dlistProductShow.DataBind(); //大图片 BigImg mBigImg = new BigImg(); string mCityType = "家具城"; BigImgController mBigImgController = new BigImgController(); this.BigImg.ImageUrl = mBigImgController.GetImgUrl(mBigImg, mCityType); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <FirstClassDm> firstlist = new List <FirstClassDm>(); firstlist = FirstClassDm.Getlist(); for (int i = 0; i < firstlist.Count; i++) { dlistFirstClumName.Items.Add(new ListItem(firstlist[i].FirstClassDmName, i.ToString())); } this.dlistFirstClumName.Items.Insert(0, new ListItem("")); //List<SecondClassDm> secondlist = new List<SecondClassDm>(); //secondlist = SecondClassDm.Getlist(); //for (int i = 0; i < secondlist.Count; i++) //{ // this.dlistSecondClumName.Items.Add(new ListItem(secondlist[i].SecondClassDmName, i.ToString())); //} } }
protected void Page_Load(object sender, EventArgs e) { str = Request.QueryString["FirstName"]; FirstClassDm first = new FirstClassDm(); first.FirstClassDmName = str; this.DataList1.DataSource = FirstClassDm.FcNameGetScName(first); this.DataList1.DataBind(); GA gAdmin = new GA(); Good lGood = new Good(); lGood.FirstClassDmID = gAdmin.FcNameGetID(first); List <Good> lGoodList = new List <Good>(); lGoodList = Good.FcIDGetGoodID(lGood); List <ImgInfo> lImgInfo = new List <ImgInfo>(); this.datalist_good.DataSource = ImgInfo.GoodIDGetImgInfo(lGoodList); this.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 DeleteFirstClass(GA Gadmin, FirstClassDm first) { return(Gadmin.DeleteFirstclassdm(first)); }