Exemple #1
0
        private void updateAccNum()
        {
            string sql;

            sql = "select * from Users where name = '" + SystemConfig.name + "'";
            SqlDataReader reader = DatabaseHelp.getReader(sql);

            reader.Read();
            SystemConfig.acc          = DatabaseHelp.convert(SystemConfig.acc, reader["acc"]);
            SystemConfig.question_num = DatabaseHelp.convert(SystemConfig.question_num, reader["question_num"]);
            reader.Close();
            right_label.Text = "      平均正确率:" + SystemConfig.acc.ToString("f2");
            count_label.Text = "累计练习题目数量:" + SystemConfig.question_num.ToString();
        }
Exemple #2
0
        private void setup()
        {
            double time = SystemConfig.time;

            label1.Text      = "你好! " + SystemConfig.name;
            study_label.Text = "    累计学习时间:" + ((int)time).ToString() + "h";
            if ((int)((time - (int)time) * 60) != 0)
            {
                study_label.Text += ((int)((time - (int)time) * 60)).ToString() + "m";
            }
            right_label.Text        = "      平均正确率:" + SystemConfig.acc.ToString("f2");
            count_label.Text        = "累计练习题目数量:" + SystemConfig.question_num.ToString();
            SystemConfig.start_time = Timer();
            if (SystemConfig.name == "admin")
            {
                button1.Visible = false;
                button2.Visible = false;
                button3.Visible = false;
                label5.Text     = "意见反馈列表";
                listBox1.Items.Clear();
                string        sql    = "select * from (select *,ROW_NUMBER() over(order by date) as num from UserSuggestion) as x where num < 15";
                SqlDataReader reader = DatabaseHelp.getReader(sql);
                while (reader.Read())
                {
                    listBox1.Items.Add(reader["name"].ToString().Trim() + ":" + reader["title"]);
                }
                reader.Close();
            }
            else
            {
                listBox1.Items.Clear();
                string sql = "select * from ReadingQuestion inner join (select id,ReadingAns.date from ReadingAns where (name = '";
                sql += SystemConfig.name + "'and ReadingAns.date in (select max(date) as date from ReadingAns where name = '";
                sql += SystemConfig.name;
                sql += "' and correct = 0 group by id))) as xx on ReadingQuestion.id = xx.id order by date desc";
                SqlDataReader reader = DatabaseHelp.getReader(sql);
                errid = new int[15];
                for (int i = 0; i < 15; i++)
                {
                    if (!reader.Read())
                    {
                        break;
                    }
                    listBox1.Items.Add(reader["type"] + ":" + reader["stem"]);
                    errid[i] = Convert.ToInt32(reader["id"]);
                }
                reader.Close();
            }
        }
Exemple #3
0
        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)//综合写作
        {
            string sql = "SELECT * FROM[dbo].[ComWritingProblem] WHERE subject='" + comboBox3.SelectedItem + "'";

            listView3.Items.Clear();
            SqlDataReader reader = DatabaseHelp.getReader(sql);
            int           i      = 0;

            while (reader.Read())
            {
                listView3.Items.Add(new ListViewItem(new string[] { (i + 1).ToString(), DatabaseHelp.convert("", reader["setid"].ToString()) }));
                i++;
            }
            reader.Close();
        }
Exemple #4
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string sql = "SELECT * FROM[dbo].[ReadingArticle] WHERE subject='" + comboBox1.SelectedItem + "'";

            listView1.Items.Clear();
            SqlDataReader reader = DatabaseHelp.getReader(sql);
            int           i      = 0;

            while (reader.Read())
            {
                listView1.Items.Add(new ListViewItem(new string[] { (i + 1).ToString(), DatabaseHelp.convert("", reader["setid"].ToString()), DatabaseHelp.convert("", reader["title"]) }));
                i++;
            }
            reader.Close();
        }
Exemple #5
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            string sql = "SELECT * FROM[dbo].[ReadingQuestion] WHERE type='" + comboBox2.SelectedItem + "'";

            listView2.Items.Clear();
            SqlDataReader reader = DatabaseHelp.getReader(sql);
            int           i      = 0;

            while (reader.Read())
            {
                listView2.Items.Add(new ListViewItem(new string[] { (i + 1).ToString(), DatabaseHelp.convert("", reader["num"].ToString()), DatabaseHelp.convert("", reader["stem"]), reader["id"].ToString() }));
                i++;
            }
            reader.Close();
        }
