Exemplo n.º 1
0
        void UpdateContent(QuestionTypeEnum questionTypeEnum)
        {
            // 设置图片
            SpriteAtlas spriteAtlas = Resources.Load <SpriteAtlas>("SpriteAtlas/QuestionAtlas");

            if (questionTypeEnum == QuestionTypeEnum.CrossCard)
            {
                _image.sprite = spriteAtlas.GetSprite("help-crosscard");
            }
            else if (questionTypeEnum == QuestionTypeEnum.SliceCard)
            {
                _image.sprite = spriteAtlas.GetSprite("help-slicecard-3");
            }
            else if (questionTypeEnum == QuestionTypeEnum.SliceCardFour)
            {
                _image.sprite = spriteAtlas.GetSprite("help-slicecard-4");
            }
            else if (questionTypeEnum == QuestionTypeEnum.SingleCard)
            {
                _image.sprite = spriteAtlas.GetSprite("help-singlecard");
            }
            else if (questionTypeEnum == QuestionTypeEnum.SearchPanel)
            {
                _image.sprite = spriteAtlas.GetSprite("help-search");
            }
            else if (questionTypeEnum == QuestionTypeEnum.SearchResultPanel)
            {
                _image.sprite = spriteAtlas.GetSprite("help-searchresult");
            }
            else if (questionTypeEnum == QuestionTypeEnum.ScalePanel)
            {
                _image.sprite = spriteAtlas.GetSprite("help-scale");
            }
        }
        public AnswerOptionType GetAnswerOptionType(QuestionTypeEnum questionType)
        {
            switch (questionType)
            {
            case QuestionTypeEnum.SingleChoiceVoting:
            case QuestionTypeEnum.MultipleChoiceVoting:
            case QuestionTypeEnum.SingleChoiceClick:
            case QuestionTypeEnum.MultipleChoiceClick:
                return(AnswerOptionType.ShowGeneralAnswerOptions);

            case QuestionTypeEnum.SurveyClick:
                return(AnswerOptionType.ShowSurveyAnswerOptions);

            case QuestionTypeEnum.FreeTextVoting:
            case QuestionTypeEnum.FreeTextClick:
                return(AnswerOptionType.ShowFreeTextAnswerOptions);

            case QuestionTypeEnum.EvaluationVoting:
            case QuestionTypeEnum.GradsVoting:
                return(AnswerOptionType.ShowGradeOrEvaluationAnswerOptions);

            case QuestionTypeEnum.RangedQuestionClick:
                return(AnswerOptionType.ShowRangedAnswerOption);

            case QuestionTypeEnum.YesNoVoting:
            case QuestionTypeEnum.YesNoClick:
            case QuestionTypeEnum.TrueFalseClick:
                return(AnswerOptionType.ShowTwoAnswerOptions);

            default:
                throw new ArgumentException($"QuestionType not handled in GetAnswerOptionType: '{questionType}'");
            }
        }
Exemplo n.º 3
0
        private ReviewerFromQuestionModel CreateReviewerFromQuestionModel(QuestionTypeEnum type, IQuestion actualQuestion, Test test)
        {
            ReviewerFromQuestionModel reviewer = null;

            switch (type)
            {
            case QuestionTypeEnum.BuiltIn:
                break;

            case QuestionTypeEnum.QandA:
                reviewer = CreateReviewerFromQuestionModelQandA(actualQuestion, test);
                break;

            case QuestionTypeEnum.MultipleChoice:
                reviewer = CreateReviewerFromQuestionModelMultiChoice(actualQuestion, test);
                break;

            case QuestionTypeEnum.MultiChoiceSame:
                reviewer = CreateReviewerFromQuestionModelMultiChoiceSame(actualQuestion, test);
                break;

            default:
                break;
            }

            return(reviewer);
        }
