Beispiel #1
0
        protected override ChangeCTWEventStatusRD ProcessRequest(APIRequest <ChangeCTWEventStatusRP> pRequest)
        {
            var             rd   = new ChangeCTWEventStatusRD();
            var             para = pRequest.Parameters;
            var             loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            T_CTW_LEventBLL bllCTWEvent        = new T_CTW_LEventBLL(loggingSessionInfo);

            if (!string.IsNullOrEmpty(para.CTWEventId) && para.Status > 0)
            {
                var entityCTWEvent = bllCTWEvent.GetByID(para.CTWEventId);

                if (entityCTWEvent != null)
                {
                    if (entityCTWEvent.EndDate < DateTime.Now.Date)
                    {
                        throw new APIException(999, "活动已经过期请调整时间后再发布!");
                    }
                    entityCTWEvent.Status = para.Status;
                    bllCTWEvent.Update(entityCTWEvent);

                    rd.CTWEventId = para.CTWEventId;
                    rd.Status     = para.Status;

                    bllCTWEvent.ChangeCTWEventStart(para.CTWEventId);
                    T_CTW_LEventTemplateBLL bllTemplate = new T_CTW_LEventTemplateBLL(loggingSessionInfo);
                    try
                    {
                        bllTemplate.UpdateTemplateInfo(entityCTWEvent.TemplateId.ToString(), 1);
                    }
                    catch { }
                }
            }
            return(rd);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        /// <summary>
        /// 获取带促销活动的创意仓库的统计
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        protected override GetPanicbuyingEventStatsRD ProcessRequest(APIRequest <GetPanicbuyingEventStatsRP> pRequest)
        {
            var rd   = new GetPanicbuyingEventStatsRD();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            T_CTW_LEventBLL bllLEvent = new T_CTW_LEventBLL(loggingSessionInfo);
            //获取带促销活动的创意仓库的统计
            DataSet dsPanicbuyingEventStats = bllLEvent.GetPanicbuyingEventStats(para.CTWEventId);

            if (dsPanicbuyingEventStats != null && dsPanicbuyingEventStats.Tables.Count > 0 && dsPanicbuyingEventStats.Tables[0].Rows.Count > 0)
            {
                rd.PanicbuyingEventStatsInfo = DataTableToObject.ConvertToObject <PanicbuyingEventStatsInfo>(dsPanicbuyingEventStats.Tables[0].Rows[0]);
            }
            return(rd);
        }
Beispiel #4
0
        protected override GetLEventStatsRD ProcessRequest(APIRequest <CTWEventRP> pRequest)
        {
            var rd = new GetLEventStatsRD();

            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            T_CTW_LEventBLL bllLEvent = new T_CTW_LEventBLL(loggingSessionInfo);
            DataSet         ds        = bllLEvent.GetCTW_LEventStats(para.CTWEventId);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                rd.LeventsStats = DataTableToObject.ConvertToObject <LeventsStats>(ds.Tables[0].Rows[0]);
            }
            return(rd);
        }
