private static List <PostInfo> ReadPostCateChildList(int fatherID, int depth, int Level) { List <PostInfo> list = new List <PostInfo>(); List <PostInfo> list2 = ReadPostCateCacheList(); Level = Level - 1; foreach (PostInfo info in list2) { if (info.ParentId == fatherID) { PostInfo item = (PostInfo)ServerHelper.CopyClass(info); string str = string.Empty; for (int i = 1; i < depth; i++) { str = str + HttpContext.Current.Server.HtmlDecode(" "); } str = str + HttpContext.Current.Server.HtmlDecode("├ "); item.PostName = str + item.PostName; list.Add(item); if (Level > 0) { list.AddRange(ReadPostCateChildList(item.PostId, depth + 1, Level)); } } } return(list); }
public static List <UserGradeInfo> JoinUserGrade(int productID) { List <MemberPriceInfo> list = MemberPriceBLL.ReadMemberPriceByProduct(productID); List <UserGradeInfo> list2 = ReadUserGradeCacheList(); List <UserGradeInfo> list3 = new List <UserGradeInfo>(); foreach (UserGradeInfo info in list2) { bool flag = false; foreach (MemberPriceInfo info2 in list) { if (info.ID == info2.GradeID) { UserGradeInfo item = new UserGradeInfo(); item = (UserGradeInfo)ServerHelper.CopyClass(info); item.MemberPrice = info2; flag = true; list3.Add(item); break; } } if (!flag) { info.MemberPrice.Price = -1M; list3.Add(info); } } return(list3); }
public static List <AttributeInfo> JoinAttribute(int attributeClassID, int productID) { List <AttributeRecordInfo> list = AttributeRecordBLL.ReadAttributeRecordByProduct(productID); List <AttributeInfo> list2 = ReadAttributeListByClassID(attributeClassID); List <AttributeInfo> list3 = new List <AttributeInfo>(); foreach (AttributeInfo info in list2) { bool flag = false; foreach (AttributeRecordInfo info2 in list) { if (info.ID == info2.AttributeID) { AttributeInfo item = new AttributeInfo(); item = (AttributeInfo)ServerHelper.CopyClass(info); item.AttributeRecord = info2; flag = true; list3.Add(item); break; } } if (!flag) { list3.Add(info); } } return(list3); }
/// <summary> /// 合并属性和属性记录,得到完整的商品属性 /// </summary> public static List <ProductTypeAttributeInfo> JoinAttribute(int productTypeId, int productId) { var attributeRecordList = ProductTypeAttributeRecordBLL.ReadList(productId); var attributeList = ProductTypeAttributeBLL.ReadList(productTypeId); List <ProductTypeAttributeInfo> result = new List <ProductTypeAttributeInfo>(); foreach (var attribute in attributeList) { bool isFind = false; foreach (var attributeRecord in attributeRecordList) { if (attribute.Id == attributeRecord.AttributeId) { ProductTypeAttributeInfo temp = new ProductTypeAttributeInfo(); temp = (ProductTypeAttributeInfo)ServerHelper.CopyClass(attribute); temp.AttributeRecord = attributeRecord; isFind = true; result.Add(temp); break; } } if (!isFind) { result.Add(attribute); } } return(result); }
public static List <StandardInfo> ReadStandardCacheList() { if (CacheHelper.Read(cacheKey) == null) { CacheHelper.Write(cacheKey, dal.ReadStandardAllList()); } List <StandardInfo> objClass = (List <StandardInfo>)CacheHelper.Read(cacheKey); return((List <StandardInfo>)ServerHelper.CopyClass(objClass)); }
public static List <ProductClassInfo> ReadChilds(int parentId, int depth) { List <ProductClassInfo> result = new List <ProductClassInfo>(); var classes = ReadList().Where(k => k.ParentId == parentId); foreach (var entity in classes) { var temp = (ProductClassInfo)ServerHelper.CopyClass(entity); string tempString = string.Empty; for (int i = 1; i < depth; i++) { tempString += HttpContext.Current.Server.HtmlDecode(" "); } temp.Name = tempString + temp.Name; result.Add(temp); result.AddRange(ReadChilds(temp.Id, depth + 1)); } return(result); }
private static List <ProductClassInfo> ReadProductClassChildList(int fatherID, int depth) { List <ProductClassInfo> list = new List <ProductClassInfo>(); List <ProductClassInfo> list2 = ReadProductClassCacheList(); foreach (ProductClassInfo info in list2) { if (info.FatherID == fatherID) { ProductClassInfo item = (ProductClassInfo)ServerHelper.CopyClass(info); string str = string.Empty; for (int i = 1; i < depth; i++) { str = str + HttpContext.Current.Server.HtmlDecode(" "); } item.ClassName = str + item.ClassName; list.Add(item); list.AddRange(ReadProductClassChildList(item.ID, depth + 1)); } } return(list); }
private static List <CourseCateInfo> ReadCourseCateChildList(int fatherID, int depth) { List <CourseCateInfo> list = new List <CourseCateInfo>(); List <CourseCateInfo> list2 = ReadCourseCateCacheList(); foreach (CourseCateInfo info in list2) { if (info.ParentCateId == fatherID) { CourseCateInfo item = (CourseCateInfo)ServerHelper.CopyClass(info); string str = string.Empty; for (int i = 1; i < depth; i++) { str = str + HttpContext.Current.Server.HtmlDecode(" ├ "); } item.CateName = str + item.CateName; list.Add(item); list.AddRange(ReadCourseCateChildList(item.CateId, depth + 1)); } } return(list); }
/// <summary> /// 读取某大类的二级子分类 /// </summary> /// <param name="fatherID">父类ID</param> /// <param name="depth">层级</param> /// <returns>地区数据列表</returns> private static List <RegionInfo> ReadRegionChildList(int fatherID, int depth) { List <RegionInfo> result = new List <RegionInfo>(); List <RegionInfo> regionList = ReadRegionCacheList(); foreach (RegionInfo region in regionList) { if (region.FatherID == fatherID) { RegionInfo temp = (RegionInfo)ServerHelper.CopyClass(region); string tempString = string.Empty; for (int i = 1; i < depth; i++) { tempString += HttpContext.Current.Server.HtmlDecode(" "); } temp.RegionName = tempString + temp.RegionName; result.Add(temp); result.AddRange(ReadRegionChildList(temp.ID, depth + 1)); } } return(result); }
/// <summary> /// 读取某大类的二级子分类 /// </summary> /// <param name="fatherID">父类ID</param> /// <param name="depth">层级</param> /// <returns>菜单数据列表</returns> private static List <MenuInfo> ReadMenuChildList(int fatherID, int depth) { List <MenuInfo> result = new List <MenuInfo>(); List <MenuInfo> menuList = ReadMenuCacheList(); foreach (MenuInfo menu in menuList) { if (menu.FatherID == fatherID) { MenuInfo temp = (MenuInfo)ServerHelper.CopyClass(menu); string tempString = string.Empty; for (int i = 1; i < depth; i++) { tempString += HttpContext.Current.Server.HtmlDecode(" "); } temp.MenuName = tempString + temp.MenuName; result.Add(temp); result.AddRange(ReadMenuChildList(temp.ID, depth + 1)); } } return(result); }