public static List <QuestionOptions> getQuestionOptions(int QuestionId)
        {
            List <QuestionOptions> questionOptions = new List <QuestionOptions>();
            string connectionString = ConfigurationManager.ConnectionStrings["DB_9AB8B7_D19DDA6422ConnectionString"].ConnectionString;

            SqlConnection conn = new SqlConnection(connectionString);
            //conn.ConnectionString = "Data Source=SQL5017.site4now.net;Initial Catalog=DB_9AB8B7_D19DDA6422;Persist Security Info=True;User ID=DB_9AB8B7_D19DDA6422_admin;Password=hga6jJJZ";

            SqlCommand cmd = new SqlCommand("SELECT * from questionoptions where QuestionId =" + QuestionId, conn);

            conn.Open();
            //cmd.Parameters.AddWithValue("QuestionID", +QuestionId );
            SqlDataReader cmdReader = cmd.ExecuteReader();

            while (cmdReader.Read())
            {
                QuestionOptions options = new QuestionOptions();
                options.QueOptId   = (int)cmdReader["QueOptId"];
                options.QuesOption = cmdReader["QuesOption"].ToString();
                options.QuestionId = (int)cmdReader["QuestionId"];
                options.NextQueID  = cmdReader["NextQueID"] as int?;
                questionOptions.Add(options);
            }
            conn.Close();
            return(questionOptions);
        }
示例#2
0
    public void ShowOptions(int set)
    {
        qo_selected = sets[set];
        is_visible  = true;

        option1.enabled = is_visible;
        if (qo_selected.max_options > 1)
        {
            option2.enabled = is_visible;
        }
        if (qo_selected.max_options > 2)
        {
            option3.enabled = is_visible;
        }

        selected_option   = 1;
        option1.fontStyle = FontStyle.Italic;
        option1.fontSize  = option1.fontSize + 4;

        option1.text = qo_selected.option1;
        option2.text = qo_selected.option2;
        option3.text = qo_selected.option3;

        arrow.enabled = is_visible;
        arrow.rectTransform.localPosition = new Vector3(arrow.rectTransform.localPosition.x, -226, arrow.rectTransform.localPosition.z);
    }
示例#3
0
        QuestionOptions GetQuestionModel(int?questionId)
        {
            int             iterator        = 0;
            QuestionOptions questionOptions = null;

            if (questionId != null && questionId > 0)
            {
                foreach (QuestionOptions questionOption in _questionBank)
                {
                    if (questionOption.Question.ID == questionId)
                    {
                        iterator++;
                        break;
                    }
                    iterator++;
                }
            }

            if (iterator > _questionBank.Count - 1)
            {
                questionOptions = _questionBank[_questionBank.Count - 1];
            }
            else
            if (_questionBank[iterator] != null)
            {
                questionOptions = _questionBank[iterator];
            }
            else
            {
                questionOptions = _questionBank[_questionBank.Count - 1];
            }

            return(questionOptions);
        }
示例#4
0
        public ActionResult SurveyAnswerGender(int id)
        {
            var survey = db.Surveys.Find(id);

            AnswerViewModel model = new AnswerViewModel();

            model.SurveyID   = survey.SurveyID;
            model.SurveyName = survey.SurveyTitle;
            model.Questions  = new List <Questions>();

            foreach (var item in survey.Questions)
            {
                Questions q = new Questions();
                q.QuestionIndex   = item.QuestionIndex;
                q.QuestionText    = item.QuestionText;
                q.QuestionOptions = new List <QuestionOptions>();
                foreach (var itm in item.QuestionOptions)
                {
                    QuestionOptions qo = new QuestionOptions();
                    qo.QuestionOptionID = itm.QuestionOptionID;
                    qo.OptionText       = itm.QuestionOptionText;
                    qo.AnswerCount      = db.ResponseAnswers.Where(t => t.QuestionOptionID == qo.QuestionOptionID).Count();
                    qo.MAnsCount        = db.ResponseAnswers.Where(t => t.QuestionOptionID == qo.QuestionOptionID && t.SurveyResponse.Visitor.Gender.Equals("Male")).Count();
                    qo.FAnsCount        = db.ResponseAnswers.Where(t => t.QuestionOptionID == qo.QuestionOptionID && t.SurveyResponse.Visitor.Gender.Equals("Female")).Count();
                    q.QuestionOptions.Add(qo);
                }
                model.Questions.Add(q);
            }

            return(View(model));
        }