Beispiel #5
0
        protected override ActivityListRD ProcessRequest(APIRequest <ActivityListRP> pRequest)
        {
            var rd = new ActivityListRD();

            var               para = pRequest.Parameters;
            var               loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            T_CTW_LEventBLL   bllCTWEvent        = new T_CTW_LEventBLL(loggingSessionInfo);
            WQRCodeManagerBLL bllWQRCode         = new WQRCodeManagerBLL(loggingSessionInfo);
            DataSet           ds = bllCTWEvent.GetLeventInfo(para.Status, para.ActivityGroupCode, para.EventName);

            if (ds != null && ds.Tables.Count > 0)
            {
                //var activity = new MyActivity();
                //List<MyActivity> ActiviyList = new List<MyActivity>();
                //foreach (DataRow dr in ds.Tables[0].Rows)
                //{
                //    activity = DataTableToObject.ConvertToObject<MyActivity>(dr);
                //    if (dr["DrawMethodCode"].ToString() == "HB" || dr["DrawMethodCode"].ToString() == "DZP" || dr["DrawMethodCode"].ToString() == "QN")
                //    {
                //        activity.EventInfo = DataTableToObject.ConvertToObject<EventInfo>(bllCTWEvent.GetEventInfoByLEventId(1, dr["LeventId"].ToString()).Tables[0].Rows[0]);
                //    }
                //    if (dr["DrawMethodCode"].ToString() == "QG" || dr["DrawMethodCode"].ToString() == "TG" || dr["DrawMethodCode"].ToString() == "RX")
                //    {
                //        activity.EventInfo = DataTableToObject.ConvertToObject<EventInfo>(bllCTWEvent.GetEventInfoByLEventId(2, dr["LeventId"].ToString()).Tables[0].Rows[0]);
                //    }
                //    //WQRCodeManagerEntity entityQRCode = bllWQRCode.QueryByEntity(new WQRCodeManagerEntity() { ObjectId = dr["CTWEventId"].ToString() }, null).FirstOrDefault();
                //    //activity.QRCodeImageUrlForOnline = entityQRCode == null ? "" : entityQRCode.ImageUrl;

                //    //entityQRCode = bllWQRCode.QueryByEntity(new WQRCodeManagerEntity() { ObjectId = dr["LeventId"].ToString() }, null).FirstOrDefault();
                //    //activity.QRCodeImageUrlForUnit = entityQRCode == null ? "" : entityQRCode.ImageUrl;
                //    ActiviyList.Add(activity);
                //}
                rd.MyActivityList = DataTableToObject.ConvertToList <MyActivity>(ds.Tables[0]);
            }
            DataSet dsEvent = new DataSet();

            dsEvent = bllCTWEvent.GetEventStatusCount(loggingSessionInfo.CurrentUser.customer_id);
            if (dsEvent != null && dsEvent.Tables.Count > 0)
            {
                rd.EventStatusCoountList = DataTableToObject.ConvertToList <EventStatusCoount>(dsEvent.Tables[0]);
            }
            return(rd);
        }
        protected override GetCTWLEventListRD ProcessRequest(DTO.Base.APIRequest <GetCTWLEventListRP> pRequest)
        {
            var rd   = new GetCTWLEventListRD();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var Bll = new T_CTW_LEventBLL(loggingSessionInfo);

            //排序
            var pOrderBys = new List <OrderBy>();

            pOrderBys.Add(new OrderBy()
            {
                FieldName = "LastUpdateTime", Direction = OrderByDirections.Desc
            });

            var Result = Bll.PagedQueryByEntity(new T_CTW_LEventEntity()
            {
                Status = 20, CustomerId = this.CurrentUserInfo.ClientID
            }, pOrderBys.ToArray(), para.PageSize, para.PageIndex);

            rd.TotalCount = Result.RowCount;
            rd.TotalPage  = Result.PageCount;

            rd.CTWLEventInfoList = Result.Entities.Select(m => new CTWLEventInfo()
            {
                CTWEventId = m.CTWEventId.ToString(),
                Name       = m.Name,
                //StartDate = m.StartDate.Value.ToString("yyyy年MM月dd日"),
                //EndDate = m.EndDate.Value.ToString("yyyy年MM月dd日"),
                StartDate        = m.StartDate.Value.ToString("yyyy-MM-dd"),
                EndDate          = m.EndDate.Value.ToString("yyyy-MM-dd"),
                OnfflineQRCodeId = m.OnlineQRCodeId
            }).ToList();

            //获取线下二维码URL
            foreach (var item in rd.CTWLEventInfoList)
            {
                item.OnfflineQRCodeUrl = Bll.GetOnlineQRCodeUrl(item.OnfflineQRCodeId);
            }

            return(rd);
        }
        protected override GetPanicbuyingEventRankingStatsRD ProcessRequest(APIRequest <CTWEventRP> pRequest)
        {
            var rd = new GetPanicbuyingEventRankingStatsRD();

            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            T_CTW_LEventBLL bllLEvent = new T_CTW_LEventBLL(loggingSessionInfo);
            DataSet         ds        = bllLEvent.GetCTW_PanicbuyingEventRankingStats(para.CTWEventId);

            if (ds != null && ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    rd.OrderMoneyRankList = DataTableToObject.ConvertToList <OrderMoneyRank>(ds.Tables[0]);
                }
                if (ds.Tables[1].Rows.Count > 0)
                {
                    rd.OrderCountRankList = DataTableToObject.ConvertToList <OrderCountRank>(ds.Tables[1]);
                }
            }
            return(rd);
        }
