/// <summary> /// 创建活动 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public string AddPanicbuyingEvent(PanicbuyingEventEntity pEntity, IDbTransaction pTran) { return(this._currentDAO.AddPanicbuyingEvent(pEntity, pTran)); }
protected override SetBargainRD ProcessRequest(DTO.Base.APIRequest <SetBargainRP> pRequest) { var rd = new SetBargainRD(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var bllPanicbuyingEvent = new PanicbuyingEventBLL(loggingSessionInfo); string REventId = string.Empty; if (string.IsNullOrEmpty(para.EventId)) { var entityPanicbuyingEvent = new PanicbuyingEventEntity(); entityPanicbuyingEvent.EventId = System.Guid.NewGuid(); entityPanicbuyingEvent.EventName = para.EventName; #region 称重复处理 var Result = bllPanicbuyingEvent.QueryByEntity(new PanicbuyingEventEntity() { EventName = para.EventName, EventTypeId = 4, CustomerID = CurrentUserInfo.ClientID }, null).ToList(); if (Result.Count() > 0) { throw new APIException("已有相同的砍价活动名称,请重新命名!"); } #endregion entityPanicbuyingEvent.BeginTime = para.BeginTime; entityPanicbuyingEvent.EndTime = para.EndTime; // entityPanicbuyingEvent.EventTypeId = 4; entityPanicbuyingEvent.EventStatus = 20; entityPanicbuyingEvent.PromotePersonCount = 0; entityPanicbuyingEvent.BargainPersonCount = 0; entityPanicbuyingEvent.ItemQty = 0; entityPanicbuyingEvent.IsCTW = 0; entityPanicbuyingEvent.CustomerID = loggingSessionInfo.ClientID; bllPanicbuyingEvent.Create(entityPanicbuyingEvent); // REventId = entityPanicbuyingEvent.EventId.ToString(); } else { var UpdateData = bllPanicbuyingEvent.GetByID(para.EventId); if (UpdateData == null) { throw new APIException("未找到砍价活动!") { ErrorCode = ERROR_CODES.INVALID_BUSINESS } } ; #region 称重复处理 if (!UpdateData.EventName.Trim().Equals(para.EventName.Trim())) { var Result = bllPanicbuyingEvent.QueryByEntity(new PanicbuyingEventEntity() { EventName = para.EventName, EventTypeId = 4, CustomerID = CurrentUserInfo.ClientID }, null).ToList(); if (Result.Count() > 0) { throw new APIException("已有相同的砍价活动名称,请重新命名!") { ErrorCode = ERROR_CODES.INVALID_BUSINESS } } ; } #endregion if (UpdateData.EndTime < DateTime.Now) { throw new APIException("砍价活动已经结束了!") { ErrorCode = ERROR_CODES.INVALID_BUSINESS } } ; UpdateData.EventName = para.EventName; UpdateData.BeginTime = para.BeginTime; UpdateData.EndTime = para.EndTime; bllPanicbuyingEvent.Update(UpdateData); // REventId = para.EventId; } rd.EventId = REventId; return(rd); } } }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Update(PanicbuyingEventEntity pEntity, IDbTransaction pTran) { Update(pEntity, true, pTran); }
public void Update(PanicbuyingEventEntity pEntity, bool pIsUpdateNullField, IDbTransaction pTran) { _currentDAO.Update(pEntity, pIsUpdateNullField, pTran); }
/// <summary> /// 创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> public void Create(PanicbuyingEventEntity pEntity) { _currentDAO.Create(pEntity); }
/// <summary> /// 在事务内创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Create(PanicbuyingEventEntity pEntity, IDbTransaction pTran) { _currentDAO.Create(pEntity, pTran); }
/// <summary> /// 分页根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public PagedQueryResult <PanicbuyingEventEntity> PagedQueryByEntity(PanicbuyingEventEntity 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 PanicbuyingEventEntity[] QueryByEntity(PanicbuyingEventEntity pQueryEntity, OrderBy[] pOrderBys) { return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys)); }
/// <summary> /// 删除 /// </summary> /// <param name="pEntity"></param> public void Delete(PanicbuyingEventEntity pEntity) { _currentDAO.Delete(pEntity); }
public void Update(PanicbuyingEventEntity pEntity, bool pIsUpdateNullField) { _currentDAO.Update(pEntity, pIsUpdateNullField); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> public void Update(PanicbuyingEventEntity pEntity) { Update(pEntity, true); }