コード例 #1
0
ファイル: MCQ.xaml.cs プロジェクト: Binsuu/MediaPlayer
        public MCQ()
        {
            InitializeComponent();

            Questions = QuestionCollection.GetQuestions().Where(x => x.grade.Equals("Five")).SelectMany(x => x.subjects).Where(x => x.subject.Equals("Science")).SelectMany(x => x.questions).Where(x => x.Qno != 0).ToList();

            Total       = Questions.Count;
            ClickAnswer = new int[Total];
            Answer      = new int[Total];
            tClick      = new int[tQuestion];
            Random rnd = new Random();

            Attempt.Content   = 0.ToString();
            Remaining.Content = tQuestion.ToString();

            while (RndQuestion.Count < tQuestion)
            {
                int qno = rnd.Next(1, Questions.Count);
                if (!RndQuestion.Contains(qno))
                {
                    RndQuestion.Add(qno);
                }
            }

            question = Questions.Where(x => x.Qno == RndQuestion[qno]).FirstOrDefault();

            DataContext = question;
        }
コード例 #2
0
 internal AnswerExtractionWebConsole(string databasePath, QuestionCollection questions, ExtractionKnowledge knowledge, LinkBasedExtractor extract)
 {
     _databasePath = databasePath;
     _questions    = questions;
     _knowledge    = knowledge;
     _extractor    = extract;
 }
コード例 #3
0
ファイル: Test.cs プロジェクト: moskalenco-a/TestApp
 public Test(string path)
 {
     collection = new QuestionCollection();
     collection.LoadFromFile(path);
     correct = Enumerable.Repeat(false, collection.Count).ToList();
     current = 0;
 }
コード例 #4
0
ファイル: GameScript.cs プロジェクト: mwalden/quizgame
    IEnumerator ParseQuestions(WWW www)
    {
        yield return(www);

        if (www.error == null)
        {
            QuestionCollection result       = JsonUtility.FromJson <QuestionCollection>(www.text);
            List <Question>    questionList = new List <Question> ();
            foreach (QuestionDAO question in result.questions)
            {
                List <Answer> answers = new List <Answer>();
                if (question.answers == null)
                {
                    Debug.Log("answers are null!!!!!");
                    continue;
                }
                foreach (AnswerDAO answer in question.answers)
                {
                    answers.Add(new Answer(answer.id, answer.answer));
                }
                Question qStruct = new Question(question.question, question.subQuestion, question.previewUrl, answers.ToArray(), question.answerId);
                questionList.Add(qStruct);
            }
            allQuestions = questionList;

            loadQuestion();
        }
        else
        {
            Debug.Log("ERROR FACE!!!");
        }
    }
コード例 #5
0
        private void GetQuestion()
        {
            string query = "SELECT  QUESTION_ID, QUESTION_USER_ID, QUESTION_TEXT, ROW_INDEX FROM TB_USER_QUESTION";

            using (DataTable dt = DBSqlite.GetSelectData(query))
            {
                if (dt.Rows.Count > 0)
                {
                    QuestionCollection.Clear();

                    foreach (DataRow dr in dt.Rows)
                    {
                        question Question = new question()
                        {
                            QUESTION_ID      = dr["QUESTION_ID"].ToString(),
                            QUESTION_USER_ID = dr["QUESTION_USER_ID"].ToString(),
                            QUESTION_TEXT    = dr["QUESTION_TEXT"].ToString(),
                            ROW_INDEX        = (int)dr["ROW_INDEX"]
                        };

                        QuestionCollection.Add(Question);
                    }
                }
            }
        }
コード例 #6
0
 void Start (){
 
     //create the collection
     questions = new QuestionCollection();
     //fill the collection using this scheme
     questions.AddQuestion("Was that question answered?", new sting[] { "yes", "no" }, 0);
 
     ShowstartScreen ();
 }
コード例 #7
0
    public void PresentFinalQuestion(Text category)
    {
        _currentCategory   = category;
        questionCollection = gameObject.GetComponent <QuestionCollection>();

        currentQuestion = questionCollection.GetUnaskedQuestion(category.text);

        _uiFinale.SetupUIForQuestion(category, currentQuestion);
    }