Exemplo n.º 4
0
        // TODO: optimize
        public string GetQuestionString(QuestionTypeEnum type, int id, Test entity)
        {
            string questionStr           = String.Empty;
            IEnumerable <IQuestion> list = null;

            switch (type)
            {
            case QuestionTypeEnum.BuiltIn:
                break;

            case QuestionTypeEnum.QandA:
                list = entity.QandAQuestions;
                break;

            case QuestionTypeEnum.MultipleChoice:
                list = entity.MultiChoiceQuestions;
                break;

            case QuestionTypeEnum.MultiChoiceSame:
                list = entity.MultiChoiceSameQuestions;
                break;

            default:
                break;
            }
            questionStr = GetQuestionString(id, list);
            return(questionStr);
        }
        private string QuestionTypeToClickQuestionType(QuestionTypeEnum questionType)
        {
            switch (questionType)
            {
            case QuestionTypeEnum.SingleChoiceClick:
                return("SingleChoiceQuestion");

            case QuestionTypeEnum.MultipleChoiceClick:
                return("MultipleChoiceQuestion");

            case QuestionTypeEnum.YesNoClick:
                return("YesNoSingleChoiceQuestion");

            case QuestionTypeEnum.TrueFalseClick:
                return("TrueFalseSingleChoiceQuestion");

            case QuestionTypeEnum.RangedQuestionClick:
                return("RangedQuestion");

            case QuestionTypeEnum.FreeTextClick:
                return("FreeTextQuestion");

            case QuestionTypeEnum.SurveyClick:
                return("SurveyQuestion");

            default: return(string.Empty);
            }
        }
        private string QuestionTypeToVotingQuestionType(QuestionTypeEnum questionType)
        {
            switch (questionType)
            {
            case QuestionTypeEnum.SingleChoiceVoting:
                return("sc");

            case QuestionTypeEnum.MultipleChoiceVoting:
                return("mc");

            case QuestionTypeEnum.YesNoVoting:
                return("yesno");

            case QuestionTypeEnum.FreeTextVoting:
                return("freetext");

            case QuestionTypeEnum.EvaluationVoting:
                return("vote");

            case QuestionTypeEnum.GradsVoting:
                return("school");

            default: return(string.Empty);
            }
        }
        public async Task SendWordQuestion(QuestionTypeEnum questionType)
        {
            Random rnd = new Random();

            List <WordModel> questionWordList = wordList.OrderBy(x => Guid.NewGuid()).Take(5).ToList();

            QuestionModel question = new QuestionModel();

            if (questionType == QuestionTypeEnum.WordEnglishToTurkish)
            {
                question.Word = questionWordList[0].English;
                question.Options.Add(questionWordList[0].Turkish);
                question.Options.Add(questionWordList[1].Turkish);
                question.Options.Add(questionWordList[2].Turkish);
                question.Options.Add(questionWordList[3].Turkish);
            }
            else
            {
                question.Word = questionWordList[0].Turkish;
                question.Options.Add(questionWordList[0].English);
                question.Options.Add(questionWordList[1].English);
                question.Options.Add(questionWordList[2].English);
                question.Options.Add(questionWordList[3].English);
            }

            question.Options = question.Options.OrderBy(x => Guid.NewGuid()).ToList();
            int correctOptionId = question.Options.FindIndex(x => x == questionWordList[0].English || x == questionWordList[0].Turkish);


            var result = await _botClient.SendPollAsync(channelId, question.Word, question.Options, correctOptionId : correctOptionId, type : PollType.Quiz);
        }
Exemplo n.º 8
0
        public IQuestionType GetQuestion(QuestionTypeEnum type)
        {
            IQuestionType qType = null;

            switch (type)
            {
            case QuestionTypeEnum.BuiltIn:
                break;

            case QuestionTypeEnum.QandA:
                qType = _svcContainer.QAQuestionSvc;
                break;

            case QuestionTypeEnum.MultipleChoice:
                qType = _svcContainer.MCQuestionSvc;
                break;

            case QuestionTypeEnum.MultiChoiceSame:
                qType = _svcContainer.MultiChoiceSameQuestionSvc;
                break;

            default:
                break;
            }

            return(qType);
        }
 public bool IsSingleChoiceQuestion(QuestionTypeEnum questionType)
 {
     return(questionType == QuestionTypeEnum.SingleChoiceVoting ||
            questionType == QuestionTypeEnum.YesNoVoting ||
            questionType == QuestionTypeEnum.SingleChoiceClick ||
            questionType == QuestionTypeEnum.YesNoClick ||
            questionType == QuestionTypeEnum.TrueFalseClick);
 }
