예제 #1
0
 //保存信息,弹出成功提示
 private void SaveInformationButton_Click(object sender, EventArgs e)
 {
     this.ShowLabel.Text    = "正在执行,请稍后";
     this.ShowLabel.Visible = true;
     if (StudentId.Text.Replace(" ", "") == "" || StudentName.Text.Replace(" ", "") == "" || StudentSex.Text.Replace(" ", "") == "" || StudentYear.Text.Replace(" ", "") == "" || StudentMonth.Text.Replace(" ", "") == "" || StudentDay.Text.Replace(" ", "") == "")
     {
         this.ShowLabel.Text = "出现错误,已终止操作";
         MessageBox.Show("输入信息不全,请继续输入");
         this.ShowLabel.Visible = false;
         return;
     }
     if (!Judge.JudgeChars(StudentId.Text))
     {
         this.ShowLabel.Text = "出现错误,已终止操作";
         MessageBox.Show("学号请不要包含英文字母");
         return;
     }
     if (!Judge.JudgeChars(StudentYear.Text))
     {
         this.ShowLabel.Text = "出现错误,已终止操作";
         MessageBox.Show("年份请不要包含英文字母");
         this.ShowLabel.Visible = false;
         return;
     }
     if (!ReadDatabase.ChangeDataBase("Information", new Student(StudentId.Text, StudentName.Text, null, null, StudentSex.Text, StudentYear.Text, StudentMonth.Text, StudentDay.Text, StudentCollege.Text, StudentProfessional.Text, StudentClass.Text)))
     {
         this.ShowLabel.Text = "执行错误";
         MessageBox.Show("数据保存失败,未知错误");
         this.ShowLabel.Visible = false;
         return;
     }
     this.ShowLabel.Visible = false;
     this.timer1.Enabled    = true;
     this.ShowLabel.Text    = "操作成功";
 }
예제 #2
0
 //保存信息,弹出成功提示
 private void SaveGradeButton_Click(object sender, EventArgs e)
 {
     this.ShowLabel.Text    = "正在执行,请稍后";
     this.ShowLabel.Visible = true;
     if (this.StudentId.Text == "" || this.StudentCourse.Text == "" || this.StudentGrade.Text == "")
     {
         this.ShowLabel.Text = "出现错误,已终止操作";
         MessageBox.Show("请确保信息完整", "错误");
         this.ShowLabel.Visible = false;
         return;
     }
     else if (!Judge.JudgeChars(this.StudentId.Text))
     {
         this.ShowLabel.Text = "出现错误,已终止操作";
         MessageBox.Show("请确保学号是纯数字", "错误");
         this.ShowLabel.Visible = false;
         return;
     }
     else if (!Judge.JudgeChars(this.StudentGrade.Text))
     {
         this.ShowLabel.Text = "出现错误,已终止操作";
         MessageBox.Show("请确保成绩是纯数字", "错误");
         this.ShowLabel.Visible = false;
         return;
     }
     if (!ReadDatabase.ChangeDataBase("Grade", new Student(StudentId.Text, StudentName.Text, StudentCourse.Text, StudentGrade.Text)))
     {
         this.ShowLabel.Text = "执行错误";
         MessageBox.Show("数据保存失败,未知错误");
         this.ShowLabel.Visible = false;
         return;
     }
     this.ShowLabel.Visible = false;
     this.timer1.Enabled    = true;
     this.ShowLabel.Text    = "操作成功";
 }
예제 #3
0
        /// <summary>
        /// 查询搜索
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FindButton_Click(object sender, EventArgs e)
        {
            //正在测试的,显示表格
            string          keyword = FindTextBox.Text.Replace(" ", "");
            InformationType DataType;

            if (keyword == "" || keyword == @"请输入“姓名”或者“学号”开始查询  注:当内容为数字串时默认为“学号”,非数字串时默认为“姓名”,请确保只输入一种".Replace(" ", "") || keyword == "此功能不支持关键字查询,请检查功能按钮状态".Replace(" ", ""))
            {
                DataType = InformationType.none;
            }
            else if (Judge.JudgeChars(keyword))
            {
                DataType = InformationType.id;
            }
            else
            {
                DataType = InformationType.name;
            }

            DataTable result = null;

            //if (FindTextBox.Text.ToLower() == "Test".ToLower() || FindTextBox.Text == "测试")
            //{
            //    result = ReadDatabase.GetData("Test");
            //    ResultTable.DataSource = result;
            //    return;
            //}

            if (FindTextBox.Text == "" || FindTextBox.Text == @"请输入“姓名”或者“学号”开始查询  注:当内容为数字串时默认为“学号”,非数字串时默认为“姓名”,请确保只输入一种")
            {
                if (ChooseBox.Text == "默认")
                {
                    result = ReadDatabase.GetData("Default");//显示学生基本信息
                    ResultTable.DataSource       = result;
                    ResultTable.Columns[0].Width = 100;
                }
                else
                {
                    MessageBox.Show("请输入查询关键字(姓名或者学号)");
                }
                return;
            }

            //执行查询操作,获取数据表
            if (ChooseBox.Text == "默认")//查询某个同学。。。。。
            {
                result = ReadDatabase.GetData("Default", keyword, DataType);
            }
            else if (ChooseBox.Text == "查询基本信息")
            {
                result = ReadDatabase.GetData("Information", keyword, DataType);
            }
            else if (ChooseBox.Text == "查询课程及成绩")
            {
                result = ReadDatabase.GetData("ClassAndGrade", keyword, DataType);
            }
            else if (ChooseBox.Text == "查询历史教师")
            {
                result = ReadDatabase.GetData("Teacher", keyword, DataType);
            }
            else if (ChooseBox.Text == "查询即将被开除学生")
            {
                result = ReadDatabase.GetData("FailStudent", keyword, DataType);
            }
            ResultTable.DataSource       = result;
            ResultTable.Columns[0].Width = 100;
        }