Beispiel #8
0
        /// <summary>
        /// 获取游戏与促销会员增长排行
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        protected override GetVipAddRankingStatsRD ProcessRequest(APIRequest <GetVipAddRankingStatsRP> pRequest)
        {
            var rd   = new GetVipAddRankingStatsRD();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            T_CTW_LEventBLL bllLEvent = new T_CTW_LEventBLL(loggingSessionInfo);
            //获取游戏与促销会员增长排行
            DataSet dsVipAddRankingStats = bllLEvent.GetVipAddRankingStats(para.CTWEventId);

            if (dsVipAddRankingStats != null && dsVipAddRankingStats.Tables.Count > 0)
            {
                if (dsVipAddRankingStats.Tables[0].Rows.Count > 0)
                {
                    rd.GameVipAddRankingList = DataTableToObject.ConvertToList <GameVipAddRankingInfo>(dsVipAddRankingStats.Tables[0]);
                }
                if (dsVipAddRankingStats.Tables[1].Rows.Count > 0)
                {
                    rd.PromotionVipAddRankingList = DataTableToObject.ConvertToList <PromotionVipAddRankingInfo>(dsVipAddRankingStats.Tables[1]);
                }
            }
            return(rd);
        }
Beispiel #9
0
        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);
        }
Beispiel #10
0
        public void PromotionVipAddExport(HttpContext pContext)
        {
            try
            {
                var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

                T_CTW_LEventBLL bllLEvent = new T_CTW_LEventBLL(loggingSessionInfo);
                //获取游戏与促销会员增长排行
                DataSet dsVipAddRankingStats = null;
                if (FormatParamValue(Request("ctweventId")) != null && FormatParamValue(Request("ctweventId")).ToString() != "")
                {
                    dsVipAddRankingStats = bllLEvent.GetVipAddRankingStats(Request("ctweventId").ToString());
                    if (dsVipAddRankingStats != null && dsVipAddRankingStats.Tables.Count > 0)
                    {
                        if (dsVipAddRankingStats.Tables[1].Rows.Count > 0)
                        {
                            string MapUrl            = pContext.Server.MapPath(@"~/Framework/Upload/注册会员增长数排行" + DateTime.Now.ToString("yyyy.MM.dd.HH.mm.ss.ms") + ".xls");
                            Aspose.Cells.License lic = new Aspose.Cells.License();
                            lic.SetLicense("Aspose.Total.lic");
                            Workbook  workbook = new Workbook();
                            Worksheet sheetOne = workbook.Worksheets[0];
                            workbook.Worksheets.Add();
                            Cells sheetOneCells = sheetOne.Cells;//单元格

                            #region excel初始化
                            //为标题设置样式
                            Style styleTitle = workbook.Styles[workbook.Styles.Add()]; //新增样式
                            styleTitle.HorizontalAlignment = TextAlignmentType.Center; //文字居中
                            styleTitle.Font.Name           = "宋体";                     //文字字体
                            styleTitle.Font.Size           = 18;                       //文字大小
                            styleTitle.Font.IsBold         = true;                     //粗体

                            //样式2
                            Style style2 = workbook.Styles[workbook.Styles.Add()]; //新增样式
                            style2.HorizontalAlignment = TextAlignmentType.Center; //文字居中
                            style2.Font.Name           = "宋体";                     //文字字体
                            style2.Font.Size           = 14;                       //文字大小
                            style2.Font.IsBold         = true;                     //粗体
                            style2.IsTextWrapped       = true;                     //单元格内容自动换行
                            style2.Borders[BorderType.LeftBorder].LineStyle   = CellBorderType.Thin;
                            style2.Borders[BorderType.RightBorder].LineStyle  = CellBorderType.Thin;
                            style2.Borders[BorderType.TopBorder].LineStyle    = CellBorderType.Thin;
                            style2.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;

                            //样式3
                            Style style3 = workbook.Styles[workbook.Styles.Add()]; //新增样式
                            style3.HorizontalAlignment = TextAlignmentType.Center; //文字居中
                            style3.Font.Name           = "宋体";                     //文字字体
                            style3.Font.Size           = 12;                       //文字大小
                            style3.Borders[BorderType.LeftBorder].LineStyle   = CellBorderType.Thin;
                            style3.Borders[BorderType.RightBorder].LineStyle  = CellBorderType.Thin;
                            style3.Borders[BorderType.TopBorder].LineStyle    = CellBorderType.Thin;
                            style3.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;
                            #endregion

                            sheetOneCells.Merge(0, 0, 1, 2);           //合并单元格
                            sheetOneCells[0, 0].PutValue("注册会员增长数排行"); //填写内容
                            sheetOneCells[0, 0].SetStyle(styleTitle);
                            sheetOneCells.SetRowHeight(0, 38);
                            //生成行2 列名行
                            for (int i = 0; i < 21; i++)
                            {
                                sheetOneCells.SetColumnWidth(i, 30);
                            }

                            sheetOneCells[1, 0].PutValue("日期");
                            sheetOneCells[1, 0].SetStyle(style2);

                            sheetOneCells[1, 1].PutValue("注册会员数");
                            sheetOneCells[1, 1].SetStyle(style2);
                            for (int i = 0; i < dsVipAddRankingStats.Tables[1].Rows.Count; i++)
                            {
                                sheetOneCells[2 + i, 0].PutValue(dsVipAddRankingStats.Tables[1].Rows[i]["DateStr"]);
                                sheetOneCells[2 + i, 0].SetStyle(style3);

                                sheetOneCells[2 + i, 1].PutValue(dsVipAddRankingStats.Tables[1].Rows[i]["RegVipCount"]);
                                sheetOneCells[2 + i, 1].SetStyle(style3);
                                sheetOneCells.SetRowHeight(2 + i, 24);
                            }
                            workbook.Save(MapUrl);
                            Utils.OutputExcel(pContext, MapUrl);//输出Excel文件
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Beispiel #11
0
        protected override GetSetoffToolsRD ProcessRequest(APIRequest <GetSetoffToolsRP> pRequest)
        {
            SetoffToolsBLL    setOffToolsBLL   = new SetoffToolsBLL(CurrentUserInfo);
            IincentiveRuleBLL incentiveRuleBLL = new IincentiveRuleBLL(CurrentUserInfo);
            var para = pRequest.Parameters;
            var setoffToolsEntity = new SetoffToolsEntity();

            if (para.ToolsType != null)
            {
                setoffToolsEntity.ToolType = para.ToolsType.ToString();
            }
            GetSetoffToolsRD setoffToolsRD = new GetSetoffToolsRD();
            var setoffEventBLL             = new SetoffEventBLL(CurrentUserInfo);
            //获取集客活动信息
            string NoticePlatType = string.Empty;

            if (string.IsNullOrEmpty(para.ApplicationType))
            {
                para.ApplicationType = "0";
            }
            else
            {
                switch (para.ApplicationType)
                {
                case "1":
                    NoticePlatType = "1";
                    break;

                case "2":
                    NoticePlatType = "2";
                    break;

                case "3":
                    NoticePlatType = "2";    //传3需要进行平台类型处理 等于3时获取员工集客行动平台
                    break;

                case "4":
                    NoticePlatType = "3";    //传4需要进行平台类型处理 等于4时获取超级分销商推广行动平台
                    break;
                }
            }
            var setOffEventInfo = setoffEventBLL.QueryByEntity(new SetoffEventEntity()
            {
                Status = "10", IsDelete = 0, SetoffType = Convert.ToInt32(NoticePlatType), CustomerId = CurrentUserInfo.CurrentUser.customer_id
            }, null);
            int     SetoffToolsTotalCount = 0;
            DataSet SetoffToolsList       = null;

            if (setOffEventInfo.Length != 0)
            {
                //获取集客活动工具数量
                SetoffToolsTotalCount = setOffToolsBLL.GeSetoffToolsListCount(setoffToolsEntity, para.ApplicationType, para.BeShareVipID, setOffEventInfo[0].SetoffEventID.ToString());
                //获取集客活动工具列表
                SetoffToolsList = setOffToolsBLL.GetSetoffToolsList(setoffToolsEntity, para.ApplicationType, para.BeShareVipID, para.PageIndex, para.PageSize, setOffEventInfo[0].SetoffEventID.ToString());
            }

            //获取集客奖励信息
            var IncentiveRule = incentiveRuleBLL.GetIncentiveRule(para.ApplicationType);

            setoffToolsRD.TotalCount = SetoffToolsTotalCount;
            int remainder = 0;

            if (para.PageSize == 0)
            {
                para.PageSize = 10;
            }
            setoffToolsRD.TotalPageCount = Math.DivRem(SetoffToolsTotalCount, para.PageSize, out remainder);
            if (remainder > 0)
            {
                setoffToolsRD.TotalPageCount++;
            }
            string strHost = ConfigurationManager.AppSettings["website_url"].Trim();

            if (SetoffToolsList != null && SetoffToolsList.Tables[0].Rows.Count > 0)
            {
                //为优惠券和海报添加图片路径
                SetoffToolsList.Tables[0].Columns.Add("ImageUrl", typeof(string));
                var CustomerBasicSettingBLL = new CustomerBasicSettingBLL(CurrentUserInfo);
                var CustomerBasicInfo       = CustomerBasicSettingBLL.QueryByEntity(new CustomerBasicSettingEntity()
                {
                    CustomerID = CurrentUserInfo.CurrentUser.customer_id, SettingCode = "SetoffPosterWeChatDefaultPhoto"
                }, null).FirstOrDefault();
                var    setOffPosterBLL  = new SetoffPosterBLL(CurrentUserInfo);
                var    ObjectImagesBLL  = new ObjectImagesBLL(CurrentUserInfo);
                var    T_CTW_LEventBLL  = new T_CTW_LEventBLL(CurrentUserInfo);
                var    wMaterialTextBLL = new WMaterialTextBLL(CurrentUserInfo);
                string SourceId         = string.Empty;
                if (!string.IsNullOrEmpty(para.ApplicationType))
                {
                    switch (para.ApplicationType)
                    {
                    case "1":
                        SourceId = "3";    //会员集客
                        break;

                    case "2":
                        SourceId = "1";    //APP会员服务;
                        break;

                    case "3":
                        SourceId = "3";    //APP会员服务;
                        break;

                    case "4":
                        SourceId = "4";    //超级分销商;
                        break;
                    }
                }
                string goUrl       = string.Empty;
                string goCouponUrl = strHost + "/HtmlApps/html/common/GatheringClient/Coupon.html?customerId=";                           //拼优惠券详细页面
                string goPosterUrl = strHost + "/HtmlApps/html/common/GatheringClient/poster.html?customerId=";                           //拼海报详细页面
                string strOAuthUrl = strHost + "/WXOAuth/AuthUniversal.aspx?scope=snsapi_userinfo&SourceId=" + SourceId + "&customerId="; //拼OAuth认证
                foreach (DataRow dr in SetoffToolsList.Tables[0].Rows)
                {
                    if (dr["ToolType"].ToString() == "Coupon")
                    {
                        if (CustomerBasicInfo != null)
                        {
                            dr["ImageUrl"] = CustomerBasicInfo.SettingValue;
                        }
                        if (para.ApplicationType == "4")
                        {
                            goUrl     = goCouponUrl + CurrentUserInfo.CurrentUser.customer_id + "&pushType=IsSuperRetail&ShareVipId=" + CurrentUserInfo.UserID + "&couponId=" + dr["ObjectId"] + "&version=";
                            dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&objectType=Coupon&ObjectID=" + dr["ObjectId"] + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                        }
                        else
                        {
                            //Oauth认证加商品详情页
                            goUrl     = goCouponUrl + CurrentUserInfo.CurrentUser.customer_id + "&ShareVipId=" + CurrentUserInfo.UserID + "&couponId=" + dr["ObjectId"] + "&version=";
                            dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                        }
                    }
                    if (dr["ToolType"].ToString() == "SetoffPoster")
                    {
                        var setOffPosterInfo = setOffPosterBLL.QueryByEntity(new SetoffPosterEntity()
                        {
                            SetoffPosterID = new Guid(dr["ObjectId"].ToString())
                        }, null).FirstOrDefault();
                        if (setOffPosterInfo != null)
                        {
                            var ObjectImgsInfo = ObjectImagesBLL.QueryByEntity(new ObjectImagesEntity()
                            {
                                ImageId = setOffPosterInfo.ImageId
                            }, null).FirstOrDefault();
                            if (ObjectImgsInfo != null)
                            {
                                dr["ImageUrl"] = ObjectImgsInfo.ImageURL;
                            }
                        }
                        if (para.ApplicationType == "4")
                        {
                            goUrl     = goPosterUrl + CurrentUserInfo.CurrentUser.customer_id + "&pushType=IsSuperRetail&ShareVipId=" + CurrentUserInfo.UserID + "&ObjectId=" + dr["ObjectId"] + "&version=";
                            dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&objectType=SetoffPoster&ObjectID=" + dr["ObjectId"] + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                        }
                        else
                        {
                            //Oauth认证加海报详情页
                            goUrl     = goPosterUrl + CurrentUserInfo.CurrentUser.customer_id + "&ShareVipId=" + CurrentUserInfo.UserID + "&ObjectId=" + dr["ObjectId"] + "&version=";
                            dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                        }
                    }
                    if (dr["ToolType"].ToString() == "CTW")
                    {
                        var T_CTW_LEventInfo = T_CTW_LEventBLL.QueryByEntity(new T_CTW_LEventEntity()
                        {
                            CTWEventId = new Guid(dr["ObjectId"].ToString())
                        }, null).FirstOrDefault();
                        if (T_CTW_LEventInfo != null)
                        {
                            dr["ImageUrl"] = T_CTW_LEventInfo.ImageURL;
                        }
                        if (para.ApplicationType == "4")
                        {
                            goUrl     = dr["URL"].ToString() + "&pushType=IsSuperRetail&ShareVipId=" + CurrentUserInfo.UserID + "&ObjectId=" + dr["ObjectId"] + "&version=";
                            dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&objectType=CTW&ObjectID=" + dr["ObjectId"] + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                        }
                        else
                        {
                            goUrl     = dr["URL"].ToString() + "&ShareVipId=" + CurrentUserInfo.UserID + "&ObjectId=" + dr["ObjectId"] + "&version=";
                            dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                        }
                    }
                    if (dr["ToolType"].ToString() == "Material")//如果是图文素材
                    {
                        var wMaterialTextInfo = wMaterialTextBLL.QueryByEntity(new WMaterialTextEntity()
                        {
                            TextId = dr["ObjectId"].ToString()
                        }, null).FirstOrDefault();
                        if (wMaterialTextInfo != null)
                        {
                            dr["ImageUrl"] = wMaterialTextInfo.CoverImageUrl;
                        }
                        goUrl     = dr["URL"].ToString();
                        dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&objectType=Material&ObjectID=" + dr["ObjectId"] + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                    }
                }
                setoffToolsRD.SetOffToolsList = DataTableToObject.ConvertToList <SetOffToolsInfo>(SetoffToolsList.Tables[0]);
            }
            if (IncentiveRule != null && IncentiveRule.Tables[0].Rows.Count > 0)
            {
                setoffToolsRD.SetoffRegAwardType = Convert.ToInt32(IncentiveRule.Tables[0].Rows[0]["SetoffRegAwardType"].ToString()); //激励类型
                setoffToolsRD.SetoffRegPrize     = IncentiveRule.Tables[0].Rows[0]["SetoffRegPrize"].ToString();                      //激励值
                setoffToolsRD.SetoffOrderPer     = Convert.ToDecimal(IncentiveRule.Tables[0].Rows[0]["SetoffOrderPer"].ToString());   //订单成交提成比例
            }
            return(setoffToolsRD);
        }
Beispiel #12
0
        protected override TemplateDetailRD ProcessRequest(APIRequest <TemplateDetailRP> pRequest)
        {
            var rd = new TemplateDetailRD();

            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            CTW_LEventThemeBLL        bllTheme         = new CTW_LEventThemeBLL(loggingSessionInfo);
            CTW_LEventInteractionBLL  bllInteraction   = new CTW_LEventInteractionBLL(loggingSessionInfo);
            CTW_SpreadSettingBLL      bllSpreadSetting = new CTW_SpreadSettingBLL(loggingSessionInfo);
            T_CTW_LEventsBLL          bllEvents        = new T_CTW_LEventsBLL(loggingSessionInfo);
            T_CTW_PanicbuyingEventBLL bllPanicbuying   = new T_CTW_PanicbuyingEventBLL(loggingSessionInfo);
            //更新模板点击数量
            T_CTW_LEventTemplateBLL bllTemplate = new T_CTW_LEventTemplateBLL(loggingSessionInfo);

            try
            {
                bllTemplate.UpdateTemplateInfo(para.TemplateId, 2);
            }
            catch { }
            ///获取模版信息
            DataSet dsInteraction = bllInteraction.GetEventInteractionByTemplateId(para.TemplateId);

            if (dsInteraction != null && dsInteraction.Tables[0].Rows.Count > 0)
            {
                var entityInteraction = DataTableToObject.ConvertToList <EventInteractionInfo>(dsInteraction.Tables[0]);

                var entityTheme = DataTableToObject.ConvertToList <CTW_LEventThemeEntity>(bllTheme.GetThemeInfo(para.TemplateId).Tables[0]);//.QueryByEntity(new CTW_LEventThemeEntity() { TemplateId = new Guid(para.TemplateId), IsDelete = 0 }, null);
                List <CTW_LEventThemeEntity> listTheme = new List <CTW_LEventThemeEntity>();
                foreach (var theme in entityTheme)
                {
                    List <EventInteractionInfo> listEventInteractionInfo = new List <EventInteractionInfo>();

                    ///互动信息
                    foreach (var itemAction in entityInteraction.Where(a => a.ThemeId == theme.ThemeId.ToString() && a.TemplateId == theme.TemplateId.ToString()))
                    {
                        listEventInteractionInfo.Add(itemAction);
                        if (itemAction.InteractionType == 1)
                        {
                            itemAction.GameEventImageList = DataTableToObject.ConvertToList <GameEventImageInfo>(bllEvents.GetImageList(itemAction.LeventId).Tables[0]);
                        }
                        if (itemAction.InteractionType == 2)//促销
                        {
                            itemAction.PanicbuyingEventImage = DataTableToObject.ConvertToObject <PanicbuyingEventImageInfo>(bllPanicbuying.GetPanicbuyingEventImage(itemAction.LeventId).Tables[0].Rows[0]);
                        }
                        theme.EventInteractionList = listEventInteractionInfo;
                    }
                    ;
                    listTheme.Add(theme);
                    rd.TemplateThemeList = listTheme;
                }
                rd.ActivityGroupId = entityTheme.FirstOrDefault().ActivityGroupId;
                rd.TemplateId      = entityTheme.FirstOrDefault().TemplateId.ToString();
                rd.TemplateName    = entityTheme.FirstOrDefault().TemplateName;
                rd.ImageURL        = dsInteraction.Tables[0].Rows[0]["ImageURL"].ToString();
                //推广设置
                DataSet dsSpresd = bllSpreadSetting.GetSpreadSettingInfoByTemplateId(para.TemplateId);
                if (dsSpresd != null && dsSpresd.Tables[0].Rows.Count > 0)
                {
                    rd.TemplateSpreadSettingList = DataTableToObject.ConvertToList <CTW_SpreadSettingEntity>(dsSpresd.Tables[0]);
                }

                ///获取商户所有信息
                if (!string.IsNullOrEmpty(para.CTWEventId))
                {
                    T_CTW_LEventBLL bllCTWEvent = new T_CTW_LEventBLL(loggingSessionInfo);
                    DataSet         dsCTWEvent  = bllCTWEvent.GetLeventInfoByCTWEventId(para.CTWEventId);
                    ObjectImagesBLL bllImage    = new ObjectImagesBLL(loggingSessionInfo);
                    var             bllPrizes   = new LPrizesBLL(loggingSessionInfo);

                    T_CTW_SpreadSettingBLL bllCustomerSpreadSetting = new T_CTW_SpreadSettingBLL(loggingSessionInfo);
                    if (dsCTWEvent != null && dsCTWEvent.Tables.Count > 0 && dsCTWEvent.Tables[0].Rows.Count > 0)
                    {
                        rd.CustomerCTWEventInfo = DataTableToObject.ConvertToObject <CustomerCTWEventInfo>(dsCTWEvent.Tables[0].Rows[0]);
                        //游戏活动信息
                        if (dsCTWEvent.Tables[0].Rows[0]["InteractionType"].ToString() == "1")
                        {
                            LEventsBLL bllLevents = new LEventsBLL(loggingSessionInfo);
                            string     strEventId = dsCTWEvent.Tables[0].Rows[0]["LeventId"].ToString();
                            var        ds         = bllLevents.GetNewEventInfo(strEventId);
                            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                            {
                                rd.CustomerCTWEventInfo.EventInfo = DataTableToObject.ConvertToObject <LEventsInfo>(ds.Tables[0].Rows[0]);//直接根据所需要的字段反序列化
                            }
                            DataSet dsPrizes = bllPrizes.GetPirzeList(strEventId);
                            if (dsPrizes.Tables != null && dsPrizes.Tables.Count > 0 && dsPrizes.Tables[0] != null && dsPrizes.Tables[0].Rows.Count > 0)
                            {
                                rd.CustomerCTWEventInfo.EventInfo.PrizeList = DataTableToObject.ConvertToList <Prize>(dsPrizes.Tables[0]);
                            }


                            rd.CustomerCTWEventInfo.EventInfo.ImageList = bllImage.QueryByEntity(new ObjectImagesEntity()
                            {
                                ObjectId = strEventId, IsDelete = 0
                            }, null).ToList();
                        }
                        //促销活动信息
                        if (dsCTWEvent.Tables[0].Rows[0]["InteractionType"].ToString() == "2")
                        {
                            T_CTW_PanicbuyingEventKVBLL bllPanicbuyingEventKV = new T_CTW_PanicbuyingEventKVBLL(loggingSessionInfo);
                            rd.CustomerCTWEventInfo.PanicbuyingEventInfo = DataTableToObject.ConvertToObject <T_CTW_PanicbuyingEventKVEntity>(bllPanicbuyingEventKV.GetPanicbuyingEventKV(para.CTWEventId).Tables[0].Rows[0]);
                            T_CTW_LEventInteractionBLL bllEventInteraction = new T_CTW_LEventInteractionBLL(loggingSessionInfo);
                            DataSet dsP = bllEventInteraction.GetPanicbuyingEventId(para.CTWEventId);
                            if (dsP != null && dsP.Tables.Count > 0 && dsP.Tables[0].Rows.Count > 0)
                            {
                                rd.CustomerCTWEventInfo.PanicbuyingEventInfo.PanicbuyingEventList = DataTableToObject.ConvertToList <PanicbuyingEventId>(dsP.Tables[0]);
                            }
                        }

                        //图文信息
                        var ds2 = bllCTWEvent.GetMaterialTextInfo(dsCTWEvent.Tables[0].Rows[0]["OnlineQRCodeId"].ToString());//活动图文素材对应的keyword其实是这个活动的标识,也就是生成二维码的关键字
                        if (ds2 != null && ds2.Tables.Count > 0 && ds2.Tables[0].Rows.Count > 0)
                        {
                            rd.CustomerCTWEventInfo.MaterialText = DataTableToObject.ConvertToObject <WMaterialTextEntity>(ds2.Tables[0].Rows[0]);//直接根据所需要的字段反序列化
                            rd.CustomerCTWEventInfo.MappingId    = ds2.Tables[0].Rows[0]["MappingId"].ToString();
                        }
                        //推广设置

                        DataSet dsCustomerSpread = bllCustomerSpreadSetting.GetSpreadSettingByCTWEventId(para.CTWEventId);
                        if (dsCustomerSpread != null && dsCustomerSpread.Tables[0].Rows.Count > 0)
                        {
                            rd.CustomerCTWEventInfo.SpreadSettingList = DataTableToObject.ConvertToList <T_CTW_SpreadSettingEntity>(dsCustomerSpread.Tables[0]);
                        }
                        //触点
                        ContactEventBLL bllContactEvent = new ContactEventBLL(loggingSessionInfo);
                        DataSet         dsContact       = bllContactEvent.GetContactEventByCTWEventId(para.CTWEventId);
                        if (dsContact != null && dsContact.Tables[0].Rows.Count > 0)
                        {
                            List <ContactEventInfo> ContactInfoList = new List <ContactEventInfo>();
                            ContactEventInfo        ContactInfo     = new ContactEventInfo();
                            foreach (DataRow dr in dsContact.Tables[0].Rows)
                            {
                                ContactInfo = new ContactEventInfo();
                                ContactInfo.ContactTypeCode = dr["ContactTypeCode"].ToString();
                                DataSet dsPrizes = bllPrizes.GetPirzeListForCTW(dr["ContactEventId"].ToString());
                                if (dsPrizes.Tables != null && dsPrizes.Tables.Count > 0 && dsPrizes.Tables[0] != null && dsPrizes.Tables[0].Rows.Count > 0)
                                {
                                    ContactInfo.ContactPrizeList = DataTableToObject.ConvertToList <Prize>(dsPrizes.Tables[0]);
                                }
                                ContactInfoList.Add(ContactInfo);
                            }
                            rd.CustomerCTWEventInfo.ContactEventList = ContactInfoList;
                        }
                    }


                    rd.CTWEventId = para.CTWEventId;
                }
                else
                {
                    rd.CTWEventId = Guid.NewGuid().ToString();
                }
            }
            return(rd);
        }