/// <summary> /// 绑定TreeGrid数据 /// </summary> /// <returns></returns> public string GetTreeStoreJSON() { IList <TItemTagEntity> list = new List <TItemTagEntity>(); //获取商品与分类关系 IList <ItemCategoryMappingEntity> mappinglist = null; if (Request("itemID") != null && Request("itemID") != string.Empty) { mappinglist = new ItemCategoryMappingBLL(CurrentUserInfo).GetItemCategoryListByItemId(Request("itemID").ToString().Trim()); } foreach (TItemTagEntity item in new ItemCategoryService(CurrentUserInfo).GetItemTagListByParentId("")) { if (item.Status == 1) { AddChildNode(item, mappinglist); if (item.children.Count == 0) { item.leaf = true; } else { item.expanded = true; } //勾选相关分类 if (mappinglist != null) { foreach (ItemCategoryMappingEntity mappinginfo in mappinglist) { if (mappinginfo.ItemCategoryId == item.ItemTagID.Value.ToString()) { item.@checked = true; item.IsFirstVisit = mappinginfo.IsFirstVisit; break; } } if (item.@checked != true) { item.@checked = false; item.IsFirstVisit = 0; } } else { item.@checked = false; item.IsFirstVisit = 0; } list.Add(item); } } return(string.Format("{{\"text\":\"\",\"children\":{0}}}", list.ToJSON())); }
public string UpdateSalesPromotion(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <UpdateSalesPromotionRP> >(); var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var rd = new UpdateSalesPromotionRD();//返回值 //处理促销分组 ItemCategoryMappingBLL itemCategoryMappingBLL = new ItemCategoryMappingBLL(loggingSessionInfo); foreach (var itemInfo in rp.Parameters.ItemInfoList)//数组,更新数据 { itemCategoryMappingBLL.DeleteByItemID(itemInfo.Item_Id); //这里不应该删除之前的促销分组,而应该根据商品的id和促销分组的id找一找,如果有isdelete=0的,就不要加,没有就加 ; foreach (var SalesPromotion in rp.Parameters.SalesPromotionList) { ItemCategoryMappingEntity en = new ItemCategoryMappingEntity(); en.ItemId = itemInfo.Item_Id; en.ItemCategoryId = SalesPromotion.ItemCategoryId; var enlist = itemCategoryMappingBLL.QueryByEntity(en, null); if (enlist == null || enlist.Length == 0) { SalesPromotion.MappingId = Guid.NewGuid(); SalesPromotion.ItemId = itemInfo.Item_Id; // SalesPromotion.status = "1"; SalesPromotion.IsDelete = 0; SalesPromotion.CreateBy = ""; SalesPromotion.CreateTime = DateTime.Now; SalesPromotion.LastUpdateTime = DateTime.Now; SalesPromotion.LastUpdateBy = ""; itemCategoryMappingBLL.Create(SalesPromotion); } } } var rsp = new SuccessResponse <IAPIResponseData>(rd); return(rsp.ToJSON()); }