Example #1
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            if (txtSID.Text == string.Empty || txtSName.Text == string.Empty)
            {
                MessageBox.Show("����д����������Ϣ");
                return;
            }

            StudentBLL bllstu = new StudentBLL();
            if (bllstu.GetStudentBySID(txtSID.Text) != null)
            {
                MessageBox.Show("�Ѿ����ڸ�ѧ��");
                return;
            }
            int Rate=0;

            try
            {
                StudentInfo student = new StudentInfo()
                {
                    SID = txtSID.Text,
                    SName = txtSName.Text,
                    LabClassID = cmbClass.ClassID,
                    Rate = Rate
                };
                if (bllstu.AddStudent(student))
                {
                    MessageBox.Show("��ӳɹ�");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }