Пример #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {

            Student iStudent = new Student();

            iStudent.STRID = Convert.ToString(textBoxID.Text);
            iStudent.STRNAME = Convert.ToString(textBoxName.Text);
            iStudent.STRCLASS = Convert.ToString(textBoxClass.Text);

            iStudent.CHINESE = Convert.ToSingle(textBoxChinese.Text);
            iStudent.MATH = Convert.ToSingle(textBoxMath.Text);
            iStudent.ENGLISH = Convert.ToSingle(textBoxEnglish.Text);
            iStudent.ALL = iStudent.CHINESE + iStudent.MATH + iStudent.ENGLISH;
            if (StudentList.AddStudent(iStudent) == 1)
            {
                MessageBox.Show("Your total score:" + Convert.ToString(iStudent.ALL));
            }
            
            //labelAllPoint.Text = Convert.ToString(iStudent.ALL);

            //置空textbox
            textBoxID.Text = "";
            textBoxName.Text = "";
            textBoxClass.Text = "";
            textBoxChinese.Text = "";
            textBoxMath.Text = "";
            textBoxEnglish.Text = "";

            

        }
Пример #2
0
        private void ShowRequireInfo_Load(object sender, EventArgs e)
        {
            //labelShow.Text="Name    Secore";
            //if (ShowSelect.flag[])
            {
                for (int k = 0; k < StudentList.studentNum; k++)
                {
                    Student STU = new Student();
                    STU = StudentList.ShowAllStudent(k);
                    listBox1.Items.Add(Convert.ToString(STU.STRNAME));
                    listBox2.Items.Add(Convert.ToString(STU.STRID));
                    listBox3.Items.Add(Convert.ToString(STU.STRCLASS));
                    listBox4.Items.Add(Convert.ToString(STU.CHINESE));
                    listBox5.Items.Add(Convert.ToString(STU.MATH));
                    listBox6.Items.Add(Convert.ToString(STU.ENGLISH));
                    listBox7.Items.Add(Convert.ToString(STU.ALL));

                    //labelShow.Text = Convert.ToString(STU.STRNAME + "      " +
                    //    "      " + STU.STRID + "      " + STU.STRCLASS + "      " +
                    //    "      " + STU.CHINESE + "      " + STU.MATH + "      " +
                    //    "      " + STU.ENGLISH + "      " + STU.ALL);
                }
                if (StudentList.Average() != 0)
                {
                    textBoxAvarage.Text = Convert.ToString(StudentList.Average());
                }
            }

            //ShowSelect ShowSelectDlg = new ShowSelect();
            //if (ShowSelectDlg.)
            //{
            //}

            //if (Convert.ToBoolean(comboBoxShow.Items.Add("sss")))
            //    labelShow.Text = "ssdfdfadf";
            labelShow.Text = "Hello";
            comboBoxShow.Items.Add("The Top of Three");
            comboBoxShow.Items.Add("Failing");
            comboBoxShow.Items.Add("Analysis Chinese");
            comboBoxShow.Items.Add("Analysis Math");
            comboBoxShow.Items.Add("Analysis English");
        }
Пример #3
0
        private void comboBoxShow_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBoxShow.Text)
            {
            case "The Top of Three":
                if (StudentList.SortByScore() == 1)
                {
                    //Student[] STU = new Student[3];
                    for (int k = 0; k < 3; k++)
                    {
                        StudentList.STU[k] = new Student();
                        label.Text         = "The top of three\n\r" + "First:" + StudentList.STU[k].STRNAME + " " +
                                             StudentList.STU[k].STRID + " " + StudentList.STU[k].STRCLASS + " " + StudentList.STU[k].CHINESE + "  " + StudentList.STU[k].MATH + "  " +
                                             " " + StudentList.STU[k].ENGLISH + " " + StudentList.STU[k].ALL + "\n\r";
                    }
                }
                label.Text = "Heee";
                break;

            case "Failing":
                break;

            case "Analysis Chinese":
                float[] ChineseSection = new float[6];
                ChineseSection = StudentList.PercentageOfChinese();
                label.Text     = Convert.ToString(ChineseSection[5]);
                break;

            case "Analysis Math":
                break;

            case "Analysis English":
                break;
            }

            //label1.Text = StudentList.total.ToString();
            //comboBoxShow.DataSource = StudentList.i;
        }