コード例 #8
0
    private void RetrieveFromDatabase()
    {
        RestClient.Get <QuestionCollection>(firebaseDBURL).
        Then(response =>
        {
            _questionCollection = response;

            // Set the number of Questions
            _numberOfQuestions = _questionCollection.questions.Length;
        });
    }
コード例 #9
0
    private void LoadQuestions()
    {
        using (StreamReader stream = new StreamReader(questionPath))
        {
            string json = stream.ReadToEnd();
            questionCollection = JsonUtility.FromJson <QuestionCollection>(json);
        }

        Debug.Log("Questions Loaded: " + questionCollection.questions.Length);
        FindObjectOfType <Text>().text = questionCollection.ToString();
    }
コード例 #10
0
        internal QuestionDialogProvider(ExperimentCollection collection, QuestionCollection questions, string experimentPrefix)
        {
            _questions = questions;

            foreach (var experiment in collection.Experiments)
            {
                if (experiment.Id.StartsWith(experimentPrefix))
                {
                    _experiments.Add(experiment);
                }
            }

            _experiments.Sort((a, b) => a.Id.CompareTo(b.Id));
        }
コード例 #11
0
        private void ExecuteDeleteQuestionCommand(Object parameter)
        {
            var result = MessageBox.Show("Действительно удалить вопрос?", "Удаление вопроса",
                                         MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                var resultTry = DBDataSource.DeleteQuestion(SelectedQuestion);
                if (resultTry)
                {
                    QuestionCollection.Remove(SelectedQuestion);
                }
            }
        }
コード例 #12
0
        public QuestionCollectionExperiment(string experimentsRoot, string experimentId, int taskCount, QuestionCollection questions)
            : base(experimentsRoot, experimentId)
        {
            _questions = questions;
            var writer = new CrowdFlowerCodeWriter(ExperimentRootPath, experimentId);

            //generate all tasks
            for (var taskIndex = 0; taskIndex < taskCount; ++taskIndex)
            {
                add(taskIndex, writer);
            }

            writer.Close();
        }
コード例 #13
0
        public MainWindow()
        {
            InitializeComponent();
            string xmlPath = PickFileWindow.Display(@"../../Exams/databases_exam.xml");

            if (xmlPath == null)
            {
                this.Close();
                return;
            }

            mMainCollection      = new QuestionCollection(xmlPath);
            mMainCollectionCount = mMainCollection.Count;
            RestartGame();
        }