Exemplo n.º 10
0
 public void ShowReminder(QuestionTypeEnum questionTypeEnum)
 {
     UpdateContent(questionTypeEnum);
     if (!gameObject.activeSelf)
     {
         gameObject.SetActive(true);
     }
 }
Exemplo n.º 11
0
        //private Dictionary<QuestionTypeEnum, Func<int, bool, bool>> deleteQuestionMap;

        //private void InitializeDeleteQuestionMap()
        //{
        //    deleteQuestionMap = new Dictionary<QuestionTypeEnum, Func<int, bool, bool>>()
        //    {
        //        {QuestionTypeEnum.QandA, DeleteQandAQuestion},
        //        {QuestionTypeEnum.MultipleChoice, DeleteMultipleChoiceQuestion}
        //    };
        //}

        public bool DeleteQuestion(QuestionTypeEnum type, int id, bool callSaveChanges = true)
        {
            IQuestionType qType = _questionTypeFactory.GetQuestion(type);

            if (qType != null)
            {
                qType.DeleteQuestion(id, callSaveChanges);
            }
            return(false);
        }
Exemplo n.º 12
0
        //private bool DeleteQandAQuestion(int id, bool callSaveChanges = true)
        //{
        //    return _qaQuestionSvc.DeleteQuestion(id, callSaveChanges);
        //}

        //private bool DeleteMultipleChoiceQuestion(int id, bool callSaveChanges = true)
        //{
        //    return _mcQuestionSvc.DeleteQuestion(id, callSaveChanges);
        //}
        #endregion

        #region CreateQuestion
        public QuestionModel CreateQuestion(QuestionTypeEnum type, object model)
        {
            IQuestionType qType = _questionTypeFactory.GetQuestion(type);

            if (qType != null)
            {
                return(qType.CreateQuestion(model));
            }
            return(null);
        }
Exemplo n.º 13
0
 public QuestionInfo(
     Entry entry,
     QuestionTypeEnum questionType,
     AnswerTypeEnum answerType,
     List <string>?possibleAnswers)
 {
     Entry           = entry;
     QuestionType    = questionType;
     AnswerType      = answerType;
     PossibleAnswers = possibleAnswers;
 }
Exemplo n.º 14
0
        public void CompareQuestionInfo_EqualObjects_ReturnsTrue(
            Entry entry,
            QuestionTypeEnum questionType,
            AnswerTypeEnum modeType,
            List <string>?possibleAnswers1,
            List <string>?possibleAnswers2)
        {
            // Arrange
            var questionInfo1 = new QuestionInfo(entry, questionType, modeType, possibleAnswers1);
            var questionInfo2 = new QuestionInfo(entry, questionType, modeType, possibleAnswers2);

            // Act
            bool result = questionInfo1.Equals(questionInfo2);

            // Assert
            Assert.True(result);
        }
Exemplo n.º 15
0
        public static string GetString(QuestionTypeEnum state)
        {
            switch (state)
            {
            case QuestionTypeEnum.Checkbox: return(QuestionnaireRes.QUESTION_TYPE_CHECKBOX);

            case QuestionTypeEnum.CheckboxList: return(QuestionnaireRes.QUESTION_TYPE_CHECKBOX_LIST);

            case QuestionTypeEnum.DropDown: return(QuestionnaireRes.QUESTION_TYPE_DROPDOWN);

            case QuestionTypeEnum.Number: return(QuestionnaireRes.QUESTION_TYPE_NUMBER);

            case QuestionTypeEnum.TextArea: return(QuestionnaireRes.QUESTION_TYPE_TEXTAREA);

            case QuestionTypeEnum.TextBox: return(QuestionnaireRes.QUESTION_TYPE_TEXTBOX);
            }
            return(null);
        }
