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 btnOK_Click(object sender, EventArgs e) { StudentBLL bStudent = new StudentBLL(); if (bStudent.ChangeRate(txtSID.Text, int.Parse(Setting.FreeRate))) { MessageBox.Show("�Ǽdzɹ���"); BindData(); } else { MessageBox.Show("û�д�ѧ����"); } }
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; }
private void bntOK_Click(object sender, EventArgs e) { ClassQuestionMark.BLL.StudentBLL bstudent = new StudentBLL(); if (stuinfo != null) { stuinfo.LabClassID = cmbClass.ClassID; if (bstudent.UpdateStudent(stuinfo)) { MessageBox.Show(stuinfo.SName + "��ת��" + stuinfo.LabClassID + "�࣡"); return; } } MessageBox.Show("ת��ʧ�ܣ�"); }
private void btnOK_Click(object sender, EventArgs e) { StudentBLL bstudent = new StudentBLL(); if(dsStudent==new DataSet()) MessageBox.Show("û������"); try { if (bstudent.BatchAdd(dsStudent)) MessageBox.Show("��ӳɹ�"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnMark_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtSID.Text)) { PopupMark(txtSID.Text); } else { StudentBLL bstudent = new StudentBLL(); StudentInfo stuinfo = bstudent.GetStudentByName(txtName.Text); if (stuinfo != null && stuinfo.SID!=null) PopupMark(stuinfo.SID); else MessageBox.Show("û�����ѧ����", "����", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnOK_Click(object sender, EventArgs e) { ClassQuestionMark.BLL.MarkBLL bMark = new ClassQuestionMark.BLL.MarkBLL(); if (bMark.AddMark(stuinfo.SID, Convert.ToInt32(cmbMark.Text))) { StudentBLL bStudent = new StudentBLL(); bStudent.ChangeRate(stuinfo.SID, (int)(stuinfo.Rate + Convert.ToInt16(cmbMark.Text))); MessageBox.Show(stuinfo.SName + "�÷���:" + cmbMark.Text,"�Ǽ�",MessageBoxButtons.OK,MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("��ӳɼ�ʧ�ܣ�", "����", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void BindData() { StudentBLL bstudent = new StudentBLL(); students= bstudent.GetReleaseStudent(); if (students == null) { MessageBox.Show("û��ѧ��"); return; } GridViewMark.AutoGenerateColumns = false; GridViewMark.Columns.Clear(); GridViewMark.DataSource = students; DataGridViewTextBoxColumn txtID = new DataGridViewTextBoxColumn(); txtID.CellTemplate = new DataGridViewTextBoxCell(); GridViewMark.Columns.Insert(0, txtID); txtID.HeaderText = "ѧ��"; txtID.DataPropertyName = "SID"; DataGridViewTextBoxColumn txtName = new DataGridViewTextBoxColumn(); txtName.CellTemplate = new DataGridViewTextBoxCell(); GridViewMark.Columns.Insert(1, txtName); txtName.HeaderText = "ѧ��"; txtName.DataPropertyName = "SName"; DataGridViewTextBoxColumn txtClass = new DataGridViewTextBoxColumn(); txtClass.CellTemplate = new DataGridViewTextBoxCell(); GridViewMark.Columns.Insert(2, txtClass); txtClass.HeaderText = "���"; txtClass.DataPropertyName = "ClassID"; txtClass.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; DataGridViewButtonColumn delcol = new DataGridViewButtonColumn(); delcol.CellTemplate = new DataGridViewButtonCell(); GridViewMark.Columns.Insert(3, delcol); delcol.HeaderText = "ɾ��"; delcol.UseColumnTextForButtonValue = true; delcol.Text = "ɾ��"; delcol.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; }
private void GridViewMark_CellContentClick(object sender, DataGridViewCellEventArgs e) { int CIndex = e.ColumnIndex; //ɾ������ if (CIndex == 3) { StudentBLL bStudent = new StudentBLL(); //ʮ����ֵ����⣬��ť�е���ű��0��ѧ���е����Ϊ1 if (bStudent.ChangeRate(GridViewMark.Rows[e.RowIndex].Cells[0].Value.ToString(),0)) { MessageBox.Show("ɾ���ɹ�"); BindData(); } else MessageBox.Show("ɾ��ʧ��"); } }
public IList<StudentInfo> FinalMark(string pClassID, int pBase) { int baseMark = new int(); IList<StudentInfo> StudentMark = new List<StudentInfo>(); StudentBLL bStudent = new StudentBLL(); StudentMark = bStudent.GetStudentByClass(pClassID); IList<MarkInfo> PMark = new List<MarkInfo>(); foreach (StudentInfo stu in StudentMark) { baseMark = pBase; PMark = SelectMark(stu.SID); stu.Rate = baseMark; if (PMark==null) { continue; } foreach (MarkInfo gMark in PMark) { stu.Rate += gMark.Mark; } PMark.Clear(); if (stu.Rate > 100) stu.Rate = 100; if (stu.Rate < 0) stu.Rate = 0; } return StudentMark; }