コード例 #14
0
 private bool ValidFile()
 {
     if (!File.Exists(txtInput.Text))
     {
         return(false);
     }
     try
     {
         QuestionCollection qc = new QuestionCollection(txtInput.Text);
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
コード例 #15
0
ファイル: PlayAudioScript.cs プロジェクト: mwalden/quizgame
    IEnumerator FindGames(WWW www)
    {
        yield return(www);

        if (www.error == null)
        {
            Debug.Log("SUCCESS!");
            Debug.Log(www.text);
            QuestionCollection result = JsonUtility.FromJson <QuestionCollection>(www.text);
            Debug.Log(result.questions [0].question);
        }
        else
        {
            Debug.Log("ERROR FACE!!!");
        }
    }
コード例 #16
0
    void LoadQuestions()
    {
        // reads the file with path "questionPath" and closes it automatically
        // after its done
        using (StreamReader reader = new StreamReader(questionPath))
        {
            // extract and store the entire file in a string
            string json = reader.ReadToEnd();

            // deserialize that string data into our question collection object
            questionCollection = JsonUtility.FromJson <QuestionCollection>(json);
        }

        print("Questions loaded: " + questionCollection.questions.Length);
        words.text = questionCollection.ToString();
    }
コード例 #17
0
        public AnswerExtractionExperiment(string experimentsRoot, string experimentId, int taskCount, QuestionCollection questions, LinkBasedExtractor extractor)
            : base(experimentsRoot, experimentId)
        {
            _questions = questions;
            _knowledge = new ExtractionKnowledge(Path.Combine(ExperimentRootPath, "knowledge.knw"));
            _extractor = extractor;

            var writer = new CrowdFlowerCodeWriter(ExperimentRootPath, experimentId);

            //generate all tasks
            for (var taskIndex = 0; taskIndex < taskCount; ++taskIndex)
            {
                add(taskIndex, writer);
            }

            writer.Close();
        }
コード例 #18
0
        public ExamGeneration()
        {
            InitializeComponent();

            course = new Course();
            adm    = new Admin();
            adm.Id = 1;
            exam   = new Exam(false, adm);

            courses = CourseDAL.SelectAll();

            for (int i = 0; i < courses.Count; i++)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = courses[i].Name;
                item.Value = courses[i].Id;
                CourseNameComboBox.Items.Add(item);
                CourseNameComboBox.SelectedIndex = 0;
            }
            updateCourse();

            exams = ExamDAL.getAll(adm);
            for (int i = 0; i < exams.Count; i++)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = exams[i].Id.ToString();
                item.Value = exams[i].Id;
                ExamsComboBox.Items.Add(item);
                ExamsComboBox.SelectedIndex = 0;
            }

            QuestionCollection col = QuestionDAL.GetByType(1);

            MCQnumLabel.Text = col.Count.ToString();
            QuestionCollection col2 = QuestionDAL.GetByType(2);

            TFnumLabel.Text = col2.Count.ToString();
            QuestionCollection col3 = QuestionDAL.GetByType(3);

            EssaynumLabel.Text = col3.Count.ToString();

            updateExamSessions();
        }
コード例 #19
0
    void GenerateSampleQuestions()
    {
        // create new questions and store them into question collection
        Question[] newQuestions = new Question[2] {
            new Question()
            {
                text = "what month is my birthday?", answer = "september"
            },
            new Question()
            {
                text = "how are you?", answer = "fine, thanks :D"
            }
        };

        questionCollection = new QuestionCollection()
        {
            questions = newQuestions, collectionName = "samples"
        };
    }
コード例 #20
0
        public static QuestionCollection GetByType(int type)
        {
            DataTable          dt     = DBLayer.ExecuteQuery(string.Format("select * from Question where question_type = {0}", type));
            QuestionCollection result = new QuestionCollection();

            if (dt.Rows.Count > 0)
            {
                int            questID  = Convert.ToInt32(dt.Rows[0]["id"].ToString());
                string         text     = dt.Rows[0]["question_text"].ToString();
                string         modelAns = dt.Rows[0]["question_modelAns"].ToString();
                int            courseID = Convert.ToInt32(dt.Rows[0]["Course_ID"].ToString());
                QuestionAnswer questans = new QuestionAnswer();
                questans.Answer = modelAns;
                Course course = new Course();
                course.Id = courseID;
                Question quest = new Question(questID, text, type, questans, course);
                result.Add(quest);
            }
            return(result);
        }
コード例 #21
0
        public void RestartGame()
        {
            stpAnswers.Children.Clear();
            lblQuestion.Text = "";
            lblTimer.Content = "";


            if (this.IsVisible)
            {
                double result = (double)mScore / (double)mMaxQuestions;
                result *= 100;
                string message =
                    "Congratulations!" + Environment.NewLine +
                    "You earned " + mScore + "/" + mMaxQuestions + " points!" + Environment.NewLine +
                    "That makes " + (int)result + "%" + Environment.NewLine +
                    "You managed to finish in just " + new DateTime((DateTime.Now - mTimerStart).Ticks).ToString("HH:mm:ss") + "!";
                MessageBox.Show(message);
            }


            ShufflerWindow w1 = new ShufflerWindow();

            w1.ShowDialog();


            mMainTimer.Interval = new TimeSpan(0, 0, 1);
            mMainTimer.Start();
            mTimerStart      = DateTime.Now;
            mMainTimer.Tick += (s, ea) =>
            {
                TimeSpan diff      = DateTime.Now - mTimerStart;
                string   formatted = new DateTime(diff.Ticks).ToString("HH:mm:ss");
                lblTimer.Content = formatted;
            };

            mCurrentQuestion   = 0;
            mScore             = 0;
            mMaxQuestions      = w1.HowMany;
            mCurrentCollection = mMainCollection.RandomizeCollection(mMaxQuestions);
            LoadQuestion();
        }
