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';"); }