EchoTex_Payroll/HRM.DA/DA/Fund/Basic/MonthEndProcessDA.cs

79 lines
2.6 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.Fund
{
internal class MonthEndProcessDA
{
#region Insert Function
internal static void Insert(TransactionContext tc, MonthEndProcess item)
{
string sql = SQLParser.MakeSQL(
"INSERT INTO MonthEndProcess (MonthEndProcessID,Month,Year,CreatedBy,CreatedDate,ProjectID)" +
" VALUES(%n,%n,%n,%n,%D,%n)", item.ID, item.Month, item.Year, item.CreatedBy, item.CreatedDate,
item.ID);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, MonthEndProcess item)
{
string sql = SQLParser.MakeSQL(
"UPDATE MonthEndProcess Set Month = %n, Year = %n, ModifiedBy = %n, ModifiedDate = %D, ProjectID = %n" +
"WHERE MonthEndProcessID = %n ", item.Month, item.Year, item.ModifiedBy, item.ModifiedDate, item.ID,
item.ID);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateDueMonthEnd(TransactionContext tc, MonthEndProcess item)
{
string sql = SQLParser.MakeSQL(
"UPDATE ProjectDetails SET LastMonthEndDate = %d, ModifiedBy = %n, ModifiedDate = %D" +
"WHERE ProjectID = %n ", item.PayrollLastDateOfMonth, item.ModifiedBy, item.ModifiedDate, item.ID);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Delete Function
internal static void Delete(TransactionContext tc, int monthEndProcessID)
{
tc.ExecuteNonQuery("DELETE FROM MonthEndProcess WHERE MonthEndProcessID=%n", monthEndProcessID);
}
public static void Delete(TransactionContext tc, int month, int year)
{
tc.ExecuteNonQuery("DELETE FROM [MonthEndProcess] WHERE Month=%n AND Year=%n", month, year);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, int monthEndProcessID)
{
return tc.ExecuteReader("SELECT * FROM MonthEndProcess WHERE MonthEndProcessID=%n", monthEndProcessID);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM MonthEndProcess");
}
internal static IDataReader GetByProjectID(TransactionContext tc, int projectID)
{
return tc.ExecuteReader("SELECT * FROM MonthEndProcess WHERE ProjectID = %n", projectID);
}
#endregion
}
}