示例#1
0
        /// <summary>
        /// 活动报名表数据提交
        /// </summary>
        public GetResponseParams <bool> WEventSubmitEventApply(string EventID, string UserID,
                                                               WEventUserMappingEntity userMappingEntity, IList <QuesAnswerEntity> quesAnswerList)
        {
            #region 判断对象不能为空
            if (EventID == null || EventID.ToString().Equals(""))
            {
                return(new GetResponseParams <bool>
                {
                    Flag = "0",
                    Code = "419",
                    Description = "活动标识为空",
                });
            }
            #endregion

            GetResponseParams <bool> response = new GetResponseParams <bool>();
            response.Flag        = "1";
            response.Code        = "200";
            response.Description = "成功";
            try
            {
                var quesAnswerBLL = new QuesAnswerBLL(CurrentUserInfo);

                // WEventUserMapping
                var wEventUserMappingBLL = new WEventUserMappingBLL(CurrentUserInfo);
                //if (!wEventUserMappingBLL.ExsitWEventUserMapping(userMappingEntity))
                //{
                userMappingEntity.Mapping = Common.Utils.NewGuid();
                userMappingEntity.EventID = EventID;
                userMappingEntity.UserID  = UserID;
                wEventUserMappingBLL.Create(userMappingEntity);
                //}

                // QuesAnswer
                if (quesAnswerList != null)
                {
                    //根据活动删除所有已有答案
                    bool   bRetun   = quesAnswerBLL.DeleteQuesAnswerByEventID(EventID, UserID);
                    string createBy = BaseService.NewGuidPub();
                    foreach (var quesAnswerItem in quesAnswerList)
                    {
                        quesAnswerBLL.SubmitQuesQuestionAnswerWEvent(userMappingEntity.UserID,
                                                                     quesAnswerItem.QuestionID, quesAnswerItem.QuestionValue, createBy);
                    }
                }
                //int iBool = _currentDAO.SetEventApplyCount(EventID, UserID);
                response.Params = true;
                return(response);
            }
            catch (Exception ex)
            {
                response.Flag        = "0";
                response.Code        = "103";
                response.Description = "失败";//+ ":" + ex.ToString();
                return(response);
            }
        }
示例#2
0
        public bool SetEventWXPush(LEventsEntity eventInfo, string WeiXin, string OpenId, string VipId, string msgUrl, out string strError, string AuthUrl, int iRad)
        {
            try
            {
                MarketSendLogBLL logServer = new MarketSendLogBLL(this.CurrentUserInfo);
                Random           rad       = new Random();
                if (eventInfo == null || eventInfo.ModelId == null || eventInfo.ModelId.Equals(""))
                {
                    strError = "获取信息不全,缺少模板。";
                    return(false);
                }
                #region
                WEventUserMappingBLL eventUserMapping = new WEventUserMappingBLL(CurrentUserInfo);
                int eventPersonCount = 0;
                eventPersonCount = eventUserMapping.GetEventSignInCount(eventInfo.EventID);


                #endregion
                WApplicationInterfaceBLL wAServer = new WApplicationInterfaceBLL(this.CurrentUserInfo);
                var wxArray = wAServer.QueryByEntity(new WApplicationInterfaceEntity
                {
                    WeiXinID = WeiXin
                    ,
                    IsDelete = 0
                    ,
                    CustomerId = this.CurrentUserInfo.CurrentUser.customer_id
                }, null);
                if (wxArray == null || wxArray.Length == 0 || wxArray[0].AppID == null || wxArray[0].AppID.Equals(""))
                {
                    strError = "不存在对应的微信帐号";
                    return(false);
                }
                else
                {
                    WApplicationInterfaceEntity wxInfo = wxArray[0];
                    WX.CommonBLL server = new WX.CommonBLL();
                    JIT.CPOS.BS.Entity.WX.SendMessageEntity sendMessageInfo = new Entity.WX.SendMessageEntity();

                    WMaterialTextBLL            wTextServer = new WMaterialTextBLL(this.CurrentUserInfo);
                    IList <WMaterialTextEntity> textlist    = new List <WMaterialTextEntity>();
                    textlist = wTextServer.GetMaterialTextListByModelId(eventInfo.ModelId);

                    if (textlist != null && textlist.Count > 0 && textlist[0].TextId != null)
                    {
                        #region
                        VipBLL    vipServer = new VipBLL(CurrentUserInfo);
                        VipEntity vipInfo   = vipServer.GetByID(VipId);
                        sendMessageInfo.msgtype = "news";
                        sendMessageInfo.touser  = OpenId;
                        List <JIT.CPOS.BS.Entity.WX.NewsEntity> newsList = new List <JIT.CPOS.BS.Entity.WX.NewsEntity>();
                        foreach (var info in textlist)
                        {
                            JIT.CPOS.BS.Entity.WX.NewsEntity newsInfo = new Entity.WX.NewsEntity();
                            newsInfo.title = info.Title;
                            if (vipInfo != null && !vipInfo.VIPID.Equals(""))
                            {
                                newsInfo.description = info.Author.Replace("#VIPNAME#", vipInfo.VipName);
                            }
                            else
                            {
                                newsInfo.description = info.Author;
                            }

                            newsInfo.description = newsInfo.description.Replace("#PERSONCOUNT#", Convert.ToString(eventPersonCount));
                            //string url = info.OriginalUrl;
                            //JIT.Utility.Log.Loggers.Debug(new DebugLogInfo()
                            //{
                            //    Message = string.Format("处理原文链接出错:{0},url:{1};Status:{2};",)
                            //});
                            if (info.OriginalUrl != null && !info.OriginalUrl.Equals("") && vipInfo.Status != null && !vipInfo.Status.ToString().Equals(""))
                            {
                                if (vipInfo.Status.Equals(1) && info.OriginalUrl.IndexOf("Fuxing") > 0)
                                {
                                    newsInfo.description = info.Text;
                                }
                                else
                                {
                                }
                            }

                            if (info.OriginalUrl.IndexOf("?") > 0)
                            {
                                newsInfo.url = info.OriginalUrl + "&rnd=" + rad.Next(1000, 100000) + "";
                            }
                            else
                            {
                                string goUrl = info.OriginalUrl + "?1=1&applicationId=" + wxInfo.ApplicationId + "&eventId=" + eventInfo.EventID + "&openId=" + OpenId + "&userId=" + VipId + "";
                                goUrl = HttpUtility.UrlEncode(goUrl);

                                newsInfo.url = AuthUrl + "OnlineClothing/go.htm?customerId=" + this.CurrentUserInfo.CurrentUser.customer_id
                                               + "&applicationId=" + wxInfo.ApplicationId
                                               + "&openId=" + OpenId
                                               + "&userId=" + VipId
                                               + "&backUrl=" + goUrl + "";
                            }
                            //OnlineClothing/go.htm?customerId=" + customerId + "&openId=" + OpenId + "&userId=" + vipId + "&backUrl=" + HttpUtility.UrlEncode(goUrl) + "";
                            newsInfo.picurl = info.CoverImageUrl;
                            newsList.Add(newsInfo);
                        }
                        sendMessageInfo.articles = newsList;
                        #endregion
                        #region 发送日志

                        MarketSendLogEntity logInfo1 = new MarketSendLogEntity();
                        logInfo1.LogId         = BaseService.NewGuidPub();
                        logInfo1.IsSuccess     = 1;
                        logInfo1.MarketEventId = eventInfo.EventID;
                        logInfo1.SendTypeId    = "2";
                        logInfo1.Phone         = iRad.ToString();
                        if (sendMessageInfo.ToJSON().ToString().Length > 2000)
                        {
                            logInfo1.TemplateContent = sendMessageInfo.ToJSON().ToString().Substring(1, 1999);
                        }
                        else
                        {
                            logInfo1.TemplateContent = sendMessageInfo.ToJSON().ToString();
                        }
                        logInfo1.VipId        = VipId;
                        logInfo1.WeiXinUserId = OpenId;
                        logInfo1.CreateTime   = System.DateTime.Now;
                        logServer.Create(logInfo1);
                        #endregion
                    }

                    var ResultEntity = server.SendMessage(sendMessageInfo, wxInfo.AppID, wxInfo.AppSecret, this.CurrentUserInfo, true);


                    #region Jermyn20140110 处理复星年会的座位信息,是临时的
                    //FStaffBLL staffServer = new FStaffBLL(this.CurrentUserInfo);
                    //bool bReturn = staffServer.SetStaffSeatsPush(VipId, eventInfo.EventID, out strError);
                    //MarketSendLogEntity logInfo2 = new MarketSendLogEntity();
                    //logInfo2.LogId = BaseService.NewGuidPub();
                    //logInfo2.IsSuccess = 1;
                    //logInfo2.MarketEventId = eventInfo.EventID;
                    //logInfo2.SendTypeId = "2";
                    //logInfo2.TemplateContent = strError;
                    //logInfo2.Phone = iRad.ToString();
                    //logInfo2.VipId = VipId;
                    //logInfo2.WeiXinUserId = OpenId;
                    //logInfo2.CreateTime = System.DateTime.Now;
                    //logServer.Create(logInfo2);

                    #endregion
                    strError = "ok";
                    return(true);
                }
            }
            catch (Exception ex) {
                strError = ex.ToString();
                return(false);
            }
        }
示例#3
0
        /// <summary>
        /// 发送微信消息
        /// </summary>
        /// <param name="VipId">用户标识</param>
        /// <param name="EventId">活动标识</param>
        /// <param name="strError">错误提示</param>
        /// <returns></returns>
        public bool SetEventVipSeatPush(string VipId, string EventId, out string strError)
        {
            strError = "成功.";
            #region //1.判断用户是否关注过活动
            WEventUserMappingBLL eventServer = new WEventUserMappingBLL(this.CurrentUserInfo);
            var eventList = eventServer.QueryByEntity(new WEventUserMappingEntity
            {
                UserID = VipId
                ,
                IsDelete = 0
                ,
                EventID = EventId
            }, null);
            if (eventList == null || eventList.Length == 0)
            {
                #region
                WEventUserMappingEntity eventUserMappingInfo = new WEventUserMappingEntity();
                eventUserMappingInfo.Mapping = Common.Utils.NewGuid();
                eventUserMappingInfo.EventID = EventId;
                eventUserMappingInfo.UserID  = VipId;
                eventServer.Create(eventUserMappingInfo);
                #endregion
            }
            #endregion

            #region //2.判断用户是否注册
            VipBLL    vipServer = new VipBLL(this.CurrentUserInfo);
            VipEntity vipInfo   = new VipEntity();
            vipInfo = vipServer.GetByID(VipId);
            if (vipInfo == null || vipInfo.VIPID.Equals(""))
            {
                strError = "用户不存在";
                return(false);
            }
            #endregion
            else
            {
                #region
                EventVipEntity eventVipInfo = new EventVipEntity();
                var            eventVipList = _currentDAO.QueryByEntity(new EventVipEntity
                {
                    Phone = vipInfo.Phone
                    ,
                    IsDelete = 0
                }, null);
                if (eventVipList == null || eventVipList.Length == 0)
                {
                    strError = "没有合适的员工.";
                    return(false);
                }
                else
                {
                    eventVipInfo = eventVipList[0];
                }
                #endregion

                LEventsEntity lEventsEntity = new LEventsEntity();
                lEventsEntity = new LEventsBLL(this.CurrentUserInfo).GetByID(EventId);

                //string message = "尊贵的" + eventVipInfo.VipName + "先生/女士:\r\n 诚挚地欢迎您参加复星集团2014年全球工作会议,本次会议将于8:30正式开始。请您至5楼静安大宴会厅" + eventVipInfo.Seat + "区域就坐,或参见胸卡背面提示.";

                string message = new WMaterialWritingBLL(this.CurrentUserInfo).GetWMaterialWritingByModelId(EventId).Content;
                message = ReplaceTemplate(message, eventVipList[0], vipInfo, lEventsEntity);

                //组织消息
                string code = JIT.CPOS.BS.BLL.WX.CommonBLL.SendWeixinMessage(message, VipId, this.CurrentUserInfo, vipInfo);
                switch (code)
                {
                case "103":
                    strError = "未查询到匹配的公众账号信息";
                    break;

                case "203":
                    strError = "发送失败";
                    break;

                default:
                    break;
                }
            }
            return(true);
        }