コード例 #22
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public QuestionCollection GetAllQuestions()
        {
            try
            {
                QuestionCollection collection = new QuestionCollection();

                using (IDataReader dr = Database.ExecuteReader("UspGetAllQuestions", CommandType.StoredProcedure))
                {
                    while (dr.Read())
                    {
                        Question question = Populate(dr);

                        collection.Add(question);
                    }
                }

                return(collection);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #23
0
    public void PresentQuestion(Text category)
    {
        if (category.text != players[currentPlayer].specialCategory && listSpecialCategories.Contains(category.text))
        {
            pointsMultiplier = 2;
        }
        else
        {
            pointsMultiplier = 1;
        }

        uiController.UpdatePointsToScore(pointsMultiplier);

        questionCollection = gameObject.GetComponent <QuestionCollection>();

        if (category.text == "Surprise")
        {
            category.text = PickASpecialCategory();
        }

        currentQuestion = questionCollection.GetUnaskedQuestion(category.text);

        uiController.SetupUIForQuestion(category, currentQuestion);
    }
コード例 #24
0
        private void ExecuteNewQuestionCommand(Object parameter)
        {
            var view = new TecherFormAddAndEditQuestions();
            var vm   = new AddEditQuestionViewModel();

            vm.Question      = new Question();
            vm.IsNewQuestion = true;
            vm.Window        = view;
            view.DataContext = vm;

            var result = view.ShowDialog();

            if (result.HasValue && result.Value)
            {
                vm.Question.Answers = new List <Answer>(vm.AnswerCollection);
                var questionid = DBDataSource.AddNewQuestion(vm.Question, NavigationHelper.CurrrentTest.Id);
                if (questionid > 0)
                {
                    //Добавление вопроса в UI
                    vm.Question.Id = questionid;
                    QuestionCollection.Add(vm.Question);
                }
            }
        }
コード例 #25
0
 private void Start()
 {
     questionCollection = FindObjectOfType <QuestionCollection>();
     panelController    = FindObjectOfType <PanelController>();
 }
コード例 #26
0
ファイル: Test.cs プロジェクト: moskalenco-a/TestApp
 public Test(QuestionCollection collection)
 {
     this.collection = collection;
     correct         = Enumerable.Repeat(false, collection.Count).ToList();
     current         = 0;
 }
コード例 #27
0
ファイル: QuizController.cs プロジェクト: brandonLaing/Mobile
 private void Awake()
 {
     qC           = FindObjectOfType <QuestionCollection>();
     uiController = FindObjectOfType <UIController>();
 }
コード例 #28
0
        private void nextBtn_Click(object sender, EventArgs e)
        {
            // Clear and Reset
            this.Controls.Clear();
            InitializeComponent();
            Form1_Load_1(e, e);

            // hide welcomeNote
            welcomeNote.Visible = false;

            // display Score
            scoreLbl.Visible  = true;
            scoreLbl.Text     = "Score: " + totalScore.ToString();
            scoreLbl.Location = new Point(600, 10);

            textQuestion.Visible = true;
            quizNum.Visible      = true;

            // Read JSON file
            string             compitencyQuiz = File.ReadAllText(@"Compitency.json");
            QuestionCollection quesCollection = JsonConvert.DeserializeObject <QuestionCollection>(compitencyQuiz);

            totalQuestion = quesCollection.Questions.Count;

            // check if last question
            if (idx < totalQuestion)
            {
                // display question number
                quizNum.Text     = "Question " + questionNumber.ToString();
                quizNum.Location = new Point(30, 10);
                quizNum.Padding  = new Padding(0, 0, 0, 0);
                questionNumber++;

                // display question
                textQuestion.Text        = quesCollection.Questions[idx].Quiz.ToString();
                textQuestion.Location    = new Point(30, 45);
                textQuestion.MaximumSize = new Size(600, 100);
                textQuestion.Padding     = new Padding(0, 0, 0, 10);

                // display answer
                var answer = quesCollection.Questions[idx].Answer;

                // Create Dynamic Answers/Button
                // place dynamic button
                btn = new RadioButton[answer.Count];
                int i   = 0; // initialize button index
                int top = textQuestion.Location.Y + textQuestion.Height + 10;
                foreach (KeyValuePair <string, bool> item in answer)
                {
                    btn[i]             = new RadioButton();
                    btn[i].Name        = "ans" + i.ToString();
                    btn[i].Font        = new Font("ab", 10);
                    btn[i].Text        = item.Key + Environment.NewLine;
                    btn[i].AutoSize    = true;
                    btn[i].MaximumSize = new Size(600, 400);
                    btn[i].Location    = new Point(60, top);
                    btn[i].FlatStyle   = FlatStyle.Flat;
                    this.Controls.Add(btn[i]);
                    btn[i].Click += new EventHandler(this.button_click);
                    top          += btn[i].Height + 10;

                    // get correct answer button name
                    if (item.Value)
                    {
                        result = btn[i].Name;
                    }
                    // increase button index
                    i += 1;
                }
                // place label
                infoLbl.Location = new Point(60, top + 10);

                // Dynamic placement of Button NEXT
                nextBtn.Location = new Point(this.Width / 2, this.Height - 56);

                // Reset answer Choice
                ansChoice = 0;

                // next question
                idx += 1;
            }
            else
            {
                // if last question
                afterLastQuestion(totalScore, totalQuestion, e);
            }
        }
コード例 #29
0
            protected override ActionResult DoTask(string data)
            {
                string sign = Request.QueryString["sign"];
                string condition = PageQuestionTaskUtility.ParseExpVal(sign, data);

                QuestionCollection collection = new QuestionCollection();
                collection.PageSize = 8;
                collection.AbsolutePage = 1;
                collection.IsReturnDataTable = true;
                collection.FillByCondition(condition);

                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable()));
                response.Append(string.Format("TmpStr={0};", collection.PageCount));
                result.IsSuccess = true;
                result.ResponseData = response.ToString();
                return result;
            }