Exemplo n.º 16
0
        public QuestionModel CreateQuestion(QuestionTypeEnum type, object model)
        {
            try
            {
                var question = _questionTypeSvc.CreateQuestion(type, model);
                if (question != null)
                {
                    question.IsFlashCard = true;
                    var entity = MappingUtil.Map <QuestionModel, Question>(question);
                    entity.AuthorId = _currentUser.Id;
                    _uow.Questions.Add(entity);
                    _uow.SaveChanges();

                    question.Id = entity.Id;
                }
                return(question);
            }
            catch (Exception ex)
            {
                _svcContainer.LoggingSvc.Log(ex);
                return(null);
            }
        }
Exemplo n.º 17
0
        //  初始化组件显示的状态
        protected void InitComponents(List <ExtraCardData> extraCardDatas)
        {
            _extraCardDatas = extraCardDatas;

            if (extraCardDatas != null && extraCardDatas.Count > 0)
            {
                _hasListBtn = true;
            }
            else
            {
                _hasListBtn = false;
            }

            if (_hasListBtn)
            {
                // 显示四组按钮
                _tool_bottom_container.gameObject.SetActive(true);
                _tool_bottom_three_container.gameObject.SetActive(false);
                //InitEnvCard(extraCardDatas);

                _questionTypeEnum = QuestionTypeEnum.SliceCardFour;
            }
            else
            {
                // 显示三个按钮
                _tool_bottom_container?.gameObject.SetActive(false);
                _tool_bottom_three_container?.gameObject.SetActive(true);

                _questionTypeEnum = QuestionTypeEnum.SliceCard;
            }

            //// 不显示移动提示
            //_move_reminder_container.gameObject.SetActive(false);
            //// 关闭移动蒙版
            //_move_mask.gameObject.SetActive(false);
        }
Exemplo n.º 18
0
 /// <summary>
 /// This class is used to get the last question of the given type
 /// </summary>
 /// <param name="questionType">This is the question type</param>
 /// <returns>Returna a question</returns>
 public static Question Get(QuestionTypeEnum questionType)
 {
     return(InMemoryDatabaseSingleton.DatabaseInstance.SelectMany <Question>(
                x => x.QuestionType == questionType && x.IsCreated
                ).OrderByDescending(x => x.CreationDate).First());
 }
Exemplo n.º 19
0
 /// <summary>
 /// This method returns all created quesions of the given type.
 /// </summary>
 /// <param name="questionType">This is the type of the question.</param>
 /// <returns>Questions List.</returns>
 public static List <Question> GetAll(QuestionTypeEnum questionType)
 {
     return(InMemoryDatabaseSingleton.DatabaseInstance.SelectMany <Question>(
                x => x.QuestionType == questionType).OrderByDescending(
                x => x.CreationDate).ToList());
 }
Exemplo n.º 20
0
 public Question(string _QuestionId, QuestionTypeEnum _ItemType)
 {
     QuestionId = _QuestionId;
     ItemType   = _ItemType;
 }
