Esempio n. 1
0
 public EditModel(IQuestionData questionData, IHtmlHelper htmlHelper)
 {
     this.questionData = questionData;
     this.htmlHelper   = htmlHelper;
 }
Esempio n. 2
0
 public GameController(IQuestionData questionData)
 {
     _questionData = questionData;
 }
Esempio n. 3
0
 public DeleteModel(IQuestionData questionData)
 {
     this.questionData = questionData;
 }
Esempio n. 4
0
        private static async Task SendRequest(HttpClient client, IQuestionData questionData, int limit, TraceWriter log)
        {
            string url = GetEnvironmentVariable("Url");

            url += limit;

            log.Info("Sending a request to " + url);
            string             xml  = "";
            string             json = null;
            QuestionCollection data = null;

            try
            {
                xml = await client.GetStringAsync(url);
            }
            catch (Exception ex)
            {
                log.Error("Exception has been thrown when sending a put request", ex);
                return;
            }

            XmlDocument doc = new XmlDocument();

            try
            {
                doc.LoadXml(xml);
            }
            catch (Exception ex)
            {
                log.Error("Exception has been thrown when parsing xml into XDocument", ex);
                return;
            }

            try
            {
                json = JsonConvert.SerializeXmlNode(doc.LastChild, Newtonsoft.Json.Formatting.None, true);
            }
            catch (Exception ex)
            {
                log.Error("Exception has been thrown when parsing xml into json string", ex);
                return;
            }

            try
            {
                data = JsonConvert.DeserializeObject <QuestionCollection>(json);
            }
            catch (Exception ex)
            {
                log.Error("Exception has been thrown when deserializing json string", ex);
                return;
            }

            Parallel.ForEach(data.Questions, question =>
            {
                try
                {
                    questionData.InsertOrUpdateQuestion(question);
                }
                catch (Exception ex)
                {
                    log.Error("Exception has been thrown when inserting a question", ex);
                }
            });
        }
Esempio n. 5
0
 public HomeController(ILogger <HomeController> logger, IPlayerData playerData, IQuestionData questionData)
 {
     _logger       = logger;
     _playerData   = playerData;
     _questionData = questionData;
 }
Esempio n. 6
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            splitContainer1.Panel2.Controls.Clear();
            splitContainer2.Panel2.Controls.Clear();
            int          i    = comboBox1.SelectedIndex;
            TypeQuestion type = (TypeQuestion)i;

            switch (type)
            {
            case TypeQuestion.ChroniceSequence:
                PanelChronice p9 = new PanelChronice();
                p9.Dock = DockStyle.Fill;
                p9.OnChangedProperty += OnChangedProperty;
                splitContainer2.Panel2.Controls.Add(p9);
                _questionPanel = p9;
                break;

            case TypeQuestion.Compare:
                PanelCompare p1 = new PanelCompare();
                p1.Dock = DockStyle.Fill;
                p1.OnChangedProperty += OnChangedProperty;
                splitContainer2.Panel2.Controls.Add(p1);
                _questionPanel = p1;
                break;

            case TypeQuestion.FullAnswer:
                PanelFullAnswer p2 = new PanelFullAnswer();
                p2.Dock = DockStyle.Fill;
                p2.OnChangedProperty += OnChangedProperty;
                splitContainer2.Panel2.Controls.Add(p2);
                _questionPanel = p2;
                break;

            case TypeQuestion.Graphic:
                PanelGraphic p3 = new PanelGraphic();
                p3.Dock = DockStyle.Fill;
                p3.OnChangedProperty += OnChangedProperty;
                splitContainer2.Panel2.Controls.Add(p3);
                _questionPanel = p3;
                break;

            case TypeQuestion.InsertWords:
                PanelInsertWord p4 = new PanelInsertWord();
                p4.Dock = DockStyle.Fill;
                p4.OnChangedProperty += OnChangedProperty;
                splitContainer2.Panel2.Controls.Add(p4);
                _questionPanel = p4;
                break;

            case TypeQuestion.LogicRelation:
                PanelLogicRelation p5 = new PanelLogicRelation();
                p5.Dock = DockStyle.Fill;
                p5.OnChangedProperty += OnChangedProperty;
                splitContainer2.Panel2.Controls.Add(p5);
                _questionPanel = p5;
                break;

            case TypeQuestion.Matching:
                PanelMatching p6 = new PanelMatching();
                p6.Dock = DockStyle.Fill;
                p6.OnChangedProperty += OnChangedProperty;
                splitContainer2.Panel2.Controls.Add(p6);
                _questionPanel = p6;
                break;

            case TypeQuestion.MoreOneVariant:
                PanelOneVariant p7 = new PanelOneVariant();
                p7.Dock = DockStyle.Fill;
                p7.OnChangedProperty += OnChangedProperty;
                splitContainer2.Panel2.Controls.Add(p7);
                _questionPanel = p7;
                break;

            case TypeQuestion.OneVariant:
                PanelOneVariant p = new PanelOneVariant();
                p.OnChangedProperty += OnChangedProperty;
                p.Dock = DockStyle.Fill;
                splitContainer2.Panel2.Controls.Add(p);
                _questionPanel = p;
                break;

            case TypeQuestion.Selection:
                PanelSelection p8 = new PanelSelection();
                p8.Dock = DockStyle.Fill;
                p8.OnChangedProperty += OnChangedProperty;
                splitContainer2.Panel2.Controls.Add(p8);
                _questionPanel = p8;
                break;
            }
            _uc = lo[type];
            splitContainer1.Panel2.Controls.Add(_uc);
            splitContainer1.Panel2.Invalidate();
            splitContainer2.Panel2.Invalidate();
        }
Esempio n. 7
0
 public QuestionDialog()
 {
     _questionData = new QuestionDataSql();
 }
Esempio n. 8
0
 public DetailModel(IQuestionData QuestionData)
 {
     this.QuestionData = QuestionData;
 }
Esempio n. 9
0
 public TestDetailModel(IApTestData apTestData, IQuestionData questionData)
 {
     this.apTestData   = apTestData;
     this.questionData = questionData;
 }
Esempio n. 10
0
 public ListModel(IQuestionData QuestionData)
 {
     this.QuestionData = QuestionData;
 }