コード例 #30
0
            protected override ActionResult DoTask(string data)
            {
                QuestionLinkTypeEnum linkType = (QuestionLinkTypeEnum)int.Parse(Request.QueryString["style"]);
                int linkId = 0;
                string[] blocks = StringUtility.Split(data, "%22");
                for (int i = 0; i < blocks.Length; i++)
                {
                    string block = blocks[i];
                    string[] param = StringUtility.Split(block, "%27");
                    if (i == 0)
                    {
                        string shortDesc = Escape.JsUnEscape(param[0]);
                        int diff = int.Parse(Escape.JsUnEscape(param[2]));
                        string content = Escape.JsUnEscape(param[3]);
                        string attached = Escape.JsUnEscape(param[4]);

                        QuestionEntity linkEntity = new QuestionEntity();
                        linkEntity.QuestionLinkType = linkType;
                        linkEntity.QuestionLinkContent = content;
                        linkEntity.QuestionLinkDifficulty = diff;
                        linkEntity.QuestionLinkShortDescription = shortDesc;
                        linkEntity.QuestionLinkAttachedInfo = attached;
                        linkEntity.Save();
                        linkId = linkEntity.QuestionLinkId;
                    }
                    else
                    {
                        string shortDesc = Escape.JsUnEscape(param[0]);
                        int score = int.Parse(Escape.JsUnEscape(param[1]));
                        int diff = int.Parse(Escape.JsUnEscape(param[2]));
                        string content = Escape.JsUnEscape(param[3]);
                        string item = Escape.JsUnEscape(param[4]);
                        string answer = Escape.JsUnEscape(param[5]);
                        DefaultTypeEnum defaultType = (DefaultTypeEnum)int.Parse(Escape.JsUnEscape(param[6]));
                        if (score == 0)
                        {
                            DefaultEntity defaultEntity = new DefaultEntity();
                            defaultEntity.DefaultType = defaultType;
                            defaultEntity.Fill();
                            score = defaultEntity.DefaultScore;
                            if (score == 0)
                            {
                                switch (defaultType)
                                {
                                    case DefaultTypeEnum.SingleSelect:
                                        score = 2;
                                        break;
                                    case DefaultTypeEnum.MultiSelect:
                                        score = 4;
                                        break;
                                    case DefaultTypeEnum.JudgeSelect:
                                        score = 1;
                                        break;
                                }
                            }
                        }
                        QuestionEntity entity = new QuestionEntity();
                        entity.QuestionType = QuestionEntity.ConvertDefaultTypeToQuestionType(defaultType);
                        entity.QuestionLinkId = linkId;
                        entity.QuestionContent = content;
                        entity.QuestionDifficulty = diff;
                        entity.QuestionAnswer = answer;
                        entity.QuestionScore = score;
                        entity.QuestionShortDescription = shortDesc;
                        entity.QuestionItem = item;
                        entity.QuestionLinkType = QuestionLinkTypeEnum.Nothing;
                        entity.Save();
                    }
                }
                QuestionCollection collection = new QuestionCollection();
                collection.PageSize = 8;
                collection.AbsolutePage = 1;
                collection.IsReturnDataTable = true;
                collection.Fill();
                ActionResult result = new ActionResult();
                result.IsSuccess = true;
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable()));
                response.Append(string.Format("TmpStr={0};", collection.PageCount));
                result.ResponseData = response.ToString();
                return result;
            }
