public void UpdateItemCategory(List <ItemCategoryEntity> itemCategory) { var adAreaBll = new MHAdAreaBLL(this.CurrentUserInfo); var categoryAreaBll = new MHCategoryAreaBLL(this.CurrentUserInfo); var homeBll = new MobileHomeBLL(this.CurrentUserInfo); var homeList = homeBll.QueryByEntity(new MobileHomeEntity { CustomerId = this.CurrentUserInfo.ClientID }, null); var homeId = homeList.FirstOrDefault().HomeId; foreach (var item in itemCategory) { //更新 var entity = new MHCategoryAreaEntity() { CategoryAreaId = Guid.Parse(item.categoryAreaId), HomeId = homeId, ObjectId = item.objectId, ObjectTypeId = item.typeId, GroupID = item.groupId, ObjectName = item.objectName, ImageUrlObject = item.imageUrl, DisplayIndex = item.displayIndex }; adAreaBll.UpdateMHCategoryArea(entity); } }
public string UpdateMHCategoryAreaByGroupId() { var responseData = new ResponseData(); //请求参数 var groupIDFrom = FormatParamValue(Request("groupIDFrom")); var groupIDTo = Utils.GetIntVal(FormatParamValue(Request("groupIDTo"))); var itemService = new ItemService(this.CurrentUserInfo); if (Convert.ToInt32(groupIDFrom) == Convert.ToInt32(groupIDTo)) { responseData.success = false; responseData.msg = "位置相同,不能移动"; return(responseData.ToJSON()); } else { //update MHItemArea groupid itemService.UpdateMHCategoryAreaByGroupId(this.CurrentUserInfo.ClientID, Convert.ToInt32(groupIDFrom), Convert.ToInt32(groupIDTo)); //get MHItemArea info var content = new GetMHCategoryAreaInfoRespContentData { categoryList = new List <CategoryEntity>() }; try { var homeBll = new MobileHomeBLL(this.CurrentUserInfo); var homeList = homeBll.QueryByEntity(new MobileHomeEntity { CustomerId = this.CurrentUserInfo.ClientID }, null); if (homeList != null && homeList.Length > 0) { var homeEntity = homeList.FirstOrDefault(); var adAreaBll = new MHAdAreaBLL(this.CurrentUserInfo); var dsGroup = adAreaBll.GetCategoryGroupId(homeEntity.HomeId.ToString()); if (dsGroup != null && dsGroup.Tables.Count > 0 && dsGroup.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsGroup.Tables[0].Rows) { var category = new CategoryEntity { groupId = dr[0].ToString(), itemList = new List <ItemEntity>() }; var dsItem = adAreaBll.GetItemList(category.groupId, homeEntity.HomeId.ToString()); if (dsItem != null && dsItem.Tables.Count > 0 && dsItem.Tables[0].Rows.Count > 0) { category.itemList = DataTableToObject.ConvertToList <ItemEntity>(dsItem.Tables[0]); } content.categoryList.Add(category); } } } responseData.success = true; responseData.data = content; return(responseData.ToJSON()); } catch (Exception ex) { responseData.success = false; responseData.msg = ex.ToString(); return(responseData.ToJSON()); } } }
public string SaveAds() { var responseData = new ResponseData(); var itemAds = this.CurrentContext.Request["adList"].DeserializeJSONTo <List <SaveMHAdArea> >(); #region if (itemAds != null) { var adAreaBll = new MHAdAreaBLL(this.CurrentUserInfo); var homeBll = new MobileHomeBLL(this.CurrentUserInfo); var homeList = homeBll.QueryByEntity(new MobileHomeEntity { CustomerId = this.CurrentUserInfo.ClientID }, null); string customerId = this.CurrentUserInfo.CurrentUser.customer_id; if (homeList != null && homeList.Length > 0) { var homeId = homeList.FirstOrDefault().HomeId; string adsIdList = itemAds.Where(item => !string.IsNullOrEmpty(item.adId.ToString())).Aggregate("", (current, item) => current + "'" + item.adId.ToString() + "',"); //根据AdAreaId删除MHAdArea中旧数据(not in adsList) var itemCategoryService = new ItemCategoryService(this.CurrentUserInfo); if (adsIdList != "") { itemCategoryService.UpdateMHAdAreaData(adsIdList, customerId); } else { itemCategoryService.DeleteMHAdAreaData(customerId); } //根据AdAreaId判断是新增还是更新MHAdArea数据 foreach (var item in itemAds) { if (string.IsNullOrEmpty(item.adId.ToString())) { var entity = new MHAdAreaEntity() { AdAreaId = Guid.NewGuid(), HomeId = homeId, ImageUrl = item.imageUrl, ObjectId = item.objectId, ObjectTypeId = item.typeId, DisplayIndex = item.displayIndex, Url = item.url }; adAreaBll.Create(entity); } else { var entity = new MHAdAreaEntity() { AdAreaId = item.adId, HomeId = homeId, ImageUrl = item.imageUrl, ObjectId = item.objectId, ObjectTypeId = item.typeId, DisplayIndex = item.displayIndex, Url = item.url }; adAreaBll.Update(entity); } } } } #endregion responseData.success = true; responseData.msg = "更新成功"; return(responseData.ToJSON()); }
/// <summary> /// 保存商品分类 /// </summary> public string SaveItemCategory() { var responseData = new ResponseData(); int modelTypeId = (Int32)Utils.GetIntVal(FormatParamValue(Request("modelTypeId"))); string modelTypeName = FormatParamValue(Request("modelTypeName")); if (modelTypeId == 0) { responseData.success = false; responseData.msg = "模板ID不能为空"; return(responseData.ToJSON()); } if (string.IsNullOrEmpty(modelTypeName)) { responseData.success = false; responseData.msg = "模板名称不能为空"; return(responseData.ToJSON()); } var itemCategory = this.CurrentContext.Request["categoryList"].DeserializeJSONTo <List <ItemCategoryEntity> >(); if (itemCategory != null && itemCategory.Count > 0) { //分组ID var groupId = itemCategory.FirstOrDefault().groupId; var adAreaBll = new MHAdAreaBLL(this.CurrentUserInfo); var categoryAreaBll = new MHCategoryAreaBLL(this.CurrentUserInfo); var homeBll = new MobileHomeBLL(this.CurrentUserInfo); var homeList = homeBll.QueryByEntity(new MobileHomeEntity { CustomerId = this.CurrentUserInfo.ClientID }, null); var homeId = homeList.FirstOrDefault().HomeId; if (homeList != null && homeList.Length > 0) { //判断groupId是否为空,为空则新增,不为空则更新 //如果新增,则传入 模板ID,修改则不需要传入模板ID if (groupId == 0 || string.IsNullOrEmpty(groupId.ToString())) { //查找表中最大的groupid groupId = categoryAreaBll.GetMaxGroupId(); //在此基础上对groupid+1 groupId++; InsertItemCategory(itemCategory, groupId); } else { UpdateItemCategory(itemCategory); } var mHCategoryAreaGroup = new MHCategoryAreaGroupBLL(this.CurrentUserInfo); var categoryAreaGroup = mHCategoryAreaGroup.QueryByEntity(new MHCategoryAreaGroupEntity() { GroupValue = groupId, CustomerID = this.CurrentUserInfo.ClientID }, null); var categoryAreaGroupEntity = new MHCategoryAreaGroupEntity() { ModelTypeId = modelTypeId, ModelName = modelTypeName, GroupValue = groupId, CustomerID = this.CurrentUserInfo.ClientID }; if (categoryAreaGroup == null || !categoryAreaGroup.Any()) { categoryAreaGroupEntity.GroupId = mHCategoryAreaGroup.GetMaxGroupId(); mHCategoryAreaGroup.Create(categoryAreaGroupEntity); } else { categoryAreaGroupEntity.GroupId = categoryAreaGroup[0].GroupId; mHCategoryAreaGroup.Update(categoryAreaGroupEntity); } } else { responseData.success = false; responseData.msg = "没有查询到对应首页主表的数据"; return(responseData.ToJSON()); } #region 返回商品分类数据 var content = new CategoryEntity(); //商品分类 //获取分组ID content.modelTypeId = modelTypeId; content.modelTypeName = modelTypeName; content.groupId = groupId.ToString(); content.itemList = new List <ItemEntity>(); var dsItem = adAreaBll.GetItemList(content.groupId, homeId.ToString()); if (dsItem != null && dsItem.Tables.Count > 0 && dsItem.Tables[0].Rows.Count > 0) { content.itemList = DataTableToObject.ConvertToList <ItemEntity>(dsItem.Tables[0]); } #endregion responseData.success = true; responseData.data = content; return(responseData.ToJSON()); } else { responseData.success = false; responseData.data = "查无数据"; return(responseData.ToJSON()); } }
/// <summary> /// 获取客户端首页所有配置信息 /// </summary> public string GetHomePageConfigInfo() { var responseData = new ResponseData(); try { var homeBll = new MobileHomeBLL(this.CurrentUserInfo); var homeList = homeBll.QueryByEntity(new MobileHomeEntity { CustomerId = this.CurrentUserInfo.ClientID }, null); if (homeList != null && homeList.Length > 0) { var homeEntity = homeList.FirstOrDefault(); var adAreaBll = new MHAdAreaBLL(this.CurrentUserInfo); var content = new GetHomePageConfigInfoRespContentData { adList = new List <AdEntity>(), eventList = new List <EventAreaEntity>(), categoryList = new List <CategoryEntity>() }; //客户端首页所有配置信息 #region 广告集合 A 图片广告 B活动集合 C 商品分类和商品 var dsAd = adAreaBll.GetAdList(homeEntity.HomeId.ToString()); if (dsAd != null && dsAd.Tables.Count > 0 && dsAd.Tables[0].Rows.Count > 0) { content.adList = DataTableToObject.ConvertToList <AdEntity>(dsAd.Tables[0]); } #endregion #region 活动集合 var dsEvent = adAreaBll.GetEventInfo(homeEntity.HomeId.ToString()); if (dsEvent != null && dsEvent.Tables.Count > 0 && dsEvent.Tables[0].Rows.Count > 0) { content.eventList = DataTableToObject.ConvertToList <EventAreaEntity>(dsEvent.Tables[0]); } #endregion #region 分类集合 //获取分组ID var dsGroup = adAreaBll.GetCategoryGroupId(homeEntity.HomeId.ToString()); if (dsGroup != null && dsGroup.Tables.Count > 0 && dsGroup.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsGroup.Tables[0].Rows) { var category = new CategoryEntity { groupId = dr[0].ToString(), itemList = new List <ItemEntity>() }; var dsItem = adAreaBll.GetItemList(category.groupId, homeEntity.HomeId.ToString()); if (dsItem != null && dsItem.Tables.Count > 0 && dsItem.Tables[0].Rows.Count > 0) { DataSet modelDs = adAreaBll.GetModelTypeIdByGroupId(category.groupId); if (modelDs.Tables[0].Rows.Count > 0) { category.modelTypeId = Convert.ToInt32(modelDs.Tables[0].Rows[0]["modelTypeId"]); category.modelTypeName = Convert.ToString(modelDs.Tables[0].Rows[0]["modelTypeName"]); } category.itemList = DataTableToObject.ConvertToList <ItemEntity>(dsItem.Tables[0]); } content.categoryList.Add(category); } } #endregion responseData.success = true; responseData.data = content; return(responseData.ToJSON()); } else { //添加移动终端首页主表MobileHome homeBll.Create(new MobileHomeEntity { HomeId = Guid.NewGuid(), Title = "客户端首页", CustomerId = this.CurrentUserInfo.ClientID }); responseData.success = true; responseData.msg = string.Empty; return(responseData.ToJSON()); } } catch (Exception ex) { responseData.success = false; responseData.msg = ex.ToString(); return(responseData.ToJSON()); } }
protected override HomePageConfigRD ProcessRequest(DTO.Base.APIRequest <HomePageConfigRP> pRequest) { //创建连接用户对象 var logginUserInfo = base.CurrentUserInfo; var param = pRequest.Parameters; HomePageConfigRD resData = new HomePageConfigRD(); resData.eventList = new List <EventListEntity>(); resData.secondKill = new List <EventListEntity>(); resData.groupBuy = new List <EventListEntity>(); resData.hotBuy = new List <EventListEntity>(); resData.bargain = new List <EventListEntity>(); var bllHome = new MobileHomeBLL(logginUserInfo); MobileHomeEntity entityHome = new MobileHomeEntity();; if (!string.IsNullOrEmpty(param.HomeId)) { entityHome = bllHome.QueryByEntity(new MobileHomeEntity() { CustomerId = logginUserInfo.ClientID, HomeId = new Guid(param.HomeId) }, null).FirstOrDefault(); } else { entityHome = bllHome.QueryByEntity(new MobileHomeEntity() { CustomerId = logginUserInfo.ClientID, IsActivate = 1 }, null).FirstOrDefault(); } if (entityHome == null) { resData.Success = false; resData.ErrMsg = "商城正在维护1"; return(resData); } resData.Success = true; string strHomeId = entityHome.HomeId.ToString(); resData.sortActionJson = entityHome.sortActionJson == null ? "" : entityHome.sortActionJson;//返回排序数据 #region 广告部分 List <AdAreaInfo> AdAreaList = new List <AdAreaInfo> { }; var adBll = new MHAdAreaBLL(logginUserInfo); var tempAdArealist = adBll.GetAdByHomeId(strHomeId); AdAreaList.AddRange(tempAdArealist.Select(t => new AdAreaInfo { DisplayIndex = t.DisplayIndex, ImageUrl = t.ImageUrl, ObjectID = t.ObjectId, ObjectTypeID = t.ObjectTypeId, Url = t.Url })); #endregion resData.adAreaList = AdAreaList.ToArray(); #region 搜索框 var dsSearch = adBll.GetMHSearchArea(strHomeId);//获取搜索框 if (dsSearch != null && dsSearch.Tables.Count > 0 && dsSearch.Tables[0].Rows.Count > 0) { resData.search = DataTableToObject.ConvertToObject <MHSearchAreaEntity>(dsSearch.Tables[0].Rows[0]);//转换成一个对象时,里面的参数不能是一个表,而是一行数据 } #endregion #region 活动部分 var adAreaBll = new MHAdAreaBLL(logginUserInfo); var itemEventBll = new MHItemAreaBLL(logginUserInfo); var bllCategoryAreaGroup = new MHCategoryAreaGroupBLL(this.CurrentUserInfo); var allGroup = bllCategoryAreaGroup.QueryByEntity(new MHCategoryAreaGroupEntity { CustomerID = this.CurrentUserInfo.ClientID, HomeId = strHomeId }, null); var eventGroup = allGroup.Where(a => a.ModelTypeId == 5 || a.ModelTypeId == 6 || a.ModelTypeId == 7 || a.ModelTypeId == 8 || a.ModelTypeId == 9); foreach (var item in eventGroup) { DataSet dsEvent = new DataSet(); if (item.ModelTypeId == 8) { dsEvent = itemEventBll.GetEventListItemDetails(strHomeId, item.GroupId.ToString());//获取EventList } else { dsEvent = itemEventBll.GetItemDetails(strHomeId, item.GroupId.ToString()); } if (dsEvent != null && dsEvent.Tables.Count > 0 && dsEvent.Tables[0].Rows.Count > 0) { var dsEventList = DataTableToObject.ConvertToList <ItemEventAreaInfo>(dsEvent.Tables[0]); var category = new EventListEntity { showStyle = dsEventList.FirstOrDefault().ShowStyle, shopType = dsEventList.FirstOrDefault().TypeID, displayIndex = item.DisplayIndex, areaFlag = dsEventList.FirstOrDefault().areaFlag, arrayList = dsEventList }; if (dsEventList.FirstOrDefault().areaFlag == "eventList") { resData.eventList.Add(category); } if (dsEventList.FirstOrDefault().areaFlag == "secondKill") { resData.secondKill.Add(category); } if (dsEventList.FirstOrDefault().areaFlag == "groupBuy") { resData.groupBuy.Add(category); } if (dsEventList.FirstOrDefault().areaFlag == "hotBuy") { resData.hotBuy.Add(category); } if (dsEventList.FirstOrDefault().areaFlag == "bargain") { resData.bargain.Add(category); } } } #endregion List <CategoryGroupInfo> allList = new List <CategoryGroupInfo>(); eventGroup = allGroup.Where(a => a.ModelTypeId != 5 && a.ModelTypeId != 6 && a.ModelTypeId != 7 && a.ModelTypeId != 8 && a.ModelTypeId != 9 && a.ModelTypeId != 2); if (eventGroup != null) { foreach (var groupItem in eventGroup) { var category = new CategoryGroupInfo { groupID = groupItem.GroupId, CategoryAreaList = new List <CategoryAreaInfo>() }; category.modelTypeId = groupItem.ModelTypeId; category.modelTypeName = groupItem.ModelName; category.styleType = groupItem.StyleType; category.titleName = groupItem.TitleName; category.titleStyle = groupItem.TitleStyle; category.showCount = (int)groupItem.ShowCount; category.showName = (int)groupItem.ShowName; category.showPrice = (int)groupItem.ShowPrice; category.showSalesPrice = (int)groupItem.ShowSalesPrice; category.showDiscount = (int)groupItem.ShowDiscount; category.showSalesQty = (int)groupItem.ShowSalesQty; category.displayIndex = (int)groupItem.DisplayIndex; //根据groupId和HomeId来取MHCategoryArea if (groupItem.ModelTypeId == 2) { } else { } var dsItem = adAreaBll.GetItemList(category.groupID.ToString(), entityHome.HomeId.ToString()); if (dsItem != null && dsItem.Tables.Count > 0 && dsItem.Tables[0].Rows.Count > 0) { category.CategoryAreaList = DataTableToObject.ConvertToList <CategoryAreaInfo>(dsItem.Tables[0]); } allList.Add(category); } } //分类组合 List <CategoryGroupInfo> lc = allList.Where(p => p.modelTypeId == 1).ToList(); if (lc != null && lc.Count != 0) { resData.categoryEntrance = lc.OrderByDescending(p => p.groupID).ToList()[0];; } //创意组合 if (allList.Where(p => p.modelTypeId == 3).ToList() != null && allList.Where(p => p.modelTypeId == 3).ToList().Count != 0) { resData.originalityList = allList.Where(p => p.modelTypeId == 3).ToList(); } //导航 List <CategoryGroupInfo> lc4 = allList.Where(p => p.modelTypeId == 4).ToList(); if (lc4 != null && lc4.Count != 0) { resData.navList = lc4.OrderByDescending(p => p.groupID).ToList()[0];; //(获取唯一的) } //商品列表 eventGroup = allGroup.Where(a => a.ModelTypeId == 2); List <ProductListInfo> productList = new List <ProductListInfo>(); if (eventGroup != null) { foreach (var groupItem in eventGroup) { var category = new ProductListInfo { CategoryAreaList = new List <ProductInfo>() }; category.modelTypeId = groupItem.ModelTypeId; category.modelTypeName = groupItem.ModelName; category.styleType = groupItem.StyleType; category.titleName = groupItem.TitleName; category.titleStyle = groupItem.TitleStyle; category.showCount = (int)groupItem.ShowCount; category.showName = (int)groupItem.ShowName; category.showPrice = (int)groupItem.ShowPrice; category.showSalesPrice = (int)groupItem.ShowSalesPrice; category.showDiscount = (int)groupItem.ShowDiscount; category.showSalesQty = (int)groupItem.ShowSalesQty; category.displayIndex = (int)groupItem.DisplayIndex; MHCategoryAreaBLL bllCategoryArea = new MHCategoryAreaBLL(logginUserInfo); int intObjectId = bllCategoryArea.GetObjectTypeIDByGroupId((int)groupItem.GroupId); DataSet dsItem = null; if (intObjectId == 4) { dsItem = adAreaBll.GetGroupProductList(groupItem.GroupId.ToString(), entityHome.HomeId.ToString(), category.showCount); } else { dsItem = adAreaBll.GetCategoryProductList(groupItem.GroupId.ToString(), entityHome.HomeId.ToString(), category.showCount); } if (dsItem != null && dsItem.Tables.Count > 0 && dsItem.Tables[0].Rows.Count > 0) { category.CategoryAreaList = DataTableToObject.ConvertToList <ProductInfo>(dsItem.Tables[0]); } productList.Add(category); } } if (productList != null && productList.Count != 0) { resData.productList = productList.ToList();; } #region 关注信息 var bllFollow = new MHFollowBLL(CurrentUserInfo); var entity = new MHFollowEntity(); var dsFollow = bllFollow.QueryByEntity(new MHFollowEntity() { HomeId = strHomeId }, null); followInfo follow = new followInfo(); follow = dsFollow.Select(f => new followInfo() { HomeId = f.HomeId, FollowId = f.FollowId.ToString(), Title = f.Title, TextId = f.TextId, TextTitle = f.TextTitle, Url = f.Url, TypeId = f.TypeId }).FirstOrDefault(); resData.follow = follow; #endregion return(resData); }
protected override HomePageConfigV2RD ProcessRequest(APIRequest <HomePageConfigV2RP> pRequest) { //创建连接用户对象 var logginUserInfo = base.CurrentUserInfo; HomePageConfigV2RD RD = new HomePageConfigV2RD(); var adBll = new MHAdAreaBLL(logginUserInfo); //广告部分 #region 1.获取首页layout模块 List <layoutList> ArrlayoutList = new List <layoutList> { }; //用于填充layoutList数据集合 MHCategoryAreaGroupBLL mhBLL = new MHCategoryAreaGroupBLL(logginUserInfo); //Layout部分 DataSet layout = mhBLL.GetLayoutList(logginUserInfo.ClientID); if (layout != null && layout.Tables[0].Rows.Count > 0) { layoutList layoutinfo = new layoutList(); layoutinfo.layoutid = "001"; layoutinfo.x = 0; layoutinfo.y = 0; layoutinfo.width = 320; layoutinfo.height = 101; layoutinfo.type = "ad_1"; //广告 ArrlayoutList.Add(layoutinfo); int strhight = layoutinfo.height; int bY = 0; for (int i = 0; i < layout.Tables[0].Rows.Count; i++) { if (i == 0) { layoutinfo = new layoutList(); layoutinfo.layoutid = layout.Tables[0].Rows[i]["GroupValue"].ToString(); layoutinfo.x = 0; layoutinfo.y = strhight; layoutinfo.width = 320; layoutinfo.height = Convert.ToInt32(layout.Tables[0].Rows[i]["Height"].ToString()); layoutinfo.type = layout.Tables[0].Rows[i]["ModelType"].ToString(); bY = layoutinfo.y; } else { int bHeight = Convert.ToInt32(layout.Tables[0].Rows[i - 1]["height"]); int bTopDistance = Convert.ToInt32(layout.Tables[0].Rows[i - 1]["TopDistance"]); layoutinfo = new layoutList(); layoutinfo.layoutid = layout.Tables[0].Rows[i]["GroupValue"].ToString(); layoutinfo.x = 0; layoutinfo.y = bY + bHeight + bTopDistance; layoutinfo.width = 320; layoutinfo.height = Convert.ToInt32(layout.Tables[0].Rows[i]["height"].ToString()); layoutinfo.type = layout.Tables[0].Rows[i]["modeltype"].ToString(); bY = layoutinfo.y; } ArrlayoutList.Add(layoutinfo); } } #endregion #region 2.获取homedata模块 var ArrhomedataList = new List <homedataList> { }; //用于填充homedata数据集合 var homeBll = new MobileHomeBLL(this.CurrentUserInfo); //根据客户ID获取homeList集合 var homeList = homeBll.QueryByEntity(new MobileHomeEntity { CustomerId = this.CurrentUserInfo.ClientID }, null); if (homeList != null) { var homeEntity = homeList.FirstOrDefault(); var dsGroup = adBll.GetCategoryGroupId(homeEntity.HomeId.ToString()); var ArriteminfoList = new List <itemsList> { }; homedataList homeinfo = new homedataList(); itemsList tempAd = new itemsList(); #region 获取广告部分 var tempAdArealist = adBll.GetByCustomerID().OrderBy(t => t.DisplayIndex);//获取客户下图片广告集合 if (tempAdArealist != null) { homeinfo.layoutid = "001"; homeinfo.title = "Title"; foreach (var item in tempAdArealist) { tempAd = new itemsList(); tempAd.imgUrl = item.ImageUrl; tempAd.tagartUrl = GettagartUrl("MHAdArea", Convert.ToInt32(item.ObjectTypeId), CurrentUserInfo.ClientID.ToString(), item.ObjectId, item.Url, ""); tempAd.biztype = ""; tempAd.trackid = ""; ArriteminfoList.Add(tempAd); //广告 } homeinfo.items = ArriteminfoList.ToArray(); ArrhomedataList.Add(homeinfo); } #endregion #region 获取分类部分 if (dsGroup != null && dsGroup.Tables.Count > 0 && dsGroup.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsGroup.Tables[0].Rows) { ArriteminfoList = new List <itemsList> { }; homeinfo = new homedataList(); homeinfo.layoutid = dr["GroupId"].ToString(); homeinfo.title = "Title"; var dsItem = adBll.GetItemList(homeinfo.layoutid, homeEntity.HomeId.ToString()); if (dsItem != null && dsItem.Tables.Count > 0 && dsItem.Tables[0].Rows.Count > 0) { foreach (DataRow itemrow in dsItem.Tables[0].Rows) { tempAd = new itemsList(); tempAd.imgUrl = itemrow["imageUrl"].ToString(); tempAd.tagartUrl = GettagartUrl("MHCategoryArea", Convert.ToInt32(itemrow["typeId"]), CurrentUserInfo.ClientID.ToString(), itemrow["objectId"].ToString(), itemrow["imageUrl"].ToString(), itemrow["categoryAreaId"].ToString()); tempAd.biztype = ""; tempAd.trackid = "1314"; ArriteminfoList.Add(tempAd); } homeinfo.items = ArriteminfoList.ToArray(); //分类部分 ArrhomedataList.Add(homeinfo); } } } #endregion } #endregion RD.timespan = ""; RD.version = ""; RD.layout = ArrlayoutList.ToArray(); RD.homedata = ArrhomedataList.ToArray(); return(RD); }