Exemplo n.º 21
0
        /// <summary>
        /// 保存题目
        /// </summary>
        /// <param name="questionTypeEnum"></param>
        /// <param name="saveQuestionModel"></param>
        /// <returns></returns>
        public void SaveQuestion(QuestionTypeEnum questionTypeEnum, SaveQuestionModel saveQuestionModel)
        {
            string    filePath = HttpContext.Current.Server.MapPath(saveQuestionModel.FilePath);
            DataTable dt       = DealWithExcel.ExcelToTable(filePath);

            if (dt.Rows.Count > 0)
            {
                T_QuestionLabel questionLabel = QuestionDAL.GetQuestionLabelByName(saveQuestionModel.LabelName);
                if (questionLabel == null)
                {
                    questionLabel           = new T_QuestionLabel();
                    questionLabel.LabelName = saveQuestionModel.LabelName;
                    QuestionDAL.Insert(questionLabel);
                }
                T_QuestionType questionType = QuestionDAL.Get <T_QuestionType>((int)questionTypeEnum);
                switch (questionTypeEnum)
                {
                case QuestionTypeEnum.SingleSelectQuestion:
                    #region 单选题
                    foreach (DataRow row in dt.Rows)
                    {
                        T_Question question = new T_Question();
                        question.QuestionType = questionType;
                        question.Stem         = row[0].ToString();
                        question.OptionA      = row[1].ToString();
                        question.OptionB      = row[2].ToString();
                        question.OptionC      = row[3].ToString();
                        question.OptionD      = row[4].ToString();
                        question.OptionE      = row[5].ToString();
                        question.OptionF      = row[6].ToString();
                        question.Answer       = row[7].ToString().Trim().ToUpper();
                        QuestionDAL.Insert(question);
                    }
                    #endregion
                    break;

                case QuestionTypeEnum.MultipleSelectQuestion:
                    #region 多选题
                    foreach (DataRow row in dt.Rows)
                    {
                        T_Question question = new T_Question();
                        question.QuestionType = questionType;
                        question.Stem         = row[0].ToString();
                        question.OptionA      = row[1].ToString();
                        question.OptionB      = row[2].ToString();
                        question.OptionC      = row[3].ToString();
                        question.OptionD      = row[4].ToString();
                        question.OptionE      = row[5].ToString();
                        question.OptionF      = row[6].ToString();
                        question.Answer       = row[7].ToString().Trim().ToUpper().Replace(',', ',');
                        QuestionDAL.Insert(question);
                    }
                    break;

                    #endregion
                case QuestionTypeEnum.JudgeQuestion:
                    #region 判断题
                    foreach (DataRow row in dt.Rows)
                    {
                        T_Question question = new T_Question();
                        question.QuestionType = questionType;
                        question.Stem         = row[0].ToString();
                        question.Answer       = row[1].ToString().Trim();
                        QuestionDAL.Insert(question);
                    }
                    break;

                    #endregion
                case QuestionTypeEnum.FillQuestion:
                    #region 填空题
                    foreach (DataRow row in dt.Rows)
                    {
                        T_Question question = new T_Question();
                        question.QuestionType = questionType;
                        question.Stem         = row[0].ToString();
                        question.Answer       = row[1].ToString().Trim().Replace(',', ',');
                        QuestionDAL.Insert(question);
                    }
                    break;
                    #endregion
                }
            }
        }
Exemplo n.º 22
0
 public string TranslateQuestionType(QuestionTypeEnum questionType)
 {
     return(this.questionTypeTranslations.First(qt => qt.Item1 == questionType).Item2);
 }