コード例 #31
0
            protected override ActionResult DoTask(string data)
            {
                int pageNo = Convert.ToInt32(Request.QueryString["pagenum"]);
                int linkId = Convert.ToInt32(Request.QueryString["subid"]);

                QuestionCollection collection = new QuestionCollection();
                if (pageNo == 0)
                {
                    collection.PageSize = 0;
                    collection.IsReturnDataTable = true;
                    collection.FillByLinkId(linkId);
                }
                else
                {
                    collection.PageSize = 4;
                    collection.FillByLinkId(linkId);
                    if (pageNo > collection.PageCount)
                        pageNo = collection.PageCount;
                    collection.AbsolutePage = pageNo;
                    collection.IsReturnDataTable = true;
                    collection.FillByLinkId(linkId);
                }
                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable(), this.IsOtherRequest));
                if (this.IsOtherRequest)
                    response.Append(string.Format("STmpStr={0};", collection.PageCount));
                else
                    response.Append(string.Format("TmpStr={0};", collection.PageCount));

                result.IsSuccess = true;
                result.ResponseData = response.ToString();
                return result;
            }
コード例 #32
0
            protected override ActionResult DoTask(string data)
            {
                string pageNoStr = Request.QueryString["pagenum"];
                int pageNo = 0;
                if (!int.TryParse(pageNoStr, out pageNo))
                    pageNo = 0;

                string condition = PageQuestionTaskUtility.ParseExpVal("0", "");
                QuestionCollection collection = new QuestionCollection();
                if (pageNo == 0)
                {
                    collection.PageSize = 0;
                    collection.IsReturnDataTable = true;
                    collection.FillByCondition(condition);
                }
                else
                {
                    collection.PageSize = 8;
                    collection.FillByCondition(condition);
                    if (pageNo > collection.PageCount)
                        pageNo = collection.PageCount;
                    collection.AbsolutePage = pageNo;
                    collection.IsReturnDataTable = true;
                    collection.FillByCondition(condition);
                }
                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable()));
                response.Append(string.Format("TmpStr={0};", collection.PageCount));
                result.IsSuccess = true;
                result.ResponseData = response.ToString();
                return result;
            }
