private void btnCalulate_Click(object sender, EventArgs e) { int basemark = Convert.ToInt16(txtBaseMark.Text); MarkBLL FMark = new MarkBLL(); Marks = FMark.FinalMark(cmbClass.ClassID, basemark); MarkBind(); }
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); } }
private void GridViewMark_CellContentClick(object sender, DataGridViewCellEventArgs e) { int CIndex = e.ColumnIndex; //ɾ������ if(CIndex==4) { MarkBLL bMark = new MarkBLL(); if (bMark.DeleteMark(GridViewMark.Rows[e.RowIndex].Cells[0].Value.ToString())) { MessageBox.Show("ɾ���ɹ�"); QueryMark(); } else MessageBox.Show("ɾ��ʧ��"); } //�IJ��� else if (CIndex == 5) { MarkBLL bMark = new MarkBLL(); int mark = 0; try { if (!IsInt(GridViewMark.Rows[e.RowIndex].Cells[2].Value.ToString())) throw new Exception("���������"); mark = Convert.ToInt16(GridViewMark.Rows[e.RowIndex].Cells[2].Value.ToString()); if (mark > MAXMARK || mark < MINMARK) throw new Exception("�ɼ���ΧԽ��"); if (bMark.ChangeMark(GridViewMark.Rows[e.RowIndex].Cells[0].Value.ToString(), mark)) { MessageBox.Show("���³ɹ�"); QueryMark(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "������ʧ�ܡ�"); return; } } }
private void QueryMark() { MarkBLL bMark = new MarkBLL(); DateTime[] QDate = new DateTime[] { new DateTime(), new DateTime() }; if (!string.IsNullOrEmpty(txtSID.Text) && !string.IsNullOrEmpty(TxtFromDate.Text) && !string.IsNullOrEmpty(TxtToDate.Text)) { QDate[0] = Convert.ToDateTime(TxtFromDate.Text); QDate[1] = Convert.ToDateTime(TxtToDate.Text); Marks = bMark.SelectMark(txtSID.Text, QDate); MarkBind(); return; } if (!string.IsNullOrEmpty(txtSID.Text)) { if (!string.IsNullOrEmpty(TxtToDate.Text)) { QDate[1] = Convert.ToDateTime(TxtToDate.Text); Marks = bMark.SelectMark(txtSID.Text, QDate); MarkBind(); return; } if (!string.IsNullOrEmpty(TxtFromDate.Text)) { QDate[0] = Convert.ToDateTime(TxtFromDate.Text); Marks = bMark.SelectMark(txtSID.Text, QDate); MarkBind(); return; } Marks = bMark.SelectMark(txtSID.Text); MarkBind(); return; } if (!string.IsNullOrEmpty(TxtFromDate.Text)) { QDate[0] = Convert.ToDateTime(TxtFromDate.Text); if (!string.IsNullOrEmpty(TxtToDate.Text)) { QDate[1] = Convert.ToDateTime(TxtToDate.Text); } Marks = bMark.SelectMark(QDate); MarkBind(); return; } else { if (!string.IsNullOrEmpty(TxtToDate.Text)) { QDate[1] = Convert.ToDateTime(TxtToDate.Text); Marks = bMark.SelectMark(QDate); MarkBind(); return; } } }