Esempio n. 1
0
        /// <summary>
        /// 检查用户是否已提交问卷
        /// </summary>
        /// <param name="pageId"></param>
        /// <returns></returns>
        public static async Task <bool> CheckIsAnswered(Guid pageId)
        {
            bool result   = false;//未提交问卷
            var  userInfo = await DalUserQuestionnaireURL.GetUserQuestionnaireURLInfo(pageId);

            if (userInfo != null)
            {
                var questionnaireInfo = await DalQuestionnaire.GetQuestionnaireInfoByNo(userInfo.QuestionnaireNo);

                if (questionnaireInfo != null)
                {
                    QuestionnaireAnswerRecordModel answerRecordInfo = null;
                    if (questionnaireInfo.QuestionnaireType == 1)       //售后问卷
                    {
                        answerRecordInfo = await DalQuestionnaireAnswerRecord.GetQuestionnaireAnswerRecordInfo(userInfo.UserID, userInfo.ComplaintsID);
                    }
                    else if (questionnaireInfo.QuestionnaireType == 2)  //售前问卷
                    {
                        answerRecordInfo = await DalQuestionnaireAnswerRecord.GetQuestionnaireAnswerRecordInfo(userInfo.UserID, userInfo.OrderID);
                    }
                    if (answerRecordInfo != null)
                    {
                        result = true;//已提交问卷
                    }
                }
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 删除重复问卷答题记录和获取问卷记录
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="objectId"></param>
        /// <returns></returns>
        public static async Task DelExistRecord(Guid userId, int objectId, int questionnaireType)
        {
            //判断当前用户和投诉是否已答
            var answerRecordInfo = await DalQuestionnaireAnswerRecord.GetQuestionnaireAnswerRecordInfo(userId, objectId);

            if (answerRecordInfo != null)
            {
                //删除之前答题记录
                await DalQuestionnaireAnswerRecord.DeleteQuestionnaireAnswerRecord(userId, objectId);
            }

            UserQuestionnaireURLModel userInfo = null;

            if (questionnaireType < 2)//售后问卷
            {
                userInfo = await DalUserQuestionnaireURL.GetUserQuestionnaireURLInfo(objectId);
            }
            else if (questionnaireType == 2)//售前问卷
            {
                userInfo = await DalUserQuestionnaireURL.GetUserQuestionnaireURLInfoByOrderID(objectId);
            }
            if (userInfo != null)
            {
                //删除之前问卷记录
                await DalUserQuestionnaireURL.DeleteUserQuestionnaireURL(userInfo.PageID);
            }
        }