CEL_Payroll/Payroll.Service/OverTime/DA/EmployeeOverTimeDA.cs

95 lines
3.6 KiB
C#
Raw 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 EmployeeOverTimeDA
internal class EmployeeOverTimeDA
{
#region Constructor
private EmployeeOverTimeDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, EmployeeOverTime item)
{
tc.ExecuteNonQuery("INSERT INTO EMPOVERTIME(TermID,TermParameterID,employeeID, monthDate, OTHours, amount, CreatedBy, CreationDate,OTMonth,EMPOVERTIMEID,PayrollTypeID,OTMonthBasic)" +
" VALUES(%n, %n, %n, %d, %n, %n, %n, %d, %d, %n,%n,%n)", item.TermID.Integer, item.TermParameterID.Integer, item.EmployeeID.Integer, item.MonthDate, item.OTHours, item.Value, item.CreatedBy.Integer, item.CreatedDate, item.OTMonth, item.ID.Integer, item.PayrollTypeID.Integer, item.OTMonthBasic);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, EmployeeOverTime item)
{
tc.ExecuteNonQuery("UPDATE EMPOVERTIME SET TermID=%n, TermParameterID=%n, MonthDate=%d, OTHours=%n, Amount=%n, ModifiedBy=%n, ModifiedDate=%d,OTMonth=%d,PayrollTypeID=%n, OTMonthBasic=%n " +
" WHERE EmpOverTimeID=%n", item.TermID.Integer, item.TermParameterID.Integer, item.MonthDate, item.OTHours, item.Value, item.ModifiedBy.Integer, item.ModifiedDate, item.OTMonth, item.PayrollTypeID.Integer, item.OTMonthBasic,item.ID.Integer);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM EmployeeOverTime");
}
internal static IDataReader GetByEmpID(TransactionContext tc,ID nEmpID,DateTime dMonthDate)
{
return tc.ExecuteReader("SELECT * FROM EMPOVERTIME Where MonthDate=%d AND EmployeeID=%n Order By EmployeeID,TermParameterID",dMonthDate,nEmpID.Integer);
}
internal static IDataReader GetByEmpID(TransactionContext tc, ID nEmpID, DateTime otMonth, DateTime salaryMonth)
{
return tc.ExecuteReader("SELECT * FROM EMPOVERTIME Where otMonth=%d and MonthDate=%d AND EmployeeID=%n Order By EmployeeID,TermParameterID", otMonth, salaryMonth, nEmpID.Integer);
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM EMPOVERTIME WHERE EMPOVERTIMEID=%n", nID.Integer);
}
internal static IDataReader Get(TransactionContext tc, DateTime dSalaryMonth,ID nPayrollTypeID)
{
return tc.ExecuteReader("SELECT * FROM EMPOVERTIME WHERE MonthDate=%d AND PayrollTypeID=%n order by employeeid", dSalaryMonth,nPayrollTypeID.Integer);
}
#endregion
#region Delete function
//internal static void Delete(TransactionContext tc, ID nID)
//{
// tc.ExecuteNonQuery("DELETE FROM [EMPOVERTIME] WHERE EmployeeID=%n", nID.Integer);
//}
internal static void DeleteByMonth(TransactionContext tc, DateTime dOTMonth)
{
tc.ExecuteNonQuery("DELETE FROM [EMPOVERTIME] WHERE MonthDate=%d", dOTMonth);
}
internal static void DeleteByEmpID(TransactionContext tc, ID nEmpID, DateTime dMonthDate)
{
tc.ExecuteNonQuery("DELETE FROM [EMPOVERTIME] WHERE EmployeeID=%n and MonthDate=%d", nEmpID.Integer, dMonthDate);
}
#endregion
}
#endregion
}