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);
            }
        }
 private void btnSearch_Click(object sender, EventArgs e)
 {
     StudentBLL bstudent = new StudentBLL();
     LabClassBLL cls = new LabClassBLL();
     stuinfo = bstudent.GetStudentBySID(txtSID.Text);
     if (stuinfo == null)
     {
         MessageBox.Show("û�����ѧ��");
         return;
     }
     lblSName.Text = stuinfo.SName;
     cmbClass.BindClass(ClassType.LabClass);
     cmbClass.ClassID = stuinfo.LabClassID;
 }