示例#5
0
        QuestionOptionsViewModel GetQuestionViewModel(int?questionId)
        {
            QuestionOptions questionOptions = GetQuestionModel(questionId);

            QuestionOptionsViewModel questionOptionsViewModel     = null;
            List <OptionViewModel>   questionOptionsViewModelList = new List <OptionViewModel>();

            questionOptionsViewModel          = new QuestionOptionsViewModel();
            questionOptionsViewModel.Question = new QuestionViewModel()
            {
                ID = questionOptions.Question.ID, Text = questionOptions.Question.Text
            };

            foreach (Option option in questionOptions.Options)
            {
                questionOptionsViewModelList.Add(new OptionViewModel()
                {
                    ID = option.ID, Text = option.Text
                });
            }

            questionOptionsViewModel.Options       = questionOptionsViewModelList;
            questionOptionsViewModel.IsMultiChoice = questionOptions.IsMultiChoice;

            return(questionOptionsViewModel);
        }
        public async Task <ActionResult> UpdateQuestionOption(int id, QuestionOptions questionOptions)
        {
            if (id != questionOptions.QuestionOptionId)
            {
                return(new BadRequestResult());
            }

            _context.Entry(questionOptions).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!QuestionOptionsExists(id))
                {
                    return(new NotFoundResult());
                }
                else
                {
                    throw;
                }
            }

            return(new NoContentResult());
        }