Пример #4
0
        private void ShowRequireInfo_Load(object sender, EventArgs e)
        {
            comboBoxShow.Items.Add("The Top of Three");
            //comboBoxShow.Items.Add("Failing");
            comboBoxShow.Items.Add("Analysis Chinese");
            comboBoxShow.Items.Add("Analysis Math");
            comboBoxShow.Items.Add("Analysis English");


            //listBox中展示所有学生成绩
            for (int k = 0; k < StudentList.i; k++)
            {
                Student STU = new Student();
                STU = StudentList.ShowAllStudent(k);
                listBox1.Items.Add(Convert.ToString(STU.STRNAME));
                listBox2.Items.Add(Convert.ToString(STU.STRID));
                listBox3.Items.Add(Convert.ToString(STU.STRCLASS));
                listBox4.Items.Add(Convert.ToString(STU.CHINESE));
                listBox5.Items.Add(Convert.ToString(STU.MATH));
                listBox6.Items.Add(Convert.ToString(STU.ENGLISH));
                listBox7.Items.Add(Convert.ToString(STU.ALL));

                //labelShow.Text = Convert.ToString(STU.STRNAME + "      " +
                //    "      " + STU.STRID + "      " + STU.STRCLASS + "      " +
                //    "      " + STU.CHINESE + "      " + STU.MATH + "      " +
                //    "      " + STU.ENGLISH + "      " + STU.ALL);
            }
            //求总分平均数模块
            if (StudentList.Average() != 0)
            {
                textBoxAvarage.Text = Convert.ToString(StudentList.Average());
            }

            //labelShow.Text = Convert.ToString(STU.STRNAME + "      " +
            //    "      " + STU.STRID + "      " + STU.STRCLASS + "      " +
            //    "      " + STU.CHINESE + "      " + STU.MATH + "      " +
            //    "      " + STU.ENGLISH + "      " + STU.ALL);
        }
Пример #5
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            string SubName;

            SubName = Convert.ToString(textBoxSubName.Text);
            if (SubName == "")
            {
                MessageBox.Show("Please input name:)");
            }
            else
            {
                int k = StudentList.Search(SubName);
                if (k == -1)
                {
                    MessageBox.Show("Not Found!");
                }
                else
                {
                    ShowStudnet ShowStudnetDlg = new ShowStudnet(k);
                    ShowStudnetDlg.Show();
                }
            }
        }
Пример #6
0
 public Form1()
 {
     InitializeComponent();
     studentlist = new StudentList();
     
 }