Exemple #6
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count != 1)
            {
                return;
            }
            string        title  = listView1.SelectedItems[0].SubItems[2].Text;
            string        sql    = "select [id] from [dbo].[ReadingArticle] where title='" + title + "'";
            SqlDataReader reader = DatabaseHelp.getReader(sql);

            reader.Read();
            int x = DatabaseHelp.convert(1, reader["id"]);

            reader.Close();
            reading rd = new reading(1, x);

            rd.ShowDialog();
        }
Exemple #7
0
        private void reading_Click(object sender, EventArgs e)
        {
            int artnumber = Convert.ToInt32((sender as Button).Name.Replace("button", ""));

            string name = "reading" + artnumber.ToString();
            string sql  = "select " + name + " from [dbo].[TestSet] where id=" + this.tpoNo.ToString();

            SqlDataReader reader = DatabaseHelp.getReader(sql);

            reader.Read();
            int x = DatabaseHelp.convert(1, reader[name]);

            reader.Close();

            reading read_form = new reading(1, x);

            read_form.ShowDialog();
        }
Exemple #8
0
        private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int index = this.listBox1.IndexFromPoint(e.Location);

            if (index == System.Windows.Forms.ListBox.NoMatches)
            {
                return;
            }
            if (SystemConfig.name == "admin")
            {
                string[] item;
                item = listBox1.Items[index].ToString().Split(':');
                string name  = item[0];
                string title = "";
                for (int i = 1; i < item.Length; i++)
                {
                    title += item[i];
                }
                string        sql    = "select * from UserSuggestion where name = '" + name + "' and title = '" + title + "'";
                SqlDataReader reader = DatabaseHelp.getReader(sql);
                while (reader.Read())
                {
                    feedbackAdmin fd     = new feedbackAdmin(reader["title"].ToString(), reader["name"].ToString(), reader["suggest"].ToString(), reader["date"].ToString());
                    DialogResult  result = fd.ShowDialog();
                    if (result == DialogResult.No)
                    {
                        reader.Close();
                        return;
                    }
                }
                reader.Close();
                sql = "delete from UserSuggestion where name = '" + name + "' and title = '" + title + "'";
                DatabaseHelp.executeCommand(sql);
                setup();
            }
            else
            {
                //链接到reading界面
                reading rd = new reading(3, errid[index]);
                rd.ShowDialog();
            }
        }
Exemple #9
0
 private void write_Load(object sender, EventArgs e)
 {
     if (this.model == 1)
     {
         string        sql    = "select * from IndWritingProblem where setid = " + tpo.ToString();
         SqlDataReader reader = DatabaseHelp.getReader(sql);
         reader.Read();
         label1.Text = ProString("题目:\n" + reader["stem"], 25);
         reader.Close();
     }
     else if (this.model == 2)
     {
         string        sql    = "select * from ComWritingProblem where setid = " + tpo.ToString();
         SqlDataReader reader = DatabaseHelp.getReader(sql);
         reader.Read();
         label1.Text = ProString("题目:\n" + reader["stem"], 25)
                       + ProString("\n\n阅读材料:\n\n" + reader["redmaterial"], 25)
                       + ProString("\n\n听力材料:\n\n" + reader["lismaterial"], 25);
         reader.Close();
     }
 }
Exemple #10
0
        private void setupTPO()
        {
            string sql;

            sql = "select id from [dbo].Testset";
            SqlDataReader reader = DatabaseHelp.getReader(sql);

            Button newButton;

            while (reader.Read())
            {
                newButton = new Button();
                panel1.Controls.Add(newButton);
                newButton.Name = "tpo_button" + reader["id"];
                int row = ((int)reader["id"] - 1) / 3;
                if ((int)reader["id"] % 3 == 1) //第一列 41
                {
                    newButton.Location = new Point(30, 9 + 110 * row);
                }
                else if ((int)reader["id"] % 3 == 2) //265
                {
                    newButton.Location = new Point(220, 9 + 110 * row);
                }
                else //503
                {
                    newButton.Location = new Point(410, 9 + 110 * row);
                }
                newButton.Margin = new Padding(2, 2, 2, 2);
                newButton.Size   = new Size(146, 61);
                newButton.Text   = "tpo" + reader["id"];
                newButton.UseVisualStyleBackColor = true;
                newButton.Click += new System.EventHandler(this.tpo_Click);

                newButton.Tag = newButton.Width + ":" + newButton.Height + ":" + newButton.Left + ":" + newButton.Top + ":" + newButton.Font.Size;
            }
            reader.Close();
        }