示例#7
0
        public List <QuestionOptions> MapquesDetails(DataTable dtquesOptDetails)
        {
            List <QuestionOptions> _lstquesOpt = new List <QuestionOptions>();

            foreach (DataRow drquesDetails in dtquesOptDetails.Rows)
            {
                QuestionOptions _quesDetails = new QuestionOptions();

                if (dtquesOptDetails.Columns.Contains("Option_Id") && drquesDetails["Option_Id"] != DBNull.Value)
                {
                    _quesDetails.OptionId = Convert.ToInt32(drquesDetails["Option_Id"]);
                }
                if (dtquesOptDetails.Columns.Contains("Option_SeqNo") && drquesDetails["Option_SeqNo"] != DBNull.Value)
                {
                    _quesDetails.SequenceNo = Convert.ToInt32(drquesDetails["Option_SeqNo"]);
                }
                if (dtquesOptDetails.Columns.Contains("Option_Desc") && drquesDetails["Option_Desc"] != DBNull.Value)
                {
                    _quesDetails.Description = Convert.ToString(drquesDetails["Option_Desc"]);
                }
                if (dtquesOptDetails.Columns.Contains("Option_IsAnswer") && drquesDetails["Option_IsAnswer"] != DBNull.Value)
                {
                    _quesDetails.IsAnswer = Convert.ToBoolean(drquesDetails["Option_IsAnswer"]);
                }

                _lstquesOpt.Add(_quesDetails);
            }
            return(_lstquesOpt);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            QuestionOptions questionoptions = db.QuestionOptions.Find(id);

            db.QuestionOptions.Remove(questionoptions);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> AddQuestionOption(QuestionOptions questionOptions)
        {
            questionOptions.isVisible = true;
            _context.QuestionOptions.Add(questionOptions);

            await _context.SaveChangesAsync();

            return(new OkObjectResult("Question Option Inserted Sucessfully"));
        }
示例#10
0
        public IActionResult ManageQuestion(int queryNumber, int questionNumber)
        {
            var      username = User.Identity.Name.ToString();
            var      user     = UserOptions.GetUser(username);
            Query    query    = QueryOptions.Load(user, queryNumber);
            Question question = QuestionOptions.Load(query, questionNumber);

            return(View("LoadQuestion", question));
        }
示例#11
0
 public IEnumerable<Stacky.Question> GetQuestions(string site)
 {
     Stacky.Site apiSite = GetSiteByName(site);
     var siteClient = new StackyClient("1.0", "", apiSite, new UrlClient(), new JsonProtocol());
     QuestionOptions qo = new QuestionOptions();
     qo.IncludeBody = true;
     qo.Max = 1000;
     return siteClient.GetQuestions(qo);
 }
 public async Task Remove(QuestionOptions q_o)
 {
     using (var uow = UowProvider.CreateUnitOfWork())
     {
         var repositoryQuestionOption = uow.GetRepository <QuestionOptions, Guid>();
         repositoryQuestionOption.Remove(q_o);
         uow.SaveChanges();
     }
 }
示例#13
0
        private MessageBoxButton QuestionOptionsToMessageBoxButton(QuestionOptions options)
        {
            switch (options)
            {
            case QuestionOptions.YesNo:
                return(MessageBoxButton.YesNo);
            }

            return(default);
示例#14
0
 public IEnumerable<Stacky.Question> GetQuestions(Stacky.Site site, string[] tags)
 {
     var siteClient = new StackyClient("1.0", "", site, new UrlClient(), new JsonProtocol());
     QuestionOptions qo = new QuestionOptions();
     qo.IncludeBody = true;
     qo.Max = 1000;
     qo.Tags = tags;
     return siteClient.GetQuestions(qo);
 }
示例#15
0
        //
        // GET: /QuestionOptions/Details/5

        public ActionResult Details(int id = 0)
        {
            QuestionOptions questionoptions = db.QuestionOptions.Find(id);

            if (questionoptions == null)
            {
                return(HttpNotFound());
            }
            return(View(questionoptions));
        }
示例#16
0
        public IActionResult LoadAnswer(int queryNumber, int questionNumber, int answerNumber)
        {
            var      username = User.Identity.Name.ToString();
            var      user     = UserOptions.GetUser(username);
            Query    query    = QueryOptions.Load(user, queryNumber);
            Question question = QuestionOptions.Load(query, questionNumber);
            Answer   answer   = AnswerOptions.Load(question, answerNumber);

            return(View("LoadAnswer", answer));
        }
示例#17
0
    public IEnumerable <Stacky.Question> GetQuestions(Stacky.Site site, string[] tags)
    {
        var             siteClient = new StackyClient("1.0", "", site, new UrlClient(), new JsonProtocol());
        QuestionOptions qo         = new QuestionOptions();

        qo.IncludeBody = true;
        qo.Max         = 1000;
        qo.Tags        = tags;
        return(siteClient.GetQuestions(qo));
    }
示例#18
0
    public IEnumerable <Stacky.Question> GetQuestions(string site)
    {
        Stacky.Site     apiSite    = GetSiteByName(site);
        var             siteClient = new StackyClient("1.0", "", apiSite, new UrlClient(), new JsonProtocol());
        QuestionOptions qo         = new QuestionOptions();

        qo.IncludeBody = true;
        qo.Max         = 1000;
        return(siteClient.GetQuestions(qo));
    }
示例#19
0
        public IActionResult ManageAnswer()
        {
            var      username = User.Identity.Name.ToString();
            var      user     = UserOptions.GetUser(username);
            Query    query    = QueryOptions.Load(user, 1);
            Question question = QuestionOptions.Load(query, 1);
            Answer   answer   = AnswerOptions.Load(question, 1);

            return(View("LoadAnswer", answer));
        }
示例#20
0
        public IActionResult InsertAnswer(int queryNumber, int questionNumber)
        {
            var username = User.Identity.Name.ToString();
            var user     = UserOptions.GetUser(username);
            var query    = QueryOptions.Load(user, queryNumber);
            var question = QuestionOptions.Load(query, questionNumber);

            QuestionOptions.AddAnswer(question);

            return(RedirectToAction("LoadAnswer", "Answer", new { queryNumber = question.QueryNumber, questionNumber = question.Number, answerNumber = question.Answers.Max(x => x.Number) }));
        }
示例#21
0
        /// <summary>
        /// 添加问题
        /// </summary>
        /// <param name="description"></param>
        /// <returns></returns>
        public QuestionOption AddQuestionOption(string description)
        {
            var questionOption = QuestionOption.CreateNew(this, description);

            if (QuestionOptions == null)
            {
                QuestionOptions = new List <QuestionOption>();
            }
            QuestionOptions.Add(questionOption);
            return(questionOption);
        }
示例#22
0
 public ActionResult Edit(QuestionOptions questionoptions)
 {
     if (ModelState.IsValid)
     {
         db.Entry(questionoptions).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OptionChoiceID = new SelectList(db.OptionChoices, "ID", "Name", questionoptions.OptionChoiceID);
     ViewBag.QuestionID     = new SelectList(db.Questions, "ID", "Name", questionoptions.QuestionID);
     return(View(questionoptions));
 }
示例#23
0
        /// <summary>
        /// 设置正确选项
        /// </summary>
        /// <param name="questionOptionGuid"></param>
        public void SetCorrectOption(Guid questionOptionGuid)
        {
            if (QuestionOptions == null)
            {
                throw new Exception($"问题选项{questionOptionGuid}不存在!");
            }

            var qOption = QuestionOptions.FirstOrDefault(p => p.QuestionOptionGuid.Equals(questionOptionGuid));

            CorrectOption   = qOption ?? throw new Exception($"问题选项{questionOptionGuid}不存在!");
            CorrectOptionId = questionOptionGuid;
        }
示例#24
0
        //
        // GET: /QuestionOptions/Edit/5

        public ActionResult Edit(int id = 0)
        {
            QuestionOptions questionoptions = db.QuestionOptions.Find(id);

            if (questionoptions == null)
            {
                return(HttpNotFound());
            }
            ViewBag.OptionChoiceID = new SelectList(db.OptionChoices, "ID", "Name", questionoptions.OptionChoiceID);
            ViewBag.QuestionID     = new SelectList(db.Questions, "ID", "Name", questionoptions.QuestionID);
            return(View(questionoptions));
        }
示例#25
0
        public ActionResult Create(QuestionOptions questionoptions)
        {
            if (ModelState.IsValid)
            {
                db.QuestionOptions.Add(questionoptions);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.OptionChoiceID = new SelectList(db.OptionChoices, "ID", "Name", questionoptions.OptionChoiceID);
            ViewBag.QuestionID     = new SelectList(db.Questions, "ID", "Name", questionoptions.QuestionID);
            return(View(questionoptions));
        }
示例#26
0
        public IActionResult ClientView()
        {
            var      username       = User.Identity.Name.ToString();
            var      user           = UserOptions.GetUser(username);
            var      test           = user.Queries[0];
            var      queryNumber    = test.Number;
            Query    query          = QueryOptions.Load(user, queryNumber);
            var      t              = query.Questions[0];
            var      questionNumber = t.Number;
            Question question       = QuestionOptions.Load(query, questionNumber);

            return(View("ClientView", question));
        }
示例#27
0
        public IActionResult InsertQuestion(int queryID)
        {
            var username = User.Identity.Name.ToString();
            var user     = UserOptions.GetUser(username);
            var query    = QueryOptions.Load(user, queryID);

            QueryOptions.AddQuestion(query);

            var questionNumber = query.Questions.Max(x => x.Number);
            var question       = QuestionOptions.Load(query, questionNumber);

            return(RedirectToAction("LoadQuestion", "Question", question));
        }
示例#28
0
        public IActionResult AddAnswer(int queryNumber, int number, string answerName)
        {
            var username = User.Identity.Name.ToString();
            var user     = UserOptions.GetUser(username);
            var query    = QueryOptions.Load(user, queryNumber);

            query.Questions = query.Questions.OrderBy(q => q.Order).ToList();
            var question = QuestionOptions.Load(query, number);

            question.Answers = question.Answers.OrderBy(a => a.Order).ToList();

            QuestionOptions.AddAnswer(question, 0, answerName);

            return(RedirectToAction("LoadActiveQuery", new { queryID = queryNumber }));
        }
示例#29
0
        public IActionResult LoadNextQuestion(int queryNumber, int questionNumber, bool fromDelete = false)
        {
            var username = User.Identity.Name.ToString();
            var user     = UserOptions.GetUser(username);
            var query    = QueryOptions.Load(user, queryNumber);

            query.Questions = query.Questions.OrderBy(q => q.Order).ToList();
            var question = QuestionOptions.Load(query, questionNumber);

            question.Answers = question.Answers.OrderBy(a => a.Order).ToList();

            int index = 0;

            for (int i = 0; i < query.Questions.Count; ++i)
            {
                if (query.Questions[i].Number == question.Number)
                {
                    index = i;
                }
            }

            try
            {
                if (fromDelete)
                {
                    QuestionOptions.SetNextActive(question, query.Questions[index].Number);
                }
                else
                {
                    QuestionOptions.SetNextActive(question, query.Questions[index + 1].Number);
                }
            }
            catch (ArgumentOutOfRangeException ex) { }

            try
            {
                //var nextQuestionNumber = query.Questions.First(x => x.Number > questionNumber).Number;
                //var nextQuestion = QuestionOptions.Load(query, nextQuestionNumber);
                var nextQuestion = QuestionOptions.GetActive(query.Questions[index + 1].Number, query.Code, false);
                question.Answers = question.Answers.OrderBy(a => a.Order).ToList();
                return(View("LoadActiveQuestion", nextQuestion));
            }
            catch
            {
                QueryOptions.Close(query);
                return(RedirectToAction(nameof(UserController.Index), "User"));
            }
        }
        public Guid Add(Guid questoinId, Guid optionChoiceId)
        {
            QuestionOptions questionOption = new QuestionOptions()
            {
                QuestionId     = questoinId,
                OptionChoiseId = optionChoiceId
            };

            using (var uow = UowProvider.CreateUnitOfWork())
            {
                var repositoryQuestionOption = uow.GetRepository <QuestionOptions, Guid>();
                repositoryQuestionOption.Add(questionOption);
                uow.SaveChanges();
                return(questionOption.Id);
            }
        }
示例#31
0
        public IActionResult InsertQuestion(int queryNumber, int Order, string NewQuestionName)
        {
            var username = User.Identity.Name.ToString();
            var user     = UserOptions.GetUser(username);
            var query    = QueryOptions.Load(user, queryNumber);

            query.Questions = query.Questions.OrderBy(q => q.Order).ToList();

            QueryOptions.AddQuestion(query, NewQuestionName, Order + 1);

            var questionNumber = query.Questions.Max(x => x.Number);
            var question       = QuestionOptions.Load(query, questionNumber);

            question.Answers = question.Answers.OrderBy(a => a.Order).ToList();

            return(View("LoadActiveQuestion", question));
        }
示例#32
0
        public IActionResult SelectAnswer(int number, string code)
        {
            var question = QuestionOptions.GetActive(number, code, true);
            var answer   = AnswerOptions.Load(question, number);

            AnswerOptions.Select(answer);
            question.IsAnswered = true;

            //return RedirectToAction("JoinQuery", "Client", new { code, question });
            if (QueryOptions.ValidCode(code))
            {
                return(View("ClientView", question));
            }
            else
            {
                return(View("QueryClosed", question));
            }
        }
        public MessageForUser(
            UIViewController viewController,
            string messageText,
            string messageTitle,
            QuestionOptions questionType = QuestionOptions.OK,
            Action postiveAction = null,
            Action negativeAction = null
              )
        {
            if (negativeAction == null)
            {
                negativeAction = () => { };
            }

            if (postiveAction == null)
            {
                postiveAction = () => { };
            }
            var okCancelAlertController = UIAlertController.Create(messageTitle, messageText, UIAlertControllerStyle.Alert);

            switch (questionType)
            {
                case QuestionOptions.OK:
                    okCancelAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, alert => postiveAction()));
                    break;
                case QuestionOptions.OkCancel:
                    okCancelAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, alert => postiveAction()));
                    okCancelAlertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, alert => negativeAction()));

                    break;
                case QuestionOptions.YesNo:
                    okCancelAlertController.AddAction(UIAlertAction.Create("Yes", UIAlertActionStyle.Default, alert => postiveAction()));
                    okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Destructive, alert => negativeAction()));

                    break;
                default:
                    break;
            }

            //Present Alert
            viewController.PresentViewController(okCancelAlertController, true, null);
        }
