示例#1
0
        //完成
        private void button3_Click(object sender, EventArgs e)
        {
            intostring();
            string sql = "select * from ReadingQuestionType where type = '" + comboBox1.Text + "'";

            if (DatabaseHelp.SelectNum(sql) == 0)
            {
                comboBox1.Items.Add(comboBox1.Text);
                if (model <= 3)
                {
                    sql = "insert into ReadingQuestionType values('" + comboBox1.Text + "')";
                }
                else if (model == 4)
                {
                    sql = "insert into ComWritingSubject values('" + comboBox1.Text + "')";
                }
                else
                {
                    sql = "insert into IndWritingSubject values('" + comboBox1.Text + "')";
                }
                DatabaseHelp.executeCommand(sql);
            }

            sql = "select * from ReadingArticleSubject where subject = '" + comboBox2.Text + "'";
            if (DatabaseHelp.SelectNum(sql) == 0)
            {
                comboBox2.Items.Add(comboBox2.Text);
                sql = "insert into ReadingArticleSubject values('" + comboBox2.Text + "')";
                DatabaseHelp.executeCommand(sql);
            }
            MessageBox.Show("完成");
        }
示例#2
0
        //确定事件
        private void button1_Click(object sender, EventArgs e)
        {
            string sql    = "SELECT name FROM [dbo].[Users] WHERE name='" + name_textbox.Text + "'";
            int    result = DatabaseHelp.SelectNum(sql);

            if (passwd_textbox.Text != passwd2_textbox.Text)
            {
                MessageBox.Show("请输入相同的密码");
                return;
            }
            if (result != 0)
            {
                MessageBox.Show("该用户名已被注册!");
            }
            else
            {
                sql    = "INSERT INTO [dbo].[Users] (name, password, email, time, acc, question_num) VALUES";
                sql   += "('" + name_textbox.Text + "','" + passwd_textbox.Text + "','" + mail_textbox.Text + "',";
                sql   += "0.0, 0.0, 0)";
                result = DatabaseHelp.executeCommand(sql);
                if (result == 0)
                {
                    MessageBox.Show("用户创建失败,请联系管理员");
                    return;
                }
                MessageBox.Show("用户创建成功");
                DialogResult = DialogResult.OK;
            }
        }
示例#3
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("用户名或密码不对");
            }
        }
示例#4
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() }));
                }
            }
        }
示例#5
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();
        }
示例#6
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();
        }