90 lines
2.3 KiB
C#
90 lines
2.3 KiB
C#
using System;
|
|
using HRM.BO;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using Ease.Core.Model;
|
|
using System.Data.SqlClient;
|
|
using Ease.Core.DataAccess;
|
|
using System.Collections.Generic;
|
|
using Ease.Core.DataAccess.SQL;
|
|
|
|
|
|
namespace HRM.DA
|
|
{
|
|
#region PunishmentDA
|
|
|
|
internal class PunishmentDA
|
|
{
|
|
#region Constructor
|
|
|
|
private PunishmentDA() { }
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, Punishment item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO Punishment(PunishmentID, code, Description)" +
|
|
" VALUES(%n, %s, %s)", item.ID, item.Code, item.Description);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, Punishment item)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE Punishment SET code=%s, Description=%s" +
|
|
" WHERE PunishmentID=%n", item.Code, item.Description, item.ID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Punishment");
|
|
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Punishment WHERE PunishmentID=%n", nID);
|
|
}
|
|
|
|
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Punishment");
|
|
}
|
|
|
|
internal static IDataReader GetDAPunishmentPicker(TransactionContext tc, int punishmentid)
|
|
{
|
|
DataSet dSet = new DataSet();
|
|
string sql = string.Empty;
|
|
|
|
if (punishmentid > 0)
|
|
{
|
|
sql = SQLParser.TagSQL(sql) + SQLParser.MakeSQL("PUNISHMENTID = %n", punishmentid);
|
|
}
|
|
string sqlQuery = SQLParser.MakeSQL(@"select * from PUNISHMENT %q", sql);
|
|
Console.WriteLine(sqlQuery);
|
|
return tc.ExecuteReader(sqlQuery);
|
|
}
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, int nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM [Punishment] WHERE PunishmentID=%n", nID);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
}
|