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

            if (quesAnswerList == null || quesAnswerList.Count == 0)
            {
                return(new GetResponseParams <bool>
                {
                    Flag = "0",
                    Code = "419",
                    Description = "活动回答问题集合为空",
                });
            }
            #endregion

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



                if (quesAnswerList != null)
                {
                    //Loggers.Debug(new DebugLogInfo()
                    //{
                    //    Message = string.Format(
                    //        "submitEventApply--WEventSubmitEventApply:{0}", "true")
                    //});
                    string createBy = System.Guid.NewGuid().ToString().Replace("-", "");
                    foreach (var quesAnswerItem in quesAnswerList)
                    {
                        //Loggers.Debug(new DebugLogInfo()
                        //{
                        //    Message = string.Format(
                        //        "submitEventApply--WEventSubmitEventApply:{0}", "循坏" + quesAnswerItem.QuestionValue)
                        //});
                        quesAnswerBLL.SubmitQuesQuestionAnswerWEvent(openID, EventID, UserName,
                                                                     quesAnswerItem.QuestionID, quesAnswerItem.QuestionValue, createBy);
                    }
                }
                //else {
                //    Loggers.Debug(new DebugLogInfo()
                //    {
                //        Message = string.Format(
                //            "submitEventApply--WEventSubmitEventApply:{0}", "false")
                //    });
                //}

                response.Params = true;
                return(response);
            }
            catch (Exception ex)
            {
                response.Flag        = "0";
                response.Code        = "103";
                response.Description = "错误:" + ex.ToString();
                return(response);
            }
        }