📄 punishmentmanager.cs
字号:
using System;
using System.Data.OleDb;
using StudentsMIS.DataAccess;
namespace StudentsMIS.Business
{
/// <summary>
/// PunishmentManager实现了对punishments表的选、增、删、改。
/// </summary>
public class PunishmentManager
{
public PunishmentManager()
{
}
public IEntity Select(string id)
{
return new PunishmentEntity();
}
public int Insert(IEntity obj)
{
PunishmentEntity entity = (PunishmentEntity)obj;
OleDbCommand objCommand = CommandBuilder.BuildOleDbCommand("Insert Into punishments(punishment_studentID,punishment_typeID,punishment_reason,punishment_date) Values(@PunishmentStudentID,@PunishmentTypeID,@PunishmentReason,@PunishmentDate)");
objCommand.Parameters.Add("@PunishmentStudentID",entity.PunishmentStudentID);
objCommand.Parameters.Add("@PunishmentTypeID",entity.PunishmentType);
objCommand.Parameters.Add("@PunishmentReason",entity.PunishmentReason);
objCommand.Parameters.Add("@PunishmentDate",entity.PunishmentDate);
objCommand.ExecuteNonQuery();
CommandCloser.CloseOleDbCommand(objCommand);
return 0;
}
public void Delete(string id)
{
OleDbCommand objCommand = CommandBuilder.BuildOleDbCommand("Delete From punishments Where punishment_ID=@PunishmentID");
objCommand.Parameters.Add("@PunishmentID",id);
objCommand.ExecuteNonQuery();
CommandCloser.CloseOleDbCommand(objCommand);
}
public int Update(IEntity obj)
{
PunishmentEntity entity = (PunishmentEntity)obj;
OleDbCommand objCommand = CommandBuilder.BuildOleDbCommand("Update punishments Set punishment_typeID=@PunishmentTypeID,punishment_reason=@PunishmentReason Where punishment_ID=@PunishmentID");
objCommand.Parameters.Add("@PunishmentTypeID",entity.PunishmentType);
objCommand.Parameters.Add("@PunishmentReason",entity.PunishmentReason);
objCommand.Parameters.Add("@PunishmentID",entity.PunishmentID);
objCommand.ExecuteNonQuery();
CommandCloser.CloseOleDbCommand(objCommand);
return 0;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -