?? 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 + -