/// <summary> /// 列表获取 /// </summary> public IList <ItemKeepEntity> GetList(ItemKeepEntity entity, int Page, int PageSize) { var lNewsBLL = new LNewsBLL(CurrentUserInfo); var objectImagesBLL = new ObjectImagesBLL(CurrentUserInfo); var itemService = new ItemService(CurrentUserInfo); if (PageSize <= 0) { PageSize = 15; } IList <ItemKeepEntity> eventsList = new List <ItemKeepEntity>(); DataSet ds = new DataSet(); ds = _currentDAO.GetList(entity, Page, PageSize); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { eventsList = DataTableToObject.ConvertToList <ItemKeepEntity>(ds.Tables[0]); if (eventsList != null) { foreach (var item in eventsList) { item.ItemDetail = itemService.GetVwItemDetailById(item.ItemId, entity.VipId); } } } return(eventsList); }
/// <summary> /// 设置收藏 /// </summary> /// <param name="ItemId"></param> /// <param name="ItemKeepStatus"></param> /// <param name="UserId"></param> /// <param name="strError"></param> /// <returns></returns> public bool SetItemKeep(string ItemId, string ItemKeepStatus, string UserId, out string strError) { try { ItemKeepEntity itemKeepInfo = new ItemKeepEntity(); //1.判断是否存在 var itemKeepInfoList = _currentDAO.QueryByEntity(new ItemKeepEntity() { ItemId = ItemId , VipId = UserId }, null); if (itemKeepInfoList == null || itemKeepInfoList.Length == 0) { itemKeepInfo.ItemKeepId = BaseService.NewGuidPub(); itemKeepInfo.ItemId = ItemId; itemKeepInfo.KeepStatus = Convert.ToInt32(ItemKeepStatus); itemKeepInfo.CreateBy = UserId; itemKeepInfo.LastUpdateBy = UserId; itemKeepInfo.CreateTime = System.DateTime.Now; itemKeepInfo.LastUpdateTime = System.DateTime.Now; itemKeepInfo.VipId = UserId; _currentDAO.Create(itemKeepInfo); } else { itemKeepInfo = itemKeepInfoList[0]; itemKeepInfo.KeepStatus = Convert.ToInt32(ItemKeepStatus); if (itemKeepInfo.VipId == null || itemKeepInfo.VipId.Equals("")) { itemKeepInfo.VipId = UserId; } _currentDAO.Update(itemKeepInfo); } strError = "收藏成功"; return(true); } catch (Exception ex) { strError = ex.ToString(); return(false); } }
public string SetFavorite(string pRequest) { var rd = new APIResponse <SetFavoriteRD>(); var rdData = new SetFavoriteRD(); var rp = pRequest.DeserializeJSONTo <APIRequest <SetFavoriteRP> >(); if (rp.Parameters == null) { throw new ArgumentException(); } if (rp.Parameters != null) { rp.Parameters.Validate(); } var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID); try { ItemKeepBLL itemBll = new ItemKeepBLL(loggingSessionInfo); ItemKeepEntity entity = itemBll.GetItemKeepByUser(rp.Parameters.OnlineCourseID, rp.UserID); //加入收藏 if (rp.Parameters.IsFavorite.Equals("1")) { if (entity == null) { entity = new ItemKeepEntity() { ItemKeepId = Guid.NewGuid().ToString().Replace("-", ""), ItemId = rp.Parameters.OnlineCourseID, VipId = rp.UserID, KeepStatus = 1, ItemType = 1//默认1,保留字段 }; itemBll.Create(entity); } else { if (entity.KeepStatus != 1) { entity.KeepStatus = 1; itemBll.Update(entity); } } } else //取消收藏 { if (entity != null) { entity.KeepStatus = 0; itemBll.Update(entity); } } rd.ResultCode = 0; rdData.IsSuccess = true; } catch (Exception ex) { rd.ResultCode = 103; rd.Message = ex.Message; } rd.Data = rdData; return(rd.ToJSON()); }
/// <summary> /// 列表数量获取 /// </summary> public int GetListCount(ItemKeepEntity entity) { return(_currentDAO.GetListCount(entity)); }
public void Update(ItemKeepEntity pEntity, bool pIsUpdateNullField, IDbTransaction pTran) { _currentDAO.Update(pEntity, pIsUpdateNullField, pTran); }
/// <summary> /// 在事务内创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Create(ItemKeepEntity pEntity, IDbTransaction pTran) { _currentDAO.Create(pEntity, pTran); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Update(ItemKeepEntity pEntity, IDbTransaction pTran) { Update(pEntity, true, pTran); }
/// <summary> /// 分页根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public PagedQueryResult <ItemKeepEntity> PagedQueryByEntity(ItemKeepEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex) { return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex)); }
/// <summary> /// 创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> public void Create(ItemKeepEntity pEntity) { _currentDAO.Create(pEntity); }
/// <summary> /// 根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public ItemKeepEntity[] QueryByEntity(ItemKeepEntity pQueryEntity, OrderBy[] pOrderBys) { return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys)); }
/// <summary> /// 删除 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Delete(ItemKeepEntity pEntity, IDbTransaction pTran) { _currentDAO.Delete(pEntity, pTran); }
/// <summary> /// 删除 /// </summary> /// <param name="pEntity"></param> public void Delete(ItemKeepEntity pEntity) { _currentDAO.Delete(pEntity); }
public void Update(ItemKeepEntity pEntity, bool pIsUpdateNullField) { _currentDAO.Update(pEntity, pIsUpdateNullField); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> public void Update(ItemKeepEntity pEntity) { Update(pEntity, true); }