EchoTex_Payroll/HRM.DA/DA/Bonus/ProductionBonusSetupDA.cs

145 lines
5.4 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
#region ProductionBonusSetupDA
internal class ProductionBonusSetupDA
{
#region Constructor
private ProductionBonusSetupDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, ProductionBonusSetup item)
{
string sql = SQLParser.MakeSQL(
2024-10-29 14:51:13 +06:00
"INSERT INTO ProductionBonusSetup(ProductionBonusSetupID, ProgramName, AchivedPercent, OTHour, SalaryMonth, DesignNo, FromDate, ToDate, MaxPerson, CreatedBy, CreationDate, Status)" +
2024-10-30 13:17:23 +06:00
" VALUES(%n, %s, %n, %n, %d, %s, %d, %d, %n, %n, %d, %n)", item.ID, item.ProgramName, item.AchivedPercent, item.OTHour,
2024-10-29 14:51:13 +06:00
item.SalaryMonth, item.DesignNo, item.FromDate, item.ToDate, item.MaxPerson, item.CreatedBy, item.CreatedDate,
2024-10-14 10:01:49 +06:00
item.Status);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, ProductionBonusSetup item)
{
tc.ExecuteNonQuery(
2024-10-29 14:51:13 +06:00
"UPDATE ProductionBonusSetup SET ProgramName=%s, AchivedPercent=%n, OTHour=%n, SalaryMonth=%d, DesignNo=%s, FromDate=%d, ToDate=%d, MaxPerson=%n, Status=%n " +
" WHERE ProductionBonusSetupID=%n", item.ProgramName, item.AchivedPercent, item.OTHour, item.SalaryMonth, item.DesignNo,
item.FromDate, item.ToDate, item.MaxPerson, item.Status, item.ID);
2024-10-14 10:01:49 +06:00
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, DateTime dtSalaryMonth)
{
return tc.ExecuteReader(
"SELECT * FROM ProductionBonusSetup where Month(SalaryMonth)=%n AND Year(SalaryMonth)=%n",
dtSalaryMonth.Month, dtSalaryMonth.Year);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup");
}
internal static IDataReader Get(TransactionContext tc, EnumBonusStatus status)
{
return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup Where Status=%n", status);
}
internal static IDataReader Get(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup WHERE ProductionBonusSetupID=%n", nID);
}
internal static IDataReader Get(TransactionContext tc, string DesignNo)
{
return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup WHERE DesignNo=%s", DesignNo);
}
internal static IDataReader GetProductionBonusLine(TransactionContext tc, int id)
{
return tc.ExecuteReader("SELECT * FROM ProdBonusLine WHERE ProdBonusSetupID=%n", id);
}
internal static IDataReader GetProductionBonusLine(TransactionContext tc, string ids)
{
return tc.ExecuteReader("SELECT * FROM ProdBonusLine WHERE ProdBonusSetupID in (%q)", ids);
}
internal static IDataReader GetProdBonusWorkSchedules(TransactionContext tc, int id)
{
return tc.ExecuteReader("SELECT * FROM ProdBonusWorkSchedule WHERE ProdBonusSetupID=%n", id);
}
internal static IDataReader GetProdBonusParameters(TransactionContext tc, int id)
{
return tc.ExecuteReader("SELECT * FROM ProdBonusParameter WHERE ProdBonusSetupID=%n", id);
}
internal static DataTable GetLayout(TransactionContext tc, DateTime dtSalaryMonth)
{
return tc.ExecuteDataTable(
2024-10-14 16:49:56 +06:00
"SELECT ProductionBonusSetupID as id, DesignNo as design FROM ProductionBonusSetup where Salarymonth >= %d",
GlobalFunctions.FirstDateOfMonth(dtSalaryMonth));
2024-10-14 10:01:49 +06:00
}
internal static DataTable GetLayoutMonthly(TransactionContext tc, DateTime dtSalaryMonth)
{
return tc.ExecuteDataTable(
"SELECT ProductionBonusSetupID as id, DesignNo as design FROM ProductionBonusSetup where Month(SalaryMonth) = %n and YEAR(SalaryMonth) = %n",
dtSalaryMonth.Month, dtSalaryMonth.Year);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM ProductionBonusSetup WHERE ProductionBonusSetupID=%n", nID);
}
internal static void DeleteAttn(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM ProdBonusAttn WHERE ProdBonusSetupID=%n", nID);
}
internal static void DeleteSupervisor(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM ProdBonusSupervisor WHERE ProdBonusSetupID=%n", nID);
}
internal static void DeleteParameter(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM ProdBonusParameter WHERE ProdBonusSetupID=%n", nID);
}
internal static void DeleteSchedule(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM ProdBonusWorkSchedule WHERE ProdBonusWorkScheduleID=%n", nID);
}
internal static void DeleteLine(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM ProdBonusLine WHERE ProdBonusLineID=%n", nID);
}
#endregion
}
#endregion
}