public string ItemToggleStatus(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <UpdateSalesPromotionRP> >(); var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var rd = new UpdateSalesPromotionRD();//返回值 //更改商品上架下架状态 ItemService itemService = new ItemService(loggingSessionInfo); foreach (var itemInfo in rp.Parameters.ItemInfoList)//数组,更新数据 { itemService.SetItemStatus(loggingSessionInfo, itemInfo.Item_Id, rp.Parameters.Status); } var rsp = new SuccessResponse <IAPIResponseData>(rd); return(rsp.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()); }