/// <summary> /// 修改处罚信息 /// </summary> /// <param name="nID"></param> /// <param name="punishment"></param> public void ModifyPunishRecord(string nID, Punishment punishment) { string strSQL = "update StudentPunishmentRecords set ID='" + punishment.nID + "',EXEDATETIME=#" + punishment.ExeDateTime + "#,EXEUNIT='" + punishment.AuthorizeUnit.ToString() + "',PUNISHMENT='" + punishment.Punishement.ToString() + "',REASON='" + punishment.Reason + "'"; strSQL += " where ID='" + nID + "'"; db.ExecuteNonQuery(strSQL, oleConn); }
/// <summary> /// 添加处罚记录 /// </summary> /// <param name="punishment"></param> public void InsertPunishRecord(Punishment punishment) { string strSQL = " insert into StudentPunishmentRecords(ID,EXEDATETIME,EXEUNIT,PUNISHMENT,REASON) values("; strSQL += "'" + punishment.nID + "',#" + punishment.ExeDateTime + "#,'" + punishment.AuthorizeUnit.ToString() + "','" + punishment.Punishement.ToString() + "','" + punishment.Reason + "')"; db.ExecuteNonQuery(strSQL, oleConn); }
/// <summary> /// 界面初始化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CP_StudentPunishmentRecords_Load(object sender, EventArgs e) { IsQuery = false; panelEDIT.Visible = IsEditable; punishment = new Punishment(); personInfo = new PersonInfo(); FillStudentInfoDatatable(personInfo.GetPersonInfoTable()); FillPunishRecordsDatatable(punishment.GetPunishmentDataTable()); }
private void buttonMODIFYRECORD_Click(object sender, EventArgs e) { punishment = new Punishment(); punishment.nID = textEditID.Text; punishment.Punishement = radioGroupPUNITSHTYPE.Properties.Items[radioGroupPUNITSHTYPE.SelectedIndex].Description; punishment.AuthorizeUnit = comboBoxUNIT.Text; punishment.ExeDateTime = dateTimePickerDATETIME.Value.Date; punishment.Reason = richTextBoxREASON.Text; punishment.ModifyPunishRecord(textEditID.Text, punishment); UpdatePunishDataTable(); }
/// <summary> /// 添加记录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonADDRECORD_Click(object sender, EventArgs e) { if (MessageBox.Show("确定处罚该学员?", "确认", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { punishment = new Punishment(); punishment.nID = textEditID.Text; punishment.Punishement = radioGroupPUNITSHTYPE.Properties.Items[radioGroupPUNITSHTYPE.SelectedIndex].Description; punishment.AuthorizeUnit = comboBoxUNIT.Text; punishment.ExeDateTime = dateTimePickerDATETIME.Value.Date; punishment.Reason = richTextBoxREASON.Text; punishment.InsertPunishRecord(punishment); DataTable dt = punishment.QueryPunishRecordDataTable(textEditID.Text); FillPunishRecordsDatatable(dt); //UpdatePunishDataTable(); } catch { MessageBox.Show("插入有误!"); } } }