示例#34
0
 void IntializeQuestionOptionsBehavior()
 {
     questionOptions = questionOptionsGameObject.GetComponent<QuestionOptions>();
     if (questionOptions == null)
         Debug.Log("Cannot find 'QuestionOptions' script");
 }
示例#35
0
        //public static ExamManager Instance
        //{
        //    get 
        //    {
        //        if (_examManager == null)
        //            _examManager = new ExamManager();

        //        return _examManager;
        //    }
        //}

        void Initialize()
        {
            _questionBank = new List<QuestionOptions>();
            _questionAnswers = new List<QuestionAnswers>();

            Question question = new Question();

            question.ID = 1;
            question.Text = "Where are routes registered in ASP.NET MVC Application?";

            List<Option> options = new List<Option>();
            options.Add(new Option(){ID = 1, Text = "Controller" });
            options.Add(new Option(){ID = 2, Text = "Web.Config" });
            options.Add(new Option(){ID = 3, Text = "Global.asax" });
            options.Add(new Option(){ID = 4, Text = "All of the Above" });
            
            QuestionOptions questionOptions = new QuestionOptions();
            questionOptions.Question = question;
            questionOptions.Options = options;

            List<Option> answers = new List<Option>();
            answers.Add(new Option() { ID = 3, Text = "Global.asax" });

            QuestionAnswers questionAnswers = new QuestionAnswers();
            questionAnswers.Question = question;
            questionAnswers.Answers = answers;

            _questionBank.Add(questionOptions);
            _questionAnswers.Add(questionAnswers);


            question = new Question();

            question.ID = 2;
            question.Text = "What are digital signatures used for? (Choose all that apply.)";

            options = new List<Option>();
            options.Add(new Option() { ID = 1, Text = "Encryption" });
            options.Add(new Option() { ID = 2, Text = "Authorization" });
            options.Add(new Option() { ID = 3, Text = "Nonrepudiation" });
            options.Add(new Option() { ID = 4, Text = "Authentication" });

            questionOptions = new QuestionOptions();
            questionOptions.Question = question;
            questionOptions.Options = options;
            questionOptions.IsMultiChoice = true;

            answers = new List<Option>();
            answers.Add(new Option() { ID = 1, Text = "Encryption" });
            answers.Add(new Option() { ID = 2, Text = "Authorization" });
            answers.Add(new Option() { ID = 3, Text = "Nonrepudiation" });
            answers.Add(new Option() { ID = 4, Text = "Authentication" });

            questionAnswers = new QuestionAnswers();
            questionAnswers.Question = question;
            questionAnswers.Answers = answers;
            
            _questionBank.Add(questionOptions);
            _questionAnswers.Add(questionAnswers);


            question = new Question();

            question.ID = 3;
            question.Text = "You are creating an ASP.NET MVC 4 web application that will be accessed by a large number of traditional consumers. If you need to be able to access state information on the client side in JavaScript/jQuery, where can you store it? (Choose all that apply.)";

            options = new List<Option>();
            options.Add(new Option() { ID = 1, Text = "LocalStorage" });
            options.Add(new Option() { ID = 2, Text = "QueryString" });
            options.Add(new Option() { ID = 3, Text = "ViewState" });
            options.Add(new Option() { ID = 4, Text = "Cookies" });
            options.Add(new Option() { ID = 5, Text = "All of the Above" });

            questionOptions = new QuestionOptions();
            questionOptions.Question = question;
            questionOptions.Options = options;

            questionOptions.IsMultiChoice = true;

            answers = new List<Option>();
            answers.Add(new Option() { ID = 1, Text = "LocalStorage" });
            answers.Add(new Option() { ID = 4, Text = "Cookies" });

            questionAnswers = new QuestionAnswers();
            questionAnswers.Question = question;
            questionAnswers.Answers = answers;

            _questionBank.Add(questionOptions);
            _questionAnswers.Add(questionAnswers);

            question = new Question();

            question.ID = 4;
            question.Text = "Which of the following feature is a part of HTML 5?";

            options = new List<Option>();
            options.Add(new Option() { ID = 1, Text = "Canvas" });
            options.Add(new Option() { ID = 2, Text = "Audio And Video" });
            options.Add(new Option() { ID = 3, Text = "GeoLocation" });
            options.Add(new Option() { ID = 4, Text = "All of the Above" });

            questionOptions = new QuestionOptions();
            questionOptions.Question = question;
            questionOptions.Options = options;

            answers = new List<Option>();
            answers.Add(new Option() { ID = 4, Text = "All of the Above" });

            questionAnswers = new QuestionAnswers();
            questionAnswers.Question = question;
            questionAnswers.Answers = answers;

            _questionBank.Add(questionOptions);
            _questionAnswers.Add(questionAnswers);
            
            question = new Question();

            question.ID = 5;
            question.Text = "Which of the following browser supports HTML5 in its latest version?";

            options = new List<Option>();
            options.Add(new Option() { ID = 1, Text = "Mozilla Firefox" });
            options.Add(new Option() { ID = 2, Text = "Opera" });
            options.Add(new Option() { ID = 3, Text = "Both Of the Above" });
            options.Add(new Option() { ID = 4, Text = "None of the Above" });

            questionOptions = new QuestionOptions();
            questionOptions.Question = question;
            questionOptions.Options = options;

            answers = new List<Option>();
            answers.Add(new Option() { ID = 4, Text = "None of the Above" });

            questionAnswers = new QuestionAnswers();
            questionAnswers.Question = question;
            questionAnswers.Answers = answers;

            _questionBank.Add(questionOptions);
            _questionAnswers.Add(questionAnswers);
        }
