CEL_Payroll/Payroll.Service/SAPLookUp/DA/SAPDataDumpDA.cs

75 lines
4.4 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 System.Data;
using Ease.CoreV35.DataAccess;
using Ease.CoreV35.Model;
using Payroll.BO;
namespace Payroll.Service
{
#region SAPDataDumpDA
class SAPDataDumpDA
{
internal static IDataReader Get(TransactionContext tc, ID id)
{
string sql = SQLParser.MakeSQL(@"select * from SAPDataDump where SAPDataDumpID=%n", id.Integer);
return tc.ExecuteReader(sql);
}
internal static IDataReader Get(TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"select * from SAPDataDump order by Name");
return tc.ExecuteReader(sql);
}
internal static void Insert(TransactionContext tc, SAPDataDump item)
{
string sql = SQLParser.MakeSQL(@"INSERT INTO SAPDataDump
(SAPDataDumpID, EmployeeID, LastName,
FirstName, EmailAddress, GDDBID,
BirthDate, JoiningDate, ReHiringDate,
ReligionCode, Gender, MaritalStatus,
NationalityCode, TIN, LocalJobGrade,
BasicSalary, LocationCode, DesignationCode,
CostCenterCode, BankCode, BankAccountNo,
ConfirmationDate, DiscontinueEffectDate, FileName
)
VALUES(%n, %n, %s,
%s, %s, %s,
%D, %D, %D,
%s, %n, %n,
%s, %s, %s,
%n, %s, %s,
%s, %s, %s,
%D, %D, %s)",
item.ID.Integer, item.EmployeeID.Integer, DataReader.GetNullValue(item.LastName),
DataReader.GetNullValue(item.FirstName), DataReader.GetNullValue(item.EmailAddress), DataReader.GetNullValue(item.GDDBID),
DataReader.GetNullValue(item.BirthDate), DataReader.GetNullValue(item.JoiningDate), DataReader.GetNullValue(item.ReHiringDate),
DataReader.GetNullValue(item.ReligionCode), (int)item.Gender, (int)item.MaritalStatus,
DataReader.GetNullValue(item.NationalityCode), DataReader.GetNullValue(item.TIN), DataReader.GetNullValue(item.LocalJobGrade),
DataReader.GetNullValue(item.BasicSalary), DataReader.GetNullValue(item.LocationCode), DataReader.GetNullValue(item.DesignationCode),
DataReader.GetNullValue(item.CostCenterCode), DataReader.GetNullValue(item.BankCode), DataReader.GetNullValue(item.BankAccountNo),
DataReader.GetNullValue(item.ConfirmationDate), DataReader.GetNullValue(item.DiscontinueEffectDate), DataReader.GetNullValue(item.FileName));
tc.ExecuteNonQuery(sql);
}
internal static void Update(TransactionContext tc, SAPDataDump item)
{
string sql = SQLParser.MakeSQL(@"UPDATE SAPDataDump SET EmployeeID=%n,LastName=%s,FirstName=%s,EmailAddress=%s,GDDBID=%s,BirthDate=%D,JoiningDate=%D,ReHiringDate=%D,ReligionCode=%s,Gender=%n,MaritalStatus=%n,NationalityCode=%s,TIN=%s,LocalJobGrade=%s,BasicSalary=%n,LocationCode=%s,DesignationCode=%s,CostCenterCode=%s,BankCode=%s,BankAccountNo=%s,ConfirmationDate=%D,DiscontinueEffectDate=%D,FileName=%s Where SAPDataDumpID=%n"
, item.EmployeeID.Integer, item.LastName, item.FirstName, item.EmailAddress, item.GDDBID, item.BirthDate, item.JoiningDate, item.ReHiringDate, item.ReligionCode, (int)item.Gender, (int)item.MaritalStatus, item.NationalityCode, item.TIN, item.LocalJobGrade, item.BasicSalary, item.LocationCode, item.DesignationCode, item.CostCenterCode, item.BankCode, item.BankAccountNo, item.ConfirmationDate, item.DiscontinueEffectDate, item.FileName, item.ID.Integer);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(TransactionContext tc, ID id)
{
string sql = SQLParser.MakeSQL("delete from SAPDataDump where SAPDataDumpID=%n", id.Integer);
tc.ExecuteNonQuery(sql);
}
}
#endregion
}