Exemple #11
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (SystemConfig.name == "admin")
            {
                SystemConfig.authority       = true;
                this.panel1.ContextMenuStrip = this.contextMenuStrip1;
            }
            else
            {
                SystemConfig.authority = false;
            }

            string        sql    = "SELECT [subject] FROM[dbo].[ReadingArticleSubject]";
            SqlDataReader reader = DatabaseHelp.getReader(sql);

            while (reader.Read())
            {
                comboBox1.Items.Add(reader["subject"]);
            }
            reader.Close();

            sql    = "SELECT [subject]  FROM[dbo].[ComWritingSubject]";
            reader = DatabaseHelp.getReader(sql);
            while (reader.Read())
            {
                comboBox3.Items.Add(reader["subject"]);
            }
            reader.Close();

            sql    = "SELECT [subject]  FROM[dbo].[IndWritingSubject]";
            reader = DatabaseHelp.getReader(sql);
            while (reader.Read())
            {
                comboBox4.Items.Add(reader["subject"]);
            }
            reader.Close();
        }
Exemple #12
0
        //确定事件
        private void button1_Click(object sender, EventArgs e)
        {
            string sql    = "SELECT * FROM [dbo].[Users] WHERE name='" + textBox1.Text + "' AND password='******'";
            int    result = DatabaseHelp.SelectNum(sql);

            if (result != 0)
            {
                SystemConfig.name = textBox1.Text;
                SqlDataReader reader = DatabaseHelp.getReader(sql);
                reader.Read();
                SystemConfig.name         = DatabaseHelp.convert(SystemConfig.name, reader["name"]).Trim();
                SystemConfig.password     = DatabaseHelp.convert(SystemConfig.password, reader["password"]).Trim();
                SystemConfig.email        = DatabaseHelp.convert(SystemConfig.email, reader["email"]).Trim();
                SystemConfig.acc          = DatabaseHelp.convert(SystemConfig.acc, reader["acc"]);
                SystemConfig.time         = DatabaseHelp.convert(SystemConfig.time, reader["time"]);
                SystemConfig.question_num = DatabaseHelp.convert(SystemConfig.question_num, reader["question_num"]);
                reader.Close();
                DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("用户名或密码不对");
            }
        }
Exemple #13
0
        void init()
        {
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 20; j++)
                {
                    for (int k = 0; k < 12; k++)
                    {
                        Readtext[i, j, k] = "";
                    }
                }
            }
            for (int i = 0; i < 4; i++)
            {
                comWritetext[i] = "";
            }
            for (int i = 0; i < 3; i++)
            {
                indWritetext[i] = "";
            }
            string        sql    = "select * from ReadingQuestionType";
            SqlDataReader reader = DatabaseHelp.getReader(sql);

            while (reader.Read())
            {
                comboBox1.Items.Add(reader["type"]);
            }
            reader.Close();
            sql    = "select * from ReadingArticleSubject";
            reader = DatabaseHelp.getReader(sql);
            while (reader.Read())
            {
                comboBox2.Items.Add(reader["subject"]);
            }
            reader.Close();
        }