示例#36
0
 public virtual void GetQuestions(Action<IPagedList<Question>> onSuccess, Action<ApiException> onError, QuestionOptions options)
 {
     var sortArgs = options.SortBy.GetAttribute<SortArgsAttribute>();
     GetQuestions(onSuccess, onError, "questions", sortArgs.UrlArgs, sortArgs.Sort, GetSortDirection(options.SortDirection), options.Page, options.PageSize, options.IncludeBody, options.IncludeComments, options.IncludeAnswers, options.FromDate, options.ToDate, options.Min, options.Max, options.Tags);
 }
示例#37
0
 public virtual IPagedList<Question> GetQuestions(IEnumerable<int> questionIds, QuestionOptions options)
 {
     var sortArgs = options.SortBy.GetAttribute<SortArgsAttribute>();
     string[] urlArgs = sortArgs.UrlArgs.Concat(new string[] { questionIds.Vectorize() }).ToArray();
     return GetQuestions("questions", urlArgs, sortArgs.Sort, GetSortDirection(options.SortDirection), options.Page, options.PageSize, options.IncludeBody, options.IncludeComments, options.IncludeAnswers, options.FromDate, options.ToDate, options.Min, options.Max, options.Tags);
 }
示例#38
0
 public virtual IPagedList<Question> GetQuestions(QuestionOptions options)
 {
     var sortArgs = options.SortBy.GetAttribute<SortArgsAttribute>();
     return GetQuestions("questions", sortArgs.UrlArgs, sortArgs.Sort, GetSortDirection(options.SortDirection), options.Page, options.PageSize, options.IncludeBody, options.IncludeComments, options.IncludeAnswers, options.FromDate, options.ToDate, options.Min, options.Max, options.Tags);
 }