118 lines
4.5 KiB
C#
118 lines
4.5 KiB
C#
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
using System;
|
|
using System.Data;
|
|
|
|
|
|
namespace HRM.DA
|
|
{
|
|
internal class ProdBonusAttnDA
|
|
{
|
|
#region Constructor
|
|
|
|
private ProdBonusAttnDA()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, ProdBonusAttn item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
"INSERT INTO ProdBonusAttn(ProdBonusAttnID, ProdBonusSetupID,BonusScheduleID,ProdBonusLineID,InTime,OutTime,BonusHour, EmployeeID,IsCommon)" +
|
|
" VALUES(%n, %n, %n,%n,%D,%D,%n,%n, %b)", item.ID, item.ProdBonusSetupID, item.BonusScheduleID,
|
|
item.ProdBonusLineID, item.InTime, item.OutTime, item.BonusHour, item.EmployeeID, item.IsCommon);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, ProdBonusAttn item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"UPDATE ProdBonusAttn SET ProdBonusSetupID=%n,BonusScheduleID=%n,ProdBonusLineID=%n,InTime=%d,OutTime=%d,BonusHour=%n, EmployeeID=%n, IsCommon=%b " +
|
|
"WHERE ProdBonusAttnID=%n", item.ProdBonusSetupID, item.ProdBonusLineID, item.InTime, item.OutTime,
|
|
item.BonusHour, item.EmployeeID, item.IsCommon, item.ID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM ProdBonusAttn");
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int setupID, int scheduleID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND BonusScheduleID=%n",
|
|
setupID, scheduleID);
|
|
}
|
|
|
|
internal static IDataReader GetBySetupID(TransactionContext tc, int setupID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n ", setupID);
|
|
}
|
|
internal static IDataReader GetBySetupIDs(TransactionContext tc, string setupIDs)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID in (%q) ", setupIDs);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusAttnID=%n", nID);
|
|
}
|
|
|
|
internal static IDataReader GetByLineID(TransactionContext tc, int lineID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusLineID=%n ", lineID);
|
|
}
|
|
internal static IDataReader GetbySetupAndLineID(TransactionContext tc, int setupID, int lineID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND ProdBonusLineID=%n ", setupID, lineID);
|
|
}
|
|
|
|
internal static IDataReader GetbySetupAndLineIDbyInSQL(TransactionContext tc, string setupID, string lineID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM ProdBonusAttn pt Inner join " +
|
|
" ProductionBonusSetup ps on ps.ProdBonusSetupID =pt.ps.ProdBonusSetupID " +
|
|
"where ps.ProdBonusSetupID IN (%s) AND ProdBonusLineID IN ( %s) ", setupID, lineID);
|
|
}
|
|
internal static IDataReader Get(TransactionContext tc, int setupID, DateTime dateTime)
|
|
{
|
|
string sql = SQLParser.MakeSQL("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND year(InTime)= %n AND month(InTime)= %n AND day(InTime)= %n",
|
|
setupID, dateTime.Year, dateTime.Month,dateTime.Day);
|
|
return tc.ExecuteReader(sql);
|
|
//return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND CAST(InTime AS date)=%d", setupID, dateTime);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, int nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM ProdBonusAttn WHERE ProdBonusAttnID=%n", nID);
|
|
}
|
|
|
|
internal static void Delete(TransactionContext tc, int setupID, int scheduleID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND BonusScheduleID=%n", setupID,
|
|
scheduleID);
|
|
}
|
|
internal static void Delete(TransactionContext tc, int setupID, DateTime inTime)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND CAST(InTime AS date)=%d", setupID, inTime);
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
}
|
|
} |