protected override DelayEventRD ProcessRequest(APIRequest <DelayEventRP> pRequest) { var rd = new DelayEventRD(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; T_CTW_LEventBLL bllCTWEvent = new T_CTW_LEventBLL(loggingSessionInfo); T_CTW_LEventEntity entityCTWEvent = new T_CTW_LEventEntity(); entityCTWEvent = bllCTWEvent.GetByID(para.CTWEventId); entityCTWEvent.EndDate = Convert.ToDateTime(para.EndDate); bllCTWEvent.Update(entityCTWEvent, null); if (para.EventType == "Game") { T_CTW_LEventInteractionBLL bllEventInteraction = new T_CTW_LEventInteractionBLL(loggingSessionInfo); string strEventId = bllEventInteraction.QueryByEntity(new T_CTW_LEventInteractionEntity() { CTWEventId = new Guid(para.CTWEventId) }, null).FirstOrDefault().LeventId; LEventsBLL bllEvent = new LEventsBLL(loggingSessionInfo); bllEvent.Update(new LEventsEntity() { EndTime = para.EndDate, EventID = strEventId }, false); } if (para.EventType == "Sales") { PanicbuyingEventBLL bllEvent = new PanicbuyingEventBLL(loggingSessionInfo); bllEvent.DelayEvent(para.CTWEventId, para.EndDate); } rd.EventId = para.CTWEventId; return(rd); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Update(T_CTW_LEventEntity pEntity, IDbTransaction pTran) { _currentDAO.Update(pEntity, pTran); }
/// <summary> /// 创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> public void Create(T_CTW_LEventEntity pEntity) { _currentDAO.Create(pEntity); }
/// <summary> /// 分页根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public PagedQueryResult <T_CTW_LEventEntity> PagedQueryByEntity(T_CTW_LEventEntity 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 T_CTW_LEventEntity[] QueryByEntity(T_CTW_LEventEntity pQueryEntity, OrderBy[] pOrderBys) { return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys)); }
/// <summary> /// 删除 /// </summary> /// <param name="pEntity"></param> public void Delete(T_CTW_LEventEntity pEntity) { _currentDAO.Delete(pEntity); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> public void Update(T_CTW_LEventEntity pEntity) { _currentDAO.Update(pEntity); }
protected override SetCTWEventRD ProcessRequest(APIRequest <SetCTWEventRP> pRequest) { //图文信息 //微信 公共平台 var wapentity = new WApplicationInterfaceBLL(loggingSessionInfo).QueryByEntity(new WApplicationInterfaceEntity { CustomerId = loggingSessionInfo.ClientID, IsDelete = 0 }, null).FirstOrDefault();//取默认的第一个微信 if (wapentity == null) { throw new APIException("微信公众号未授权") { ErrorCode = 343 }; } var rd = new SetCTWEventRD(); var para = pRequest.Parameters; strCTWEventId = para.CTWEventId; string strThemeId = string.Empty; string strStartDate = string.Empty; string strEndDate = string.Empty; string strGameEventGuid = string.Empty; string strPageParamJson = string.Empty; T_CTW_LEventBLL bllCustomerEvent = new T_CTW_LEventBLL(loggingSessionInfo); T_CTW_LEventThemeBLL bllCustomerTheme = new T_CTW_LEventThemeBLL(loggingSessionInfo); T_CTW_LEventInteractionBLL bllCustomerInteraction = new T_CTW_LEventInteractionBLL(loggingSessionInfo); T_CTW_PanicbuyingEventKVBLL bllPanicbuyingEventKV = new T_CTW_PanicbuyingEventKVBLL(loggingSessionInfo); T_CTW_SpreadSettingBLL bllSpreadSetting = new T_CTW_SpreadSettingBLL(loggingSessionInfo); LPrizesBLL bllPrize = new LPrizesBLL(loggingSessionInfo); ObjectImagesBLL imageBll = new ObjectImagesBLL(loggingSessionInfo); entityCustomerEvent = bllCustomerEvent.GetByID(strCTWEventId); if (entityCustomerEvent != null) { ///风格 entityTheme = bllCustomerTheme.QueryByEntity(new T_CTW_LEventThemeEntity() { CTWEventId = new Guid(strCTWEventId), OriginalThemeId = new Guid(para.OriginalThemeId) }, null).FirstOrDefault(); //互动方式 entityInteraction = bllCustomerInteraction.QueryByEntity(new T_CTW_LEventInteractionEntity { CTWEventId = new Guid(strCTWEventId), OriginalLeventId = new Guid(para.OriginalLeventId) }, null).FirstOrDefault(); } //保存风格 SaveAndUpdateTheme(para, entityTheme, out strThemeId); //互动类型--游戏 if (para.InteractionType == 1 && para.GameEventInfo != null) { SaveGameEvent(para, bllPrize, bllCustomerInteraction, strThemeId, out strStartDate, out strEndDate, out strGameEventGuid); para.MaterialText.PageParamJson = "[{\"key\":\"eventId\",\"value\":\"" + strCTWEventId + "\"}]"; strPageParamJson = "[{\"key\":\"eventId\",\"value\":\"" + strCTWEventId + "\"}]"; } //互动类型--促销 if (para.InteractionType == 2 && para.PanicbuyingEventInfo != null) { SavePanicbuyingEvent(para, bllPanicbuyingEventKV, imageBll, bllCustomerInteraction, strThemeId, out strStartDate, out strEndDate); string strEventType = string.Empty; switch (para.DrawMethodCode) { case "TG": strEventType = "1"; break; case "QG": strEventType = "2"; break; case "RX": strEventType = "3"; break; default: strEventType = "99"; break; } para.MaterialText.PageParamJson = "[{\"key\":\"CTWEventId\",\"value\":\"" + strCTWEventId + "\"},{\"key\":\"eventTypeId\",\"value\":\"" + strEventType + "\"}]"; strPageParamJson = "[{\"key\":\"CTWEventId\",\"value\":\"" + strCTWEventId + "\"},{\"key\":\"eventTypeId\",\"value\":\"" + strEventType + "\"}]"; //SaveAndUpdatePanicbuyingEvent(para,bllPrize,bllPanicbuyingEventKV,imageBll,bllCustomerInteraction, strThemeId, out strStartDate, out strEndDate); } string strFocesQRCodeUrl = string.Empty; //分享,推广 if (para.SpreadSettingList.Count > 0) { SaveSpreadSetting(para, bllSpreadSetting, imageBll, wapentity, out strFocesQRCodeUrl); } ///推广关注的奖励设置入 触点活动数据表 if (para.ContactPrizeList != null && para.ContactPrizeList.Count > 0) { SaveContactPrize(para, bllPrize, strStartDate, strEndDate); } string strOnlineQRCodeId = string.Empty; string strOfflineQRCodeId = string.Empty; string strOnlineQRCodeUrl = string.Empty; string strOfflineQRCodeUrl = string.Empty; string strOnlineRedirectUrl = string.Empty; string strOfflineRedirectUrl = string.Empty; var WQRCodeManagerbll = new WQRCodeManagerBLL(loggingSessionInfo); if (!string.IsNullOrEmpty(para.OfflineQRCodeId)) { WQRCodeManagerbll.Delete(new WQRCodeManagerEntity() { QRCodeId = new Guid(para.OfflineQRCodeId) }); } if (!string.IsNullOrEmpty(para.OnlineQRCodeId)) { WQRCodeManagerbll.Delete(new WQRCodeManagerEntity() { QRCodeId = new Guid(para.OnlineQRCodeId) }); } CreateQRCode(para, wapentity, strPageParamJson, out strOfflineQRCodeId, out strOfflineQRCodeUrl, out strOfflineRedirectUrl); CreateH5QRCode(para, wapentity, out strOnlineQRCodeId, out strOnlineQRCodeUrl, out strOnlineRedirectUrl); rd.OfflineQRCodeUrl = strOfflineQRCodeUrl; rd.OnlineQRCodeUrl = strOnlineQRCodeUrl; rd.OfflineRedirectUrl = strOfflineRedirectUrl; rd.OnlineRedirectUrl = strOnlineRedirectUrl;//strFocesQRCodeUrl; if (entityCustomerEvent != null) { //活动主表 entityCustomerEvent.Name = para.TemplateName; entityCustomerEvent.Desc = para.TemplateDesc; entityCustomerEvent.InteractionType = para.InteractionType; entityCustomerEvent.ActivityGroupId = new Guid(para.ActivityGroupId); entityCustomerEvent.ImageURL = para.TemplateImageURL; entityCustomerEvent.StartDate = Convert.ToDateTime(strStartDate); entityCustomerEvent.EndDate = Convert.ToDateTime(strEndDate); entityCustomerEvent.OnlineQRCodeId = strOnlineQRCodeId; entityCustomerEvent.OfflineQRCodeId = strOfflineQRCodeId; entityCustomerEvent.OffLineRedirectUrl = strOfflineRedirectUrl; entityCustomerEvent.OnLineRedirectUrl = strOnlineRedirectUrl; bllCustomerEvent.Update(entityCustomerEvent); } else { entityCustomerEvent = new T_CTW_LEventEntity() { CTWEventId = new Guid(para.CTWEventId), TemplateId = new Guid(para.TemplateId), Name = para.TemplateName, Desc = para.TemplateDesc, ActivityGroupId = new Guid(para.ActivityGroupId), InteractionType = para.InteractionType, ImageURL = para.TemplateImageURL, Status = 10, CustomerId = loggingSessionInfo.ClientID, StartDate = Convert.ToDateTime(strStartDate), EndDate = Convert.ToDateTime(strEndDate), OfflineQRCodeId = strOfflineQRCodeId, OnlineQRCodeId = strOnlineQRCodeId, OffLineRedirectUrl = strOfflineRedirectUrl, OnLineRedirectUrl = strOnlineRedirectUrl }; bllCustomerEvent.Create(entityCustomerEvent); } return(rd); }