Exemplo n.º 23
0
 public Question(string content, QuestionTypeEnum type, List <string>?possibleAnswers = null)
 {
     Content         = content;
     Type            = type;
     PossibleAnswers = possibleAnswers;
 }
        public Profile GetDataContractByUser(string key, 
                                             QuestionTypeEnum questionType)
        {
            Profile userProfile = new Profile();
            long? userProfileQuestionTypeId = null;
            long? matchProfileQuestionTypeId = null;

            switch (questionType)
            {
                case QuestionTypeEnum.UserProfile:
                    {
                        // Get question tyoe id for adding user responses
                        userProfileQuestionTypeId = QuestionTypeID(QuestionTypeEnum.UserProfile.ToString());
                        var result = (from user in base.Users
                                      where user.UserName == key
                                      select new Profile
                                      {

                                          UserData = new ProfileUser
                                          {
                                              User = user
                                          },

                                          UserResponses = (from resp in user.UserResponses
                                                           where resp.QuestionTypeID == userProfileQuestionTypeId
                                                           select new ProfileResponse
                                                           {
                                                               Response = resp
                                                           }
                                                           ).ToList()

                                      }
                         );

                         userProfile = result.SingleOrDefault();
                    }
                    break;
                case QuestionTypeEnum.MatchPreference:
                    {
                        matchProfileQuestionTypeId = QuestionTypeID(QuestionTypeEnum.MatchPreference.ToString());

                        var result = (from user in base.Users
                                      where user.UserName == key
                                      select new Profile
                                      {

                                          UserData = new ProfileUser
                                          {
                                              User = user
                                          },

                                          MatchResponses = (from resp in user.UserResponses
                                                            where resp.QuestionTypeID == matchProfileQuestionTypeId
                                                            select new ProfileResponse
                                                            {
                                                                Response = resp
                                                            }
                                                           ).ToList(),

                                      }
                         );

                        userProfile = result.SingleOrDefault();
                    }
                    break;
                case QuestionTypeEnum.ChoiceResponses:
                    {
                        var result = (from user in base.Users
                                      where user.UserName == key
                                      select new Profile
                                      {

                                          UserData = new ProfileUser
                                          {
                                              User = user
                                          },

                                          ChoiceResponses = (from choice in user.ProfileChocies
                                                             join puser in Users
                                                             on choice.ProfileChoiceUserID equals puser.ID
                                                             join choiceType in Ref_ChoiceType
                                                             on choice.ChoiceType equals choiceType.ID
                                                             where choice.UserID == user.ID
                                                             select new Choice
                                                             {
                                                                 UserChoice = choice,
                                                                 MUser = puser,
                                                                 ChoiceTypeStr = choiceType.MatchType

                                                             }
                                                           ).ToList()

                                      }
                         );

                        userProfile = result.SingleOrDefault();
                    }
                    break;
                case QuestionTypeEnum.All:
                    {
                        // Get question tyoe id for adding user responses
                        //userProfileQuestionTypeId = QuestionTypeID(questionType.ToString());
                        userProfileQuestionTypeId = QuestionTypeID(QuestionTypeEnum.UserProfile.ToString());
                        matchProfileQuestionTypeId = QuestionTypeID(QuestionTypeEnum.MatchPreference.ToString());

                        var result = (from user in base.Users
                                      where user.UserName == key
                                      select new Profile
                                      {

                                          UserData = new ProfileUser
                                          {
                                              User = user
                                          },

                                          UserResponses = (from resp in user.UserResponses
                                                           where resp.QuestionTypeID == userProfileQuestionTypeId
                                                           select new ProfileResponse
                                                           {
                                                               Response = resp
                                                           }
                                                           ).ToList(),

                                          MatchResponses = (from resp in user.UserResponses
                                                            where resp.QuestionTypeID == matchProfileQuestionTypeId
                                                            select new ProfileResponse
                                                            {
                                                                Response = resp
                                                            }
                                                           ).ToList(),

                                          ChoiceResponses = (from choice in user.ProfileChocies
                                                             join puser in Users
                                                             on choice.ProfileChoiceUserID equals puser.ID
                                                             join choiceType in Ref_ChoiceType
                                                             on choice.ChoiceType equals choiceType.ID
                                                             where choice.UserID == user.ID
                                                             select new Choice
                                                             {
                                                                 UserChoice = choice,
                                                                 MUser = puser,
                                                                 ChoiceTypeStr = choiceType.MatchType

                                                             }
                                                           ).ToList()

                                      }
                         );

                        userProfile = result.SingleOrDefault();
                    }
                    break;
                case QuestionTypeEnum.BothProfiles:
                    {
                        // Get question tyoe id for adding user responses
                        //userProfileQuestionTypeId = QuestionTypeID(questionType.ToString());
                        userProfileQuestionTypeId = QuestionTypeID(QuestionTypeEnum.UserProfile.ToString());
                        matchProfileQuestionTypeId = QuestionTypeID(QuestionTypeEnum.MatchPreference.ToString());

                        var result = (from user in base.Users
                                      where user.UserName == key
                                      select new Profile
                                      {

                                          UserData = new ProfileUser
                                          {
                                              User = user
                                          },

                                          UserResponses = (from resp in user.UserResponses
                                                           where resp.QuestionTypeID == userProfileQuestionTypeId
                                                           select new ProfileResponse
                                                           {
                                                               Response = resp
                                                           }
                                                           ).ToList(),

                                          MatchResponses = (from resp in user.UserResponses
                                                            where resp.QuestionTypeID == matchProfileQuestionTypeId
                                                            select new ProfileResponse
                                                            {
                                                                Response = resp
                                                            }
                                                           ).ToList(),

                                      }
                         );

                        userProfile = result.SingleOrDefault();
                    }
                    break;
                case QuestionTypeEnum.None:
                    {
                        var result = (from user in base.Users
                                      where user.UserName == key
                                      select new Profile
                                      {
                                          UserData = new ProfileUser
                                          {
                                              User = user
                                          },
                                      }
                                      );
                        userProfile = result.SingleOrDefault();
                    }
                    break;
            }

            return userProfile;
        }
        public PLuvQuestionSurvey GetDataContractByProfileQuestions(QuestionTypeEnum questionType)
        {
            PLuvQuestionSurvey profileQuestions = new PLuvQuestionSurvey();

            switch (questionType)
            {
                case QuestionTypeEnum.UserProfile:
                    {
                        var result = GetQuestionsByType(questionType);
                        if (result != null)
                        {
                            profileQuestions.UserQuestions = result;
                        }
                    }
                    break;
                case QuestionTypeEnum.MatchPreference:
                    {
                        var result = GetQuestionsByType(questionType);
                        if (result != null)
                        {
                            profileQuestions.MatchQuestions = result;
                        }
                    }
                    break;
                case QuestionTypeEnum.All:
                    {
                        var result = GetQuestionsByType(QuestionTypeEnum.UserProfile);
                        if (result != null)
                        {
                            profileQuestions.UserQuestions = result;
                        }
                        result = GetQuestionsByType(QuestionTypeEnum.MatchPreference);
                        if (result != null)
                        {
                            profileQuestions.MatchQuestions = result;
                        }
                    }
                    break;

            }

            return profileQuestions;
        }
        private void AddToResponses(QuestionTypeEnum questionType,
                                    long userId,
                                    List<ProfileResponse> profileList)
        {
            long? questionTypeId = QuestionTypeID(questionType.ToString());

            foreach (ProfileResponse response in profileList)
            {
                base.UserResponses.Add(response.CreateResponseModelInstance(userId,
                                                                            questionTypeId.Value));
            }
        }
 public bool IsMultipleChoiceQuestion(QuestionTypeEnum questionType)
 {
     return(questionType == QuestionTypeEnum.MultipleChoiceVoting ||
            questionType == QuestionTypeEnum.MultipleChoiceClick);
 }
        private List<PLuvQuestion> GetQuestionsByType(QuestionTypeEnum questionType)
        {
            // Linq to SQL cannot handle ToString(). Consequently, need to convert to string here.
            string questionTypeeStr = questionType.ToString();

            // Getting User Profile Questions
            var result = (from attr in base.Attributes
                          join qType in Ref_QuestionType
                          on attr.QuestionTypeID equals qType.ID
                          where qType.QuestionType == questionTypeeStr
                          select new PLuvQuestion
                          {
                              ProfileQuestion = new QuestionEntity
                              {
                                  Question = attr
                              },

                              ProfileResponses = (from resp in Responses
                                                  where resp.ResponseTypeID == attr.ResponseTypeID
                                                  select new ResponseEntity
                                                  {
                                                      Response = resp
                                                  }
                                                  ).ToList()

                          }).ToList();

            return result;
        }
 public bool IsClickQuestion(QuestionTypeEnum questionType)
 {
     return(this.clickQuestionTypes.Contains(questionType));
 }
        private void UpdateResponse(QuestionTypeEnum questionType, 
                                    long userID,
                                    List<ProfileResponse> profileList)
        {
            foreach (ProfileResponse response in profileList)
            {

                // responses all could be completed later, so need to check if they are new or updates
                if (response.ProfileEntityResponse.ID == null)
                {
                    long questionTypeId = QuestionTypeID(questionType.ToString()).Value;
                    base.UserResponses.Add(response.CreateResponseModelInstance(userID,
                                                                                questionTypeId));
                }
                else
                {
                    var userResponse = response.CreateResponseModelInstanceForUpdate(userID);
                    base.UserResponses.Attach(userResponse);

                    userResponse = response.SetUserResponseModelInstance(userResponse);

                }

            }
        }