Exemple #14
0
        private void load4model2()
        {
            int i, j, k;

            this.Hide();//先藏起来,悄咪咪的load数据

            string sql    = "SELECT [id],[reading1],[reading2],[reading3] FROM[dbo].[TestSet] WHERE id=" + this.tponum.ToString();
            int    result = DatabaseHelp.SelectNum(sql);

            if (result == 0)
            {
                MessageBox.Show("本套tpo尚未导入,敬请期待");
                DialogResult = DialogResult.Cancel;
                this.Show();
                return;
            }
            //找到了这套题的信息,录入阅读文章号。

            SqlDataReader reader = DatabaseHelp.getReader(sql);

            reader.Read();
            this.artinum[0] = DatabaseHelp.convert(this.artinum[0], reader["reading1"]);
            this.artinum[1] = DatabaseHelp.convert(this.artinum[1], reader["reading2"]);
            this.artinum[2] = DatabaseHelp.convert(this.artinum[2], reader["reading3"]);
            reader.Close();

            for (i = 0; i < 3; i++)//分别录入每篇文章的信息到artis
            {
                sql    = "SELECT * FROM [dbo].[ReadingArticle] WHERE id = " + this.artinum[i].ToString();
                reader = DatabaseHelp.getReader(sql);
                reader.Read();
                this.artis[i]             = new article();
                this.artis[i].title       = DatabaseHelp.convert(this.artis[i].title, reader["title"]);
                this.artis[i].content     = DatabaseHelp.convert(this.artis[i].content, reader["article"]);
                this.artis[i].questionnum = DatabaseHelp.convert(this.artis[i].questionnum, reader["questionno"]);
                this.artis[i].questionIds = new int[this.artis[i].questionnum];
                for (j = 0; j < this.artis[i].questionnum; j++)
                {
                    this.artis[i].questionIds[j] = DatabaseHelp.convert(this.artis[i].questionIds[j], reader["questionid" + (j + 1).ToString()]);
                }
                this.artis[i].average = DatabaseHelp.convert(this.artis[i].average, reader["average"]);
                reader.Close();
            }
            this.allrqnum       = this.artis[0].questionnum + this.artis[1].questionnum + this.artis[2].questionnum;
            this.rq             = new readingQuestion[this.allrqnum];
            this.studentAnswers = new string[this.allrqnum];
            i = 0;
            for (k = 0; k < 3; k++)
            {
                for (j = 0; j < this.artis[k].questionnum; j++)
                {
                    studentAnswers[i] = "";
                    sql    = "SELECT * FROM [dbo].[ReadingQuestion] WHERE id=" + this.artis[k].questionIds[j];
                    reader = DatabaseHelp.getReader(sql);
                    reader.Read();
                    this.rq[i]           = new readingQuestion();
                    this.rq[i].id        = this.artis[k].questionIds[j];
                    this.rq[i].articleid = DatabaseHelp.convert(this.rq[i].articleid, reader["articleid"]);

                    this.rq[i].num        = DatabaseHelp.convert(this.rq[i].num, reader["num"]);
                    this.rq[i].type       = DatabaseHelp.convert(this.rq[i].type, reader["type"]);
                    this.rq[i].stem       = DatabaseHelp.convert(this.rq[i].stem, reader["stem"]);
                    this.rq[i].opnum      = DatabaseHelp.convert(this.rq[i].opnum, reader["opnum"]);
                    this.rq[i].paragraph  = DatabaseHelp.convert(this.rq[i].paragraph, reader["paragraph"]);
                    this.rq[i].paragraph2 = DatabaseHelp.convert(this.rq[i].paragraph2, reader["paragraph2"]);
                    this.rq[i].optionx    = new string[this.rq[i].opnum];
                    for (int j1 = 0; j1 < this.rq[i].opnum; j1++)
                    {
                        this.rq[i].optionx[j1] = DatabaseHelp.convert(this.rq[i].optionx[j1], reader["option" + (j1 + 1).ToString()]);
                    }
                    this.rq[i].ans      = DatabaseHelp.convert(this.rq[i].ans, reader["ans"]);
                    this.rq[i].acc      = DatabaseHelp.convert(this.rq[i].acc, reader["acc"]);
                    this.rq[i].analysis = DatabaseHelp.convert(this.rq[i].analysis, reader["analysis"]);
                    reader.Close();
                    i++;
                }
            }

            //load第一篇文章。

            button3.Enabled = false;
            this.nownum     = 0;
            this.nowarti    = 0;
            this.nowartinum = 0;
            this.webBrowser1.DocumentText = "<span style='color: rgb(128, 128, 128); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: \"Helvetica Neue\", Helvetica, \"Hiragino Sans GB\", \"Microsoft YaHei\", Arial, sans-serif; font-size: 16px; font-style: normal; font-weight: 400; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'>"
                                            + "<p align=\"center\">" + artis[nowarti].title + "</p>" + "<p>" + artis[nowarti].content.Replace("\r\n", "</p><p>").Replace("\n", "</p><p>") + "</p></span>";
            load_left_ins();
            this.timer1.Enabled = true;
            this.leftTime       = TimeSpan.Parse("1:0:0");
            this.label1.Text    = this.leftTime.ToString();
            this.Show();
        }
