partial void Deleteresult(result instance);
 partial void Insertresult(result instance);
 partial void Updateresult(result instance);
Example #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            int count = 0;

            if (TestGoInfo.lvl.Replace(" ", "") == "Легкий")
            {
                sort1();
                for (int i = 0; i < dataGridView2.RowCount; i++)
                {
                    if (Convert.ToInt32(dataGridView2.Rows[i].Cells[3].Value) == Convert.ToInt32(dataGridView2.Rows[i].Cells[1].Value))
                    {
                        count++;
                        dataGridView2.Rows[i].Cells[2].Style.BackColor = System.Drawing.Color.Lime;
                    }
                    else
                    {
                        dataGridView2.Rows[i].Cells[2].Style.BackColor = System.Drawing.Color.Red;
                    }
                }
            }

            if (TestGoInfo.lvl.Replace(" ", "") == "Середній")
            {
                sort2();
                for (int i = 0; i < dataGridView2.RowCount; i++)
                {
                    if (dataGridView2.Rows[i].Cells[1].Value.ToString().Replace(" ", "") != "")
                    {
                        if (Convert.ToInt32(dataGridView2.Rows[i].Cells[6].Value) == Convert.ToInt32(dataGridView2.Rows[i].Cells[1].Value))
                        {
                            count++;
                            dataGridView2.Rows[i].Cells[2].Style.BackColor = System.Drawing.Color.Lime;
                        }
                        else
                        {
                            dataGridView2.Rows[i].Cells[2].Style.BackColor = System.Drawing.Color.Red;
                        }
                    }
                    else
                    {
                        dataGridView2.Rows[i].Cells[2].Style.BackColor = System.Drawing.Color.Red;
                    }
                }
                for (int i = 0; i < dataGridView2.RowCount; i++)
                {
                    if (dataGridView2.Rows[i].Cells[3].Value.ToString().Replace(" ", "") != "")
                    {
                        if (Convert.ToInt32(dataGridView2.Rows[i].Cells[4].Value) == Convert.ToInt32(dataGridView2.Rows[i].Cells[0].Value))
                        {
                            count++;
                            dataGridView2.Rows[i].Cells[3].Style.BackColor = System.Drawing.Color.Lime;
                        }
                        else
                        {
                            dataGridView2.Rows[i].Cells[3].Style.BackColor = System.Drawing.Color.Red;
                        }
                    }
                }
            }



            int point = Convert.ToInt32(100 / dataGridView1.RowCount * count);

            MessageBox.Show("Набрано" + count.ToString() + "/" + dataGridView1.RowCount.ToString() + "балів(" + point + "%)", "Результат");
            dataGridView1.Enabled = false;
            dataGridView2.Enabled = false;
            button2.Enabled       = false;

            db = new linqDataContext();
            result pinfo = new result();

            pinfo.id_user  = user.id_user;
            pinfo.id_test  = TestGoInfo.id;
            pinfo.point    = point;
            pinfo.datatime = DateTime.Now.ToString();

            db.result.InsertOnSubmit(pinfo);
            db.SubmitChanges();
            var fr = new TruTest();

            fr.Show();
        }