/// <summary> /// 根据IndustryID获取行业信息 /// </summary> /// <param name="industryID"></param> /// <returns></returns> public static ProductIndustry GetProductIndustry(int industryID) { ProductIndustry industry = null; foreach (ProductIndustry child in GetProductIndustries()) { if (child.IndustryID == industryID) { industry = child; break; } } return(industry); }
/// <summary> /// 更新行业信息 /// </summary> /// <param name="industry"></param> /// <param name="contentStream"></param> public static DataActionStatus Update(ProductIndustry industry, Stream contentStream) { DataActionStatus status; ShopDataProvider.Instance.CreateUpdateIndustry(industry, DataProviderAction.Update, out status); if (status == DataActionStatus.Success) { if (contentStream != null && contentStream.Length > 0) { FileStorageProvider fs = new FileStorageProvider(FileStoreKey); fs.AddUpdateFile(MakePath(industry.IndustryID), industry.IndustryLogo, contentStream); } HHCache.Instance.RemoveByPattern(CacheKeyManager.ProductIndustryXpath); OnUpdated(industry.IndustryID); } return(status); }
public override object Copy() { ProductIndustry industry = this.CreateNewInstance() as ProductIndustry; industry.IndustryAbstract = this.IndustryAbstract; industry.IndustryContent = this.IndustryContent; industry.IndustryID = this.IndustryID; industry.IndustryLogo = this.IndustryLogo; industry.IndustryName = this.IndustryName; industry.IndustryStatus = this.IndustryStatus; industry.IndustryTitle = this.IndustryTitle; industry.ParentID = this.ParentID; industry.DisplayOrder = this.DisplayOrder; industry.UpdateTime = this.UpdateTime; industry.UpdateUser = this.UpdateUser; industry.CreateTime = this.CreateTime; industry.CreateUser = this.CreateUser; return(industry); }
/// <summary> /// 获取<paramref name="industry"/>下子行业 /// </summary> /// <param name="industry"></param> /// <param name="deps"></param> /// <param name="industries"></param> /// <returns></returns> private static void GetChildIndustires(ProductIndustry industry, int deps, ref List <ProductIndustry> industries) { string block = "┗"; for (int i = 0; i < deps; i++) { block = " " + block; } ProductIndustry industryCopy = null; foreach (ProductIndustry child in GetChildIndustries(industry.IndustryID)) { industryCopy = child.Copy() as ProductIndustry; if (industry != null) { industryCopy.IndustryName = block + child.IndustryName; industries.Add(industryCopy); GetChildIndustires(child, deps + 1, ref industries); } } }