/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Update(PanicbuyingKJEventJoinEntity pEntity, IDbTransaction pTran) { _currentDAO.Update(pEntity, pTran); }
/// <summary> /// 创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> public void Create(PanicbuyingKJEventJoinEntity pEntity) { _currentDAO.Create(pEntity); }
/// <summary> /// 分页根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public PagedQueryResult <PanicbuyingKJEventJoinEntity> PagedQueryByEntity(PanicbuyingKJEventJoinEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex) { return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex)); }
/// <summary> /// 根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public PanicbuyingKJEventJoinEntity[] QueryByEntity(PanicbuyingKJEventJoinEntity pQueryEntity, OrderBy[] pOrderBys) { return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys)); }
/// <summary> /// 删除 /// </summary> /// <param name="pEntity"></param> public void Delete(PanicbuyingKJEventJoinEntity pEntity) { _currentDAO.Delete(pEntity); }
protected override JoinInKJEventRD ProcessRequest(APIRequest <JoinInKJEventRP> pRequest) { JoinInKJEventRP rp = pRequest.Parameters; JoinInKJEventRD rd = new JoinInKJEventRD(); PanicbuyingKJEventJoinBLL panicbuyingKJEventJoinBll = new PanicbuyingKJEventJoinBLL(CurrentUserInfo); PanicbuyingEventBLL panicbuyingEventBll = new PanicbuyingEventBLL(CurrentUserInfo); PanicbuyingKJEventItemMappingBLL panicbuyingKJEventItemMappingBll = new PanicbuyingKJEventItemMappingBLL(CurrentUserInfo); if (string.IsNullOrEmpty(rp.EventId)) { throw new APIException("EventId不能为空"); } if (string.IsNullOrEmpty(rp.SkuId)) { throw new APIException("SkuId不能为空"); } #region 价参与 PanicbuyingKJEventJoinEntity panicbuyingKJEventJoinEntity = new PanicbuyingKJEventJoinEntity() { KJEventJoinId = Guid.NewGuid(), EventId = new Guid(rp.EventId), ItemId = rp.ItemId, SkuId = rp.SkuId, VipId = pRequest.UserID, CustomerId = pRequest.CustomerID, SalesPrice = rp.Price, }; panicbuyingKJEventJoinBll.Create(panicbuyingKJEventJoinEntity); #endregion #region 更新参与砍价活动人数统计 var panicbuyingEventEnetity = panicbuyingEventBll.QueryByEntity(new PanicbuyingEventEntity() { EventId = new Guid(rp.EventId) }, null).FirstOrDefault(); if (panicbuyingEventEnetity != null) { panicbuyingEventEnetity.PromotePersonCount += 1; //panicbuyingEventEnetity.BargainPersonCount += 1; panicbuyingEventBll.Update(panicbuyingEventEnetity); } #endregion #region 更新发起砍价商品活动人数统计 var panicbuyingKJEventItemMappingEntity = panicbuyingKJEventItemMappingBll.QueryByEntity(new PanicbuyingKJEventItemMappingEntity() { EventId = new Guid(rp.EventId), ItemID = rp.ItemId }, null).FirstOrDefault(); if (panicbuyingKJEventItemMappingEntity != null) { panicbuyingKJEventItemMappingEntity.PromotePersonCount += 1; panicbuyingKJEventItemMappingBll.Update(panicbuyingKJEventItemMappingEntity); } #endregion rd.KJEventJoinId = panicbuyingKJEventJoinEntity.KJEventJoinId.ToString(); return(rd); }