Пример #7
0
        private void comboBoxShow_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBoxShow.Text)
            {
            case "The Top of Three":
            {
                listBox8.Items.Clear();
                if (StudentList.SortByScore() == 1)
                {
                    label.Text = "Name" + "    " + "ID" + "    " + "Class" + "    " + "Chinese" + "    " + "Math" + "    " + "English" + "    " + "All";
                    listBox8.Items.Add(Convert.ToString(Convert.ToString(StudentList.STU[0].STRNAME) + '\t' + Convert.ToString(StudentList.STU[0].ENGLISH) + '\t'
                                                        + Convert.ToString(StudentList.STU[0].STRID) + '\t' + Convert.ToString(StudentList.STU[0].STRCLASS) + '\t' + Convert.ToString(StudentList.STU[0].CHINESE)
                                                        + '\t' + Convert.ToString(StudentList.STU[0].MATH) + '\t' + Convert.ToString(StudentList.STU[0].ALL)));
                }
                else
                {
                    for (int k = 0; k < 3 && k < StudentList.i; k++)
                    {
                        label.Text = "Name" + "    " + "ID" + "    " + "Class" + "    " + "Chinese" + "    " + "Math" + "    " + "English" + "    " + "All";
                        listBox8.Items.Add(Convert.ToString(Convert.ToString(StudentList.STU[k].STRNAME) + '\t'
                                                            + Convert.ToString(StudentList.STU[k].STRID) + '\t' + Convert.ToString(StudentList.STU[k].STRCLASS) + '\t'
                                                            + Convert.ToString(StudentList.STU[k].CHINESE) + '\t' + Convert.ToString(StudentList.STU[k].MATH) + '\t'
                                                            + Convert.ToString(StudentList.STU[k].ENGLISH) + "\t" + Convert.ToString(StudentList.STU[k].ALL)));
                    }
                }
                break;
            }

            case "Analysis Chinese":
            {
                listBox8.Items.Clear();
                float[] ChineseAnalyzie = new float[6] {
                    0, 0, 0, 0, 0, 0
                };
                ChineseAnalyzie = StudentList.PercentageOfChinese();
                label.Text      = "Chinese Analysis";
                int ChineseSection = 100;
                listBox8.Items.Add("The top is :" + ChineseAnalyzie[5]);
                for (int k = 0; (k < 5) && (StudentList.i != 0); k++)
                {
                    listBox8.Items.Add(Convert.ToString(ChineseSection) + "-"
                                       + Convert.ToString(ChineseSection - 10) + "  :    "
                                       + "Number:" + Convert.ToString(ChineseAnalyzie[k])
                                       + "\t" + "Percentage:"
                                       + Convert.ToString(ChineseAnalyzie[k] / StudentList.i * 100) + "%");
                    ChineseSection -= 10;
                }
                listBox8.Items.Add("Fail:");
                label.Text = "Name" + "    " + "ID" + "    " + "Class" + "    " + "Chinese" + "    " + "Math" + "    " + "English" + "    " + "All";
                for (int k = 0; k < StudentList.i; k++)
                {
                    if (StudentList.STU[k].CHINESE < 60)
                    {
                        listBox8.Items.Add(Convert.ToString(
                                               Convert.ToString(StudentList.STU[k].STRNAME) + '\t'
                                               + Convert.ToString(StudentList.STU[k].STRID) + '\t'
                                               + Convert.ToString(StudentList.STU[k].STRCLASS) + '\t'
                                               + Convert.ToString(StudentList.STU[k].CHINESE) + '\t'
                                               + Convert.ToString(StudentList.STU[k].MATH) + '\t'
                                               + Convert.ToString(StudentList.STU[k].ENGLISH) + '\t'
                                               + Convert.ToString(StudentList.STU[k].ALL)));
                    }
                }
                break;
            }

            case "Analysis Math":
            {
                listBox8.Items.Clear();
                float[] MathAnalyzie = new float[6];
                MathAnalyzie = StudentList.PercentageOfChinese();
                label.Text   = "Math Analysis";
                int MathSection = 100;
                listBox8.Items.Add("The top is :" + MathAnalyzie[5]);
                for (int k = 0; (k < 5) && (StudentList.i != 0); k++)
                {
                    listBox8.Items.Add(Convert.ToString(MathSection) + "-"
                                       + Convert.ToString(MathSection - 10) + "  :    "
                                       + "Number:" + Convert.ToString(MathAnalyzie[k])
                                       + "\t" + "Percentage:"
                                       + Convert.ToString(MathAnalyzie[k] / StudentList.i * 100) + "%");
                    MathSection -= 10;
                }
                listBox8.Items.Add("Fail:");
                label.Text = "Name" + "    " + "ID" + "    " + "Class" + "    " + "Chinese" + "    " + "Math" + "    " + "English" + "    " + "All";
                for (int k = 0; k < StudentList.i; k++)
                {
                    if (StudentList.STU[k].MATH < 60)
                    {
                        listBox8.Items.Add(
                            Convert.ToString(Convert.ToString(StudentList.STU[k].STRNAME) + '\t'
                                             + Convert.ToString(StudentList.STU[k].STRID) + '\t'
                                             + Convert.ToString(StudentList.STU[k].STRCLASS) + '\t'
                                             + Convert.ToString(StudentList.STU[k].CHINESE) + '\t'
                                             + Convert.ToString(StudentList.STU[k].MATH) + '\t'
                                             + Convert.ToString(StudentList.STU[k].ENGLISH) + '\t'
                                             + Convert.ToString(StudentList.STU[k].ALL)));
                    }
                }
                break;
            }

            case "Analysis English":
            {
                listBox8.Items.Clear();
                float[] EnglishAnalyzie = new float[6];
                EnglishAnalyzie = StudentList.PercentageOfChinese();
                label.Text      = "English Analysis";
                int EnglishSection = 100;
                listBox8.Items.Add("The top is :" + EnglishAnalyzie[5]);
                for (int k = 0; (k < 5) && (StudentList.i != 0); k++)
                {
                    listBox8.Items.Add(Convert.ToString(EnglishSection) + "-"
                                       + Convert.ToString(EnglishSection - 10) + "  :    "
                                       + "Number:" + Convert.ToString(EnglishAnalyzie[k])
                                       + "\t" + "Percentage:"
                                       + Convert.ToString(EnglishAnalyzie[k] / StudentList.i * 100) + "%");
                    EnglishSection -= 10;
                }
                listBox8.Items.Add("Fail:");
                label.Text = "Name" + "    " + "ID" + "    " + "Class" + "    " + "Chinese" + "    " + "Math" + "    " + "English" + "    " + "All";
                for (int k = 0; k < StudentList.i; k++)
                {
                    if (StudentList.STU[k].ENGLISH < 60)
                    {
                        listBox8.Items.Add(Convert.ToString(
                                               Convert.ToString(StudentList.STU[k].STRNAME) + '\t'
                                               + Convert.ToString(StudentList.STU[k].STRID) + '\t'
                                               + Convert.ToString(StudentList.STU[k].STRCLASS) + '\t'
                                               + Convert.ToString(StudentList.STU[k].CHINESE) + '\t'
                                               + Convert.ToString(StudentList.STU[k].MATH) + '\t'
                                               + Convert.ToString(StudentList.STU[k].ENGLISH) + '\t'
                                               + Convert.ToString(StudentList.STU[k].ALL)));
                    }
                }
                break;
            }
            }
        }
Пример #8
0
 public Form1()
 {
     InitializeComponent();
     studentlist = new StudentList();
 }