private void MoveCategory() { int currentfid = DNTRequest.GetInt("currentfid", 0); int targetfid = DNTRequest.GetInt("targetfid", 0); string isaschildnode = DNTRequest.GetString("isaschildnode"); Goodscategoryinfo gc = GoodsCategories.GetGoodsCategoryInfoById(currentfid); int oldparentid = gc.Parentid; Goodscategoryinfo parentgc = GoodsCategories.GetGoodsCategoryInfoById(targetfid); gc.Fid = 0; gc.Parentid = targetfid; gc.Parentidlist = parentgc.Parentidlist + "," + parentgc.Categoryid; gc.Layer = parentgc.Layer + 1; gc.Pathlist = parentgc.Pathlist + string.Format("<a href=\"showgoodslist-{0}.aspx\">{1}</a>", gc.Categoryid, gc.Categoryname); GoodsCategories.UpdateGoodsCategory(gc); parentgc.Haschild = 1; GoodsCategories.UpdateGoodsCategory(parentgc); if (gc.Haschild == 0) { return; } DataTable dt = DbProvider.GetInstance().GetAllCategoriesTable(); MoveSubCategory(gc, dt); Goodscategoryinfo oldparentgc = GoodsCategories.GetGoodsCategoryInfoById(oldparentid); oldparentgc.Haschild = (dt.Select("parentid=" + oldparentid) == null ? 0 : 1); GoodsCategories.UpdateGoodsCategory(oldparentgc); ResetStatus(); this.RegisterStartupScript("PAGE", "window.location='mall_goodscategoriesmanage.aspx';"); }
private void SetSubCategoryFid(DataTable dt, int parentid) { DataRow[] datarow = dt.Select("parentid=" + parentid); if (datarow == null) { return; } foreach (DataRow dr in datarow) { Goodscategoryinfo gc = GoodsCategories.GetGoodsCategoryInfoById(int.Parse(dr["categoryid"].ToString())); gc.Fid = 0; GoodsCategories.UpdateGoodsCategory(gc); SetSubCategoryFid(dt, gc.Categoryid); } }
private void EditSubCategory(Goodscategoryinfo parentgc, DataTable dt) { DataRow[] datarow = dt.Select("parentid=" + parentgc.Categoryid.ToString()); if (datarow.Length == 0) { return; } foreach (DataRow dr in datarow) { Goodscategoryinfo gc = GoodsCategories.GetGoodsCategoryInfoById(int.Parse(dr["categoryid"].ToString())); gc.Pathlist = parentgc.Pathlist + string.Format("<a href=\"showgoodslist-{0}.aspx\">{1}</a>", gc.Categoryid, gc.Categoryname); gc.Fid = parentgc.Fid; GoodsCategories.UpdateGoodsCategory(gc); EditSubCategory(gc, dt); } }
private void DeleteNode() { string id = DNTRequest.GetString("id").Trim(); Goodscategoryinfo gc = GoodsCategories.GetGoodsCategoryInfoById(int.Parse(id)); GoodsCategories.DeleteGoodsCategory(int.Parse(id)); DataTable dt = DbProvider.GetInstance().GetAllCategoriesTable(); if (gc.Parentid != 0) { Goodscategoryinfo parentgc = GoodsCategories.GetGoodsCategoryInfoById(gc.Parentid); parentgc.Haschild = dt.Select("parentid=" + gc.Parentid).Length > 0 ? 1 : 0; GoodsCategories.UpdateGoodsCategory(parentgc); } SetForumsTrade(gc.Fid); ResetStatus(); this.RegisterStartupScript("PAGE", "window.location='mall_goodscategoriesmanage.aspx';"); }
private void EditCategory() { int categoryid = DNTRequest.GetInt("categoryid", 0); string categoryname = DNTRequest.GetString("categoryname").Trim(); int fid = DNTRequest.GetInt("forumtreelist", 0); DataTable dt = DbProvider.GetInstance().GetAllCategoriesTable(); Goodscategoryinfo gc = GoodsCategories.GetGoodsCategoryInfoById(categoryid); int oldfid = gc.Fid; if (gc.Parentidlist.IndexOf(",") == -1) { gc.Fid = fid; } Goodscategoryinfo parentgc = GoodsCategories.GetGoodsCategoryInfoById(gc.Parentid); gc.Categoryname = categoryname; if (parentgc == null || parentgc.Fid == 0) { gc.Pathlist = string.Format("<a href=\"showgoodslist-{0}.aspx\">{1}</a>", gc.Categoryid, gc.Categoryname); } else { gc.Pathlist = parentgc.Pathlist + string.Format("<a href=\"showgoodslist-{0}.aspx\">{1}</a>", gc.Categoryid, gc.Categoryname); } GoodsCategories.UpdateGoodsCategory(gc); EditSubCategory(gc, dt); if (oldfid != fid) { if (fid != 0) { SetForumsTrade(fid); } else if (oldfid != 0) { SetForumsTrade(oldfid); } } OpenMall(fid); ResetStatus(); this.RegisterStartupScript("PAGE", "window.location='mall_goodscategoriesmanage.aspx';"); }
private void SetHighLevel(string ishighlevel) { if (ishighlevel == "") { return; } DataTable dt = DbProvider.GetInstance().GetAllCategoriesTable(); foreach (string highlevelid in ishighlevel.Split(',')) { int fid = 0; Goodscategoryinfo gc = GoodsCategories.GetGoodsCategoryInfoById(int.Parse(highlevelid)); fid = gc.Fid; gc.Fid = 0; GoodsCategories.UpdateGoodsCategory(gc); SetSubCategoryFid(dt, gc.Categoryid); SetForumsTrade(fid); } ResetStatus(); }
private void NewChildCategory() { int parentid = DNTRequest.GetInt("parentcategoryid", 0); int fid = DNTRequest.GetInt("forumtreelist", 0); Goodscategoryinfo parentgc = GoodsCategories.GetGoodsCategoryInfoById(parentid); Goodscategoryinfo gc = new Goodscategoryinfo(); gc.Categoryname = Utils.HtmlEncode(DNTRequest.GetString("categoryname").Trim()); gc.Parentid = parentid; gc.Layer = parentgc.Layer + 1; if (parentgc.Parentidlist.Trim() == "0") { gc.Parentidlist = parentgc.Categoryid.ToString(); gc.Fid = fid; } else { gc.Parentidlist = parentgc.Parentidlist + "," + parentgc.Categoryid; gc.Fid = parentgc.Fid; } gc.Pathlist = ""; gc.Goodscount = 0; gc.Haschild = 0; int newcategoryid = GoodsCategories.CreateGoodsCategory(gc); gc.Categoryid = newcategoryid; if (parentgc.Fid != 0) { gc.Pathlist = parentgc.Pathlist; } gc.Pathlist += string.Format("<a href=\"showgoodslist-{0}.aspx\">{1}</a>", newcategoryid, gc.Categoryname); GoodsCategories.UpdateGoodsCategory(gc); parentgc.Haschild = 1; GoodsCategories.UpdateGoodsCategory(parentgc); SetForumsTrade(gc.Fid); OpenMall(fid); ResetStatus(); this.RegisterStartupScript("PAGE", "window.location='mall_goodscategoriesmanage.aspx';"); }
private void NewRootCategory() { Goodscategoryinfo gc = new Goodscategoryinfo(); gc.Categoryname = Utils.HtmlEncode(DNTRequest.GetString("categoryname").Trim()); int fid = DNTRequest.GetInt("forumtreelist", 0); gc.Fid = fid; gc.Parentid = 0; gc.Layer = 0; gc.Parentidlist = "0"; gc.Pathlist = ""; gc.Goodscount = 0; gc.Haschild = 0; int newcategoryid = GoodsCategories.CreateGoodsCategory(gc); gc.Categoryid = newcategoryid; gc.Pathlist = string.Format("<a href=\"showgoodslist-{0}.aspx\">{1}</a>", newcategoryid, gc.Categoryname); GoodsCategories.UpdateGoodsCategory(gc); SetForumsTrade(gc.Fid); OpenMall(fid); ResetStatus(); this.RegisterStartupScript("PAGE", "window.location='mall_goodscategoriesmanage.aspx';"); }