コード例 #33
0
            protected override ActionResult DoTask(string data)
            {
                int pageNo = Convert.ToInt32(Request.QueryString["PageN"]);
                string linkStrIds = Request.QueryString["linkid"];
                int[] linkIds = StringUtility.SplitStringToIntArray(linkStrIds, ",");
                if (linkIds == null || linkIds.Length == 0)
                    linkIds = new int[] { -1 };
                string quesStrIds = Request.QueryString["quesid"];
                int[] quesIds = StringUtility.SplitStringToIntArray(quesStrIds, ",");
                if (quesIds == null || quesIds.Length == 0)
                    quesIds = new int[] { -1 };

                QuestionCollection collection = new QuestionCollection();
                collection.DeleteByQuestionIds(quesIds);
                collection.DeleteByLinkIds(linkIds);

                string condition = PageQuestionTaskUtility.CurrentExpVal();
                if (pageNo == 0)
                {
                    collection.PageSize = 0;
                    collection.IsReturnDataTable = true;
                    collection.FillByCondition(condition);
                }
                else
                {
                    collection.PageSize = 8;
                    collection.FillByCondition(condition);
                    if (pageNo > collection.PageCount)
                        pageNo = collection.PageCount;
                    collection.AbsolutePage = pageNo;
                    collection.IsReturnDataTable = true;
                    collection.FillByCondition(condition);
                }
                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable()));
                response.Append(string.Format("TmpStr={0};", collection.PageCount));
                result.IsSuccess = true;
                result.ResponseData = response.ToString();
                return result;
            }
コード例 #34
0
 private void Awake()
 {
     questionCollection = FindObjectOfType <QuestionCollection>();
     uiHelper           = FindObjectOfType <UIHelper>();
     player             = FindObjectOfType <Player>();
 }
コード例 #35
0
 protected void Page_Load(object sender, EventArgs e)
 {
     collection = new QuestionCollection();
     collection.PageSize = 8;
     collection.AbsolutePage = 1;
     collection.Fill();
     this.repQuestionList.DataSource = QuestionViewModelList;
     this.repQuestionList.DataBind();
 }
コード例 #36
0
 internal AnswerExtractionManager(QuestionCollection questions, ExtractionKnowledge knowledge, LinkBasedExtractor extractor)
 {
     _questions = questions;
     _knowledge = knowledge;
     _extractor = extractor;
 }
コード例 #37
0
ファイル: QueryQuestions.cs プロジェクト: dream-365/toolkit
        public async Task JsonDeserizeTest()
        {
            var collection = new QuestionCollection("uwp");

            var items = await collection.NavigateToPageAsync(1);
        }
コード例 #38
0
ファイル: Questionnaire.cs プロジェクト: Maharba/Asky
 public Questionnaire(QuestionCollection questions, string name = "None")
 {
     Name = name;
     Questions = questions;
 }
コード例 #39
0
            protected override ActionResult DoTask(string data)
            {
                int pageNo = Convert.ToInt32(Request.QueryString["pagenum"]);
                int linkId = Convert.ToInt32(Request.QueryString["subid"]);
                string delStrIds = Request.QueryString["ids"];

                string[] delStrIdCol = delStrIds.Split(',');
                List<int> delIds = new List<int>();
                foreach (string delStrId in delStrIdCol)
                {
                    string tmpDelIdStr = (delStrId ?? string.Empty).Trim();
                    if (string.IsNullOrEmpty(tmpDelIdStr))
                        continue;
                    else
                    {
                        int tmpDelId = 0;
                        if (int.TryParse(tmpDelIdStr, out tmpDelId))
                            delIds.Add(tmpDelId);
                        else
                            continue;
                    }
                }

                QuestionCollection collection = new QuestionCollection();
                collection.DeleteByQuestionIds(delIds.ToArray());

                collection.PageSize = 4;
                collection.FillByLinkId(linkId);
                if (pageNo > collection.PageCount)
                    pageNo = collection.PageCount;
                collection.AbsolutePage = pageNo;
                collection.IsReturnDataTable = true;
                collection.FillByLinkId(linkId);

                ActionResult result = new ActionResult();
                StringBuilder response = new StringBuilder();
                response.Append(ActionTaskUtility.ReturnClientDataArray(collection.GetFillDataTable()));
                response.Append(string.Format("TmpStr={0};", collection.PageCount));
                result.IsSuccess = true;
                result.ResponseData = response.ToString();
                return result;
            }