CEL_Payroll/Payroll.Service/Attendence/DA/AttnProcessRunSummaryDA.cs

87 lines
3.8 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35.DataAccess;
using Payroll.BO;
using System.Data;
using Ease.CoreV35.Model;
using Payroll.BO;
namespace Payroll.Service
{
class AttnProcessRunSummaryDA
{
#region Get
internal static IDataReader Get(TransactionContext tc, ID PayrolltypeID)
{
return tc.ExecuteReader("SELECT * FROM AttnProcessRunSummary Where PayrollTypeID = %n", PayrolltypeID.Integer);
}
internal static IDataReader GetByStatus(TransactionContext tc, EnumProcessStatus ProcessStatus, ID PayrolltypeID)
{
return tc.ExecuteReader("SELECT * FROM AttnProcessRunSummary aprs WHERE aprs.ProcessStatus = %n And PayrollTypeID = %n", (int)ProcessStatus, PayrolltypeID.Integer);
}
internal static IDataReader GetByMode(TransactionContext tc, EnumProcessMode ProcessMode, ID PayrolltypeID)
{
return tc.ExecuteReader("SELECT * FROM AttnProcessRunSummary aprs WHERE aprs.ProcessMode = %n And PayrollTypeID = %n", (int)ProcessMode, PayrolltypeID.Integer);
}
internal static IDataReader Get(TransactionContext tc, ID id, ID PayrolltypeID)
{
return tc.ExecuteReader("SELECT * FROM AttnProcessRunSummary Where AttnProcessRunSummeryID=%n And PayrollTypeID = %n", id.Integer, PayrolltypeID.Integer);
}
internal static IDataReader GetAttnProcessRunDetails(TransactionContext tc, ID id)
{
return tc.ExecuteReader("SELECT * FROM AttnProcessRunDetail aprd WHERE aprd.AttnProcessSummaryID = %n", id.Integer);
}
#endregion
#region Insert
internal static void Insert(TransactionContext tc, AttnProcessRunSummary oAttnProcessRunSummary)
{
string sql = SQLParser.MakeSQL(@"INSERT INTO AttnProcessRunSummary(AttnProcessRunSummeryID, ProcessDate, ProcessMode, ProcessBy, ProcessStatus,PayrollTypeID)" +
" VALUES(%n, %d, %n, %n, %n,%n)", oAttnProcessRunSummary.ID.Integer, oAttnProcessRunSummary.ProcessDate, (int)oAttnProcessRunSummary.ProcessMode, DataReader.GetNullValue(oAttnProcessRunSummary.ProcessBy, IDType.Integer), (int)oAttnProcessRunSummary.ProcessStatus,oAttnProcessRunSummary.PayrollTypeID.Integer);
tc.ExecuteNonQuery(sql);
}
internal static void InsertAttnProcessRunDetail(TransactionContext tc, AttnProcessRunDetail item)
{
string sql = SQLParser.MakeSQL(@"INSERT INTO AttnProcessRunDetail(AttnProcessRunDetailID, AttnProcessSummaryID, ErrorType, EmployeeNo, EmployeeName,Description, LocationID)" +
" VALUES(%n, %n, %n, %s, %s,%s, %n)", item.ID.Integer, item.ProcessSummaryID.Integer, (int)item.EnumErrorType, item.EmployeeNo, item.EmployeeName, item.Description, DataReader.GetNullValue(item.LocationID, IDType.Integer));
tc.ExecuteNonQuery(sql);
}
#endregion
#region Update
internal static void Update(TransactionContext tc, AttnProcessRunSummary oAttnProcessRunSummary)
{
string sql = SQLParser.MakeSQL("Update AttnProcessRunSummary Set ProcessDate = %d, ProcessMode = %n, ProcessBy = %n, ProcessStatus = %n where AttnProcessRunSummeryID = %n",
oAttnProcessRunSummary.ProcessDate, (int)oAttnProcessRunSummary.ProcessMode, DataReader.GetNullValue(oAttnProcessRunSummary.ProcessBy, IDType.Integer), (int)oAttnProcessRunSummary.ProcessStatus, oAttnProcessRunSummary.ID.Integer);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Delete
internal static void DeleteAttnProcessRunDetails(TransactionContext tc, ID iD)
{
tc.ExecuteNonQuery("Delete From AttnProcessRunDetail Where AttnProcessSummaryID=%n", iD.Integer);
}
#endregion
}
}