コード例 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            string time = timetest.Text;

            string[] values   = time.Split(':');
            TimeSpan timeSpan = new TimeSpan(Convert.ToInt32(values[0]), Convert.ToInt32(values[1]), 0);

            informsysEntities     context = new informsysEntities();
            JsonSerializerOptions jso     = new JsonSerializerOptions();

            jso.Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping;

            json = JsonSerializer.Serialize <Test>(test, jso);

            AllForTests allForTests = new AllForTests();

            allForTests.QuestAnswerTrueAnswer = json;
            allForTests.TestTopic             = testtopic.Text;


            allForTests.TestTime   = timeSpan;
            allForTests.TestScores = Convert.ToInt32(scorestest.Text);

            context.AllForTests.Add(allForTests);
            context.SaveChanges();

            MessageBox.Show(json);

            ClearPanel(tabPage1);
        }
コード例 #2
0
ファイル: FinalTests.cs プロジェクト: amoremore/inform_system
        private AllForTests Loadingtest()
        {
            informsysEntities context     = new informsysEntities();
            AllForTests       allForTests = context.AllForTests.Find(ListsTests.Selectedtest);

            return(allForTests);
        }
コード例 #3
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 6)
            {
                informsysEntities context     = new informsysEntities();
                AllForTests       allForTests = context.AllForTests.Find(dateGridViewAllfortests.Rows[e.RowIndex].Cells[0].Value);
                context.AllForTests.Remove(allForTests);
                context.SaveChanges();

                this.allForTestsTableAdapter.Fill(this.informsysDataSet1.AllForTests);
            }
        }
コード例 #4
0
ファイル: FinalTests.cs プロジェクト: amoremore/inform_system
        private void FinalTests_Load(object sender, EventArgs e)
        {
            AllForTests allForTests = Loadingtest();

            testtopic = allForTests.TestTopic;


            Test test = new Test();

            datejson = allForTests.QuestAnswerTrueAnswer;


            test = JsonSerializer.Deserialize <Test>(datejson);

            count = test.setQuestions.Count;

            balls = allForTests.TestScores;

            ballfortrueanswer = balls / count;


            time = Convert.ToString(allForTests.TestTime);



            string[] timetest = time.Split(':');
            timeSpan    = new TimeSpan(Convert.ToInt32(timetest[0]), Convert.ToInt32(timetest[1]), Convert.ToInt32(timetest[2]));
            alltime     = timeSpan;
            label1.Text = timeSpan.ToString("hh\\:mm\\:ss");
            timer1.Start();


            Array.Resize(ref qust, qust.Length + 1);

            quest.Items.Add(test.setQuestions[qust.Length - 1].question);

            otvet1.Text = test.setQuestions[qust.Length - 1].answer[0];
            otvet2.Text = test.setQuestions[qust.Length - 1].answer[1];
            if (test.setQuestions[qust.Length - 1].answer[2] != null && test.setQuestions[qust.Length - 1].answer[3] != null)
            {
                otvet3.Text = test.setQuestions[qust.Length - 1].answer[2];
                otvet4.Text = test.setQuestions[qust.Length - 1].answer[3];
            }
            else if (test.setQuestions[qust.Length - 1].answer[2] != null)
            {
                otvet3.Text = test.setQuestions[qust.Length - 1].answer[2];
            }
            else
            {
                otvet3.Visible = false;
                otvet4.Visible = false;
            }
        }