Exemple #15
0
        private void reading_Load(object sender, EventArgs e)//对不同的模式,有不同的load函数
        {
            if (this.model == 1)
            {
                load4model1();
            }
            else if (this.model == 2)
            {
                load4model2();
            }
            else if (this.model == 3)
            {
                this.Hide();
                label1.Visible  = false;
                button1.Visible = false;
                button2.Visible = false;
                button4.Visible = false;
                button5.Visible = false;
                button3.Visible = false;
                button6.Text    = "查看解析";
                rq    = new readingQuestion[1];
                rq[0] = new readingQuestion();

                string        sql    = "SELECT * FROM [dbo].[ReadingQuestion] WHERE id=" + this.id.ToString();
                SqlDataReader reader = DatabaseHelp.getReader(sql);
                reader.Read();
                int i = 0;
                this.rq[i].id         = this.id;
                this.rq[i].articleid  = DatabaseHelp.convert(this.rq[i].articleid, reader["articleid"]);
                this.rq[i].num        = DatabaseHelp.convert(this.rq[i].num, reader["num"]);
                this.rq[i].type       = DatabaseHelp.convert(this.rq[i].type, reader["type"]);
                this.rq[i].stem       = DatabaseHelp.convert(this.rq[i].stem, reader["stem"]);
                this.rq[i].opnum      = DatabaseHelp.convert(this.rq[i].opnum, reader["opnum"]);
                this.rq[i].paragraph  = DatabaseHelp.convert(this.rq[i].paragraph, reader["paragraph"]);
                this.rq[i].paragraph2 = DatabaseHelp.convert(this.rq[i].paragraph2, reader["paragraph2"]);
                this.rq[i].optionx    = new string[this.rq[i].opnum];
                for (int j1 = 0; j1 < this.rq[i].opnum; j1++)
                {
                    this.rq[i].optionx[j1] = DatabaseHelp.convert(this.rq[i].optionx[j1], reader["option" + (j1 + 1).ToString()]);
                }
                this.rq[i].ans      = DatabaseHelp.convert(this.rq[i].ans, reader["ans"]);
                this.rq[i].acc      = DatabaseHelp.convert(this.rq[i].acc, reader["acc"]);
                this.rq[i].analysis = DatabaseHelp.convert(this.rq[i].analysis, reader["analysis"]);


                reader.Close();

                artis = new article[1];

                sql    = "SELECT * FROM [dbo].[ReadingArticle] WHERE id = " + this.rq[0].articleid.ToString();
                reader = DatabaseHelp.getReader(sql);
                reader.Read();
                this.artis[i]         = new article();
                this.artis[i].title   = DatabaseHelp.convert(this.artis[i].title, reader["title"]);
                this.artis[i].content = DatabaseHelp.convert(this.artis[i].content, reader["article"]);

                reader.Close();
                load_left_ins();
                this.webBrowser1.DocumentText = "<span style='color: rgb(128, 128, 128); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: \"Helvetica Neue\", Helvetica, \"Hiragino Sans GB\", \"Microsoft YaHei\", Arial, sans-serif; font-size: 16px; font-style: normal; font-weight: 400; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'>"
                                                + "<p align=\"center\">" + artis[0].title + "</p>" + "<p>" + artis[0].content.Replace("\r\n", "</p><p>").Replace("\n", "</p><p>") + "</p></span>";
                this.Show();
            }
        }
Exemple #16
0
        private void peer_check_Load(object sender, EventArgs e)
        {
            if (this.model == 1)
            {
                int    i;
                string sql = "SELECT[dbo].[ComWritingAns].id as id,";
                sql   += "[dbo].[ComWritingAns].date as date,";
                sql   += "[dbo].[ComWritingAns].name as name,";
                sql   += "[dbo].[ComWritingAns].ans as ans,";
                sql   += "[dbo].[ComWritingAns].score as score,";
                sql   += "[dbo].[ComWritingAns].comment as comment,";
                sql   += "[dbo].[ComWritingProblem].stem,";
                sql   += "[dbo].[ComWritingProblem].setid as tpoid,";
                sql   += "[dbo].[ComWritingProblem].lismaterial as lismaterial,";
                sql   += "[dbo].[ComWritingProblem].redmaterial as redmaterial ";
                sql   += "FROM[dbo].[ComWritingAns],[dbo].[ComWritingProblem] ";
                sql   += "where[dbo].[ComWritingAns].id=[dbo].[ComWritingProblem].id ";
                sql   += "and ISNULL([dbo].[ComWritingAns].score,-1)= -1 ";
                sql   += "and [dbo].[ComWritingAns].name!=\'" + SystemConfig.name + "\'";
                allcom = DatabaseHelp.SelectNum(sql);
                if (allcom > 0)
                {
                    wrt1 = new writing[allcom];
                    SqlDataReader reader = DatabaseHelp.getReader(sql);
                    for (i = 0; i < allcom; i++)
                    {
                        reader.Read();
                        wrt1[i]             = new writing();
                        wrt1[i].type        = 1;
                        wrt1[i].tpoid       = DatabaseHelp.convert(wrt1[i].tpoid, reader["tpoid"]);
                        wrt1[i].id          = DatabaseHelp.convert(wrt1[i].id, reader["id"]);
                        wrt1[i].date        = DatabaseHelp.convert(wrt1[i].date, reader["date"]);
                        wrt1[i].name        = DatabaseHelp.convert(wrt1[i].name, reader["name"]);
                        wrt1[i].ans         = DatabaseHelp.convert(wrt1[i].ans, reader["ans"]);
                        wrt1[i].stem        = DatabaseHelp.convert(wrt1[i].stem, reader["stem"]);
                        wrt1[i].lismaterial = DatabaseHelp.convert(wrt1[i].lismaterial, reader["lismaterial"]);
                        wrt1[i].redmaterial = DatabaseHelp.convert(wrt1[i].redmaterial, reader["redmaterial"]);
                    }
                    reader.Close();
                }
                sql    = "SELECT[dbo].[IndWritingAns].id as id,";
                sql   += "[dbo].[IndWritingAns].date as date,";
                sql   += "[dbo].[IndWritingAns].name as name,";
                sql   += "[dbo].[IndWritingAns].ans as ans,";
                sql   += "[dbo].[IndWritingAns].score as score,";
                sql   += "[dbo].[IndWritingAns].comment as comment,";
                sql   += "[dbo].[IndWritingProblem].stem,";
                sql   += "[dbo].[IndWritingProblem].setid as tpoid ";
                sql   += "FROM[dbo].[IndWritingAns],[dbo].[IndWritingProblem] ";
                sql   += "where[dbo].[IndWritingAns].id=[dbo].[IndWritingProblem].id ";
                sql   += "and ISNULL([dbo].[IndWritingAns].score,-1)= -1 ";
                sql   += "and [dbo].[IndWritingAns].name!=\'" + SystemConfig.name + "\'";
                allind = DatabaseHelp.SelectNum(sql);
                if (allind > 0)
                {
                    wrt2 = new writing[allind];
                    SqlDataReader reader = DatabaseHelp.getReader(sql);
                    for (i = 0; i < allind; i++)
                    {
                        reader.Read();
                        wrt2[i]       = new writing();
                        wrt2[i].type  = 1;
                        wrt2[i].tpoid = DatabaseHelp.convert(wrt2[i].tpoid, reader["tpoid"]);
                        wrt2[i].id    = DatabaseHelp.convert(wrt2[i].id, reader["id"]);
                        wrt2[i].date  = DatabaseHelp.convert(wrt2[i].date, reader["date"]);
                        wrt2[i].name  = DatabaseHelp.convert(wrt2[i].name, reader["name"]);
                        wrt2[i].ans   = DatabaseHelp.convert(wrt2[i].ans, reader["ans"]);
                        wrt2[i].stem  = DatabaseHelp.convert(wrt2[i].stem, reader["stem"]);
                    }
                    reader.Close();
                }
                for (i = 0; i < allcom; i++)
                {
                    listView1.Items.Add(new ListViewItem(new string[]
                                                         { (i + 1).ToString(),
                                                           wrt1[i].tpoid.ToString(),
                                                           this.wrt1[i].name,
                                                           "综合写作",
                                                           this.wrt1[i].date.ToString() }));
                }
                for (i = 0; i < allind; i++)
                {
                    listView1.Items.Add(new ListViewItem(new string[]
                                                         { (i + allcom + 1).ToString(),
                                                           wrt2[i].tpoid.ToString(),
                                                           this.wrt2[i].name,
                                                           "独立写作",
                                                           this.wrt2[i].date.ToString() }));
                }
            }

            else if (this.model == 2)
            {
                this.listView1.Clear();
                ColumnHeader header1 = new ColumnHeader();
                header1.Text = "序号";
                ColumnHeader header2 = new ColumnHeader();
                header2.Text = "TPO编号";
                ColumnHeader header3 = new ColumnHeader();
                header3.Text = "评价者";
                ColumnHeader header4 = new ColumnHeader();
                header4.Text = "类型";
                ColumnHeader header5 = new ColumnHeader();
                header5.Text = "日期";
                this.listView1.Columns.AddRange(new ColumnHeader[] { header1, header2, header3, header4, header5 });
                richTextBox1.ReadOnly = true;
                textBox1.ReadOnly     = true;
                button1.Text          = "重新评改";
                int    i;
                string sql = "SELECT[dbo].[ComWritingAns].id as id,";
                sql += "[dbo].[ComWritingAns].date as date,";
                sql += "[dbo].[ComWritingAns].comname as comname,";
                sql += "[dbo].[ComWritingAns].name as name,";
                sql += "[dbo].[ComWritingAns].ans as ans,";
                sql += "ISNULL([dbo].[ComWritingAns].score,-1) as score,";
                sql += "[dbo].[ComWritingAns].comment as comment,";
                sql += "[dbo].[ComWritingProblem].stem,";
                sql += "[dbo].[ComWritingProblem].setid as tpoid,";
                sql += "[dbo].[ComWritingProblem].lismaterial as lismaterial,";
                sql += "[dbo].[ComWritingProblem].redmaterial as redmaterial ";
                sql += "FROM[dbo].[ComWritingAns],[dbo].[ComWritingProblem] ";
                sql += "where[dbo].[ComWritingAns].id=[dbo].[ComWritingProblem].id ";
                // sql += "and ISNULL([dbo].[ComWritingAns].score,-1)!= -1 ";
                sql   += "and [dbo].[ComWritingAns].name=\'" + SystemConfig.name + "\'";
                allcom = DatabaseHelp.SelectNum(sql);
                if (allcom > 0)
                {
                    wrt1 = new writing[allcom];
                    SqlDataReader reader = DatabaseHelp.getReader(sql);
                    for (i = 0; i < allcom; i++)
                    {
                        reader.Read();
                        wrt1[i]             = new writing();
                        wrt1[i].type        = 1;
                        wrt1[i].tpoid       = DatabaseHelp.convert(wrt1[i].tpoid, reader["tpoid"]);
                        wrt1[i].id          = DatabaseHelp.convert(wrt1[i].id, reader["id"]);
                        wrt1[i].date        = DatabaseHelp.convert(wrt1[i].date, reader["date"]);
                        wrt1[i].name        = DatabaseHelp.convert(wrt1[i].name, reader["name"]);
                        wrt1[i].comname     = DatabaseHelp.convert(wrt1[i].name, reader["comname"]);
                        wrt1[i].ans         = DatabaseHelp.convert(wrt1[i].ans, reader["ans"]);
                        wrt1[i].stem        = DatabaseHelp.convert(wrt1[i].stem, reader["stem"]);
                        wrt1[i].lismaterial = DatabaseHelp.convert(wrt1[i].lismaterial, reader["lismaterial"]);
                        wrt1[i].redmaterial = DatabaseHelp.convert(wrt1[i].redmaterial, reader["redmaterial"]);
                        wrt1[i].score       = DatabaseHelp.convert(wrt1[i].score, reader["score"]);
                        wrt1[i].comment     = DatabaseHelp.convert(wrt1[i].comment, reader["comment"]);
                    }
                    reader.Close();
                }
                sql  = "SELECT[dbo].[IndWritingAns].id as id,";
                sql += "[dbo].[IndWritingAns].date as date,";
                sql += "[dbo].[IndWritingAns].comname as comname,";
                sql += "[dbo].[IndWritingAns].name as name,";
                sql += "[dbo].[IndWritingAns].ans as ans,";
                sql += "ISNULL([dbo].[IndWritingAns].score,-1) as score,";
                sql += "[dbo].[IndWritingAns].comment as comment,";
                sql += "[dbo].[IndWritingProblem].stem,";
                sql += "[dbo].[IndWritingProblem].setid as tpoid ";
                sql += "FROM[dbo].[IndWritingAns],[dbo].[IndWritingProblem] ";
                sql += "where[dbo].[IndWritingAns].id=[dbo].[IndWritingProblem].id ";
                // sql += "and ISNULL([dbo].[IndWritingAns].score,-1)!= -1 ";
                sql   += "and [dbo].[IndWritingAns].name=\'" + SystemConfig.name + "\'";
                allind = DatabaseHelp.SelectNum(sql);
                if (allind > 0)
                {
                    wrt2 = new writing[allind];
                    SqlDataReader reader = DatabaseHelp.getReader(sql);
                    for (i = 0; i < allind; i++)
                    {
                        reader.Read();
                        wrt2[i]         = new writing();
                        wrt2[i].type    = 1;
                        wrt2[i].tpoid   = DatabaseHelp.convert(wrt2[i].tpoid, reader["tpoid"]);
                        wrt2[i].id      = DatabaseHelp.convert(wrt2[i].id, reader["id"]);
                        wrt2[i].date    = DatabaseHelp.convert(wrt2[i].date, reader["date"]);
                        wrt2[i].name    = DatabaseHelp.convert(wrt2[i].name, reader["name"]);
                        wrt2[i].comname = DatabaseHelp.convert(wrt2[i].comname, reader["comname"]);
                        wrt2[i].ans     = DatabaseHelp.convert(wrt2[i].ans, reader["ans"]);
                        wrt2[i].stem    = DatabaseHelp.convert(wrt2[i].stem, reader["stem"]);
                        wrt2[i].score   = DatabaseHelp.convert(wrt2[i].score, reader["score"]);
                        wrt2[i].comment = DatabaseHelp.convert(wrt2[i].comment, reader["comment"]);
                    }
                    reader.Close();
                }
                for (i = 0; i < allcom; i++)
                {
                    listView1.Items.Add(new ListViewItem(new string[]
                                                         { (i + 1).ToString(),
                                                           wrt1[i].tpoid.ToString(),
                                                           this.wrt1[i].comname,
                                                           "综合写作",
                                                           this.wrt1[i].date.ToString() }));
                }
                for (i = 0; i < allind; i++)
                {
                    listView1.Items.Add(new ListViewItem(new string[]
                                                         { (i + allcom + 1).ToString(),
                                                           wrt2[i].tpoid.ToString(),
                                                           this.wrt2[i].comname,
                                                           "独立写作",
                                                           this.wrt2[i].date.ToString() }));
                }
            }
        }
Exemple #17
0
        private void load4model1()
        {
            this.Hide();//先藏起来,悄咪咪的load数据
            string sql = "SELECT * FROM [dbo].[ReadingArticle] WHERE id = " + this.artnumber.ToString();

            int result = DatabaseHelp.SelectNum(sql);

            if (result == 0)
            {
                MessageBox.Show("本篇阅读尚未导入,敬请期待!");
                DialogResult = DialogResult.Cancel;
                this.Show();
                return;
            }
            if (result != 0)//把数据存起来
            {
                SqlDataReader reader = DatabaseHelp.getReader(sql);
                reader.Read();
                this.arti.title       = DatabaseHelp.convert(this.arti.title, reader["title"]);
                this.arti.content     = DatabaseHelp.convert(this.arti.content, reader["article"]);
                this.arti.questionnum = DatabaseHelp.convert(this.arti.questionnum, reader["questionno"]);
                this.arti.questionIds = new int[this.arti.questionnum];
                for (int i = 0; i < this.arti.questionnum; i++)
                {
                    this.arti.questionIds[i] = DatabaseHelp.convert(this.arti.questionIds[i], reader["questionid" + (i + 1).ToString()]);
                }
                this.arti.average = DatabaseHelp.convert(this.arti.average, reader["average"]);
                reader.Close();
            }
            this.rq             = new readingQuestion[this.arti.questionnum];
            this.studentAnswers = new string[this.arti.questionnum];
            for (int i = 0; i < this.arti.questionnum; i++)
            {
                studentAnswers[i] = "";
                sql = "SELECT * FROM [dbo].[ReadingQuestion] WHERE id=" + this.arti.questionIds[i];
                SqlDataReader reader = DatabaseHelp.getReader(sql);
                reader.Read();
                this.rq[i]           = new readingQuestion();
                this.rq[i].id        = this.arti.questionIds[i];
                this.rq[i].articleid = DatabaseHelp.convert(this.rq[i].articleid, reader["articleid"]);

                this.rq[i].num        = DatabaseHelp.convert(this.rq[i].num, reader["num"]);
                this.rq[i].type       = DatabaseHelp.convert(this.rq[i].type, reader["type"]);
                this.rq[i].stem       = DatabaseHelp.convert(this.rq[i].stem, reader["stem"]);
                this.rq[i].opnum      = DatabaseHelp.convert(this.rq[i].opnum, reader["opnum"]);
                this.rq[i].paragraph  = DatabaseHelp.convert(this.rq[i].paragraph, reader["paragraph"]);
                this.rq[i].paragraph2 = DatabaseHelp.convert(this.rq[i].paragraph2, reader["paragraph2"]);
                this.rq[i].optionx    = new string[this.rq[i].opnum];
                for (int j = 0; j < this.rq[i].opnum; j++)
                {
                    this.rq[i].optionx[j] = DatabaseHelp.convert(this.rq[i].optionx[j], reader["option" + (j + 1).ToString()]);
                }
                this.rq[i].ans      = DatabaseHelp.convert(this.rq[i].ans, reader["ans"]);
                this.rq[i].acc      = DatabaseHelp.convert(this.rq[i].acc, reader["acc"]);
                this.rq[i].analysis = DatabaseHelp.convert(this.rq[i].analysis, reader["analysis"]);
                reader.Close();
            }

            this.webBrowser1.DocumentText = "<span style='color: rgb(128, 128, 128); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: \"Helvetica Neue\", Helvetica, \"Hiragino Sans GB\", \"Microsoft YaHei\", Arial, sans-serif; font-size: 16px; font-style: normal; font-weight: 400; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'>"
                                            + "<p align=\"center\">" + arti.title + "</p>" + "<p>" + arti.content.Replace("\r\n", "</p><p>").Replace("\n", "</p><p>") + "</p></span>";
            button3.Enabled = false;
            this.nownum     = 0;
            load_left_ins();
            this.timer1.Enabled = true;
            this.leftTime       = TimeSpan.Parse("0:20:0");
            this.label1.Text    = this.leftTime.ToString();
            this.Show();
        }