using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

using Model;

namespace LoginFrame
{
    public partial class FrmAddScoreInfo : Form
    {
        public FrmAddScoreInfo()
        {
            InitializeComponent();
        }

        private ScoreInfo scoreInfo = new ScoreInfo();
        private void Btn_Add_Click(object sender, EventArgs e)
        {
            scoreInfo.studentNumber = this.cb_studentNumber.SelectedValue.ToString(); //学生对象
            scoreInfo.courseNumber = this.cb_courseNumber.SelectedValue.ToString(); //课程对象
            try
            {
                scoreInfo.scoreValue = Convert.ToSingle(this.txt_scoreValue.Text);  //成绩得分
            }
            catch
            {
                MessageBox.Show("成绩得分请输入正确的格式!");
                this.txt_scoreValue.SelectAll();
                this.txt_scoreValue.Focus();
                return;
            }
            scoreInfo.studentEvaluate = this.txt_studentEvaluate.Text;  //学生评价
            if (BLL.bllScoreInfo.AddScoreInfo(scoreInfo))
                MessageBox.Show("成绩信息添加成功!");
            else
                MessageBox.Show("成绩信息添加失败!");
            this.Close(); 
        }

        private void FrmAddScoreInfo_Load(object sender, EventArgs e)
        {
            //查询所有的学生信息
            DataSet student_QQ287307421Ds = BLL.bllStudent_QQ287307421.getAllStudent_QQ287307421();
            this.cb_studentNumber.DataSource = student_QQ287307421Ds.Tables[0];
            this.cb_studentNumber.DisplayMember = "studentName";
            this.cb_studentNumber.ValueMember = "studentNumber";
            //查询所有的课程信息
            DataSet courseInfo_QQ254540457Ds = BLL.bllCourseInfo_QQ254540457.getAllCourseInfo_QQ254540457();
            this.cb_courseNumber.DataSource = courseInfo_QQ254540457Ds.Tables[0];
            this.cb_courseNumber.DisplayMember = "courseName";
            this.cb_courseNumber.ValueMember = "courseNumber";
        }
    }
}
