CEL_Payroll/Payroll.Service/Bonus/DA/ProductionBonusSetupDA.cs

122 lines
4.6 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using Payroll.BO;
using System.Data;
using System.Linq;
using Ease.CoreV35.Model;
using System.Data.SqlClient;
using Ease.CoreV35.DataAccess;
using System.Collections.Generic;
using Ease.CoreV35.DataAccess.SQL;
namespace Payroll.Service
{
#region ProductionBonusSetupDA
internal class ProductionBonusSetupDA
{
#region Constructor
private ProductionBonusSetupDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, ProductionBonusSetup item)
{
tc.ExecuteNonQuery("INSERT INTO ProductionBonusSetup(ProductionBonusSetupID, AchivedPercent, OTHour, SalaryMonth, DesignNo, FromDate, ToDate, CreatedBy, CreationDate, Status,ProgramName,MaxPerson)" +
" VALUES(%n, %n, %n, %d, %s, %d, %d, %n, %d, %n,%s,%n)", item.ID.Integer, item.AchivedPercent, item.OTHour, item.SalaryMonth, item.DesignNo, item.FromDate,item.ToDate, item.CreatedBy.Integer, item.CreatedDate, item.Status,item.ProgramName,item.MaxPerson);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, ProductionBonusSetup item)
{
tc.ExecuteNonQuery("UPDATE ProductionBonusSetup SET AchivedPercent=%n, OTHour=%n, SalaryMonth=%d, DesignNo=%s, FromDate=%d, ToDate=%d, Status=%n,ProgramName=%s,MaxPerson=%n" +
"WHERE ProductionBonusSetupID=%n", item.AchivedPercent, item.OTHour, item.SalaryMonth, item.DesignNo, item.FromDate, item.ToDate, item.Status,item.ProgramName,item.MaxPerson, item.ID.Integer);
}
#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, ID nID)
{
return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup WHERE ProductionBonusSetupID=%n",nID.Integer );
}
internal static IDataReader Get(TransactionContext tc, string DesignNo)
{
return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup WHERE DesignNo=%s", DesignNo);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM ProductionBonusSetup WHERE ProductionBonusSetupID=%n", nID.Integer);
}
#endregion
internal static IDataReader GetProductionBonusLine(TransactionContext tc, ID id)
{
return tc.ExecuteReader("SELECT * FROM ProdBonusLine WHERE ProdBonusSetupID=%n", id.Integer);
}
internal static IDataReader GetProdBonusWorkSchedules(TransactionContext tc, ID id)
{
return tc.ExecuteReader("SELECT * FROM ProdBonusWorkSchedule WHERE ProdBonusSetupID=%n", id.Integer);
}
internal static IDataReader GetProdBonusParameters(TransactionContext tc, ID id)
{
return tc.ExecuteReader("SELECT * FROM ProdBonusParameter WHERE ProdBonusSetupID=%n", id.Integer);
}
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
}