CEL_Payroll/Payroll.Service/Basic/DA/ApproveFinantialDataDA.cs

75 lines
2.7 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 ApproveFinantialDataDA
internal class ApproveFinantialDataDA
{
#region Constructor
private ApproveFinantialDataDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, ApproveFinantialData item)
{
tc.ExecuteNonQuery("INSERT INTO ApproveFinantialData(ApproveID,FinanatialDataType, EmployeeID, ObjectID,SalaryMonth,Approvedby,ApprovedDate)" +
" VALUES(%n, %n,%n,%n,%d,%n,%D)", item.ID.Integer, item.FinanatialDataType, DataReader.GetNullValue(item.EmployeeID, IDType.Integer),
item.ObjectID, item.SalaryMonth, item.Approvedby, item.ApprovedDate);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, ApproveFinantialData item)
{
tc.ExecuteNonQuery("UPDATE ApproveFinantialData SET FinanatialDataType=%n, EmployeeID=%n, ObjectID=%n,SalaryMonth=%d,Approvedby=%n,ApprovedDate=%D" +
"WHERE ApproveID=%n", item.FinanatialDataType, DataReader.GetNullValue(item.EmployeeID, IDType.Integer), item.ObjectID, item.SalaryMonth, item.Approvedby, item.ApprovedDate, item.ID.Integer);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM ApproveFinantialData Order By FinanatialDataType");
}
internal static IDataReader Get(TransactionContext tc, int EmpID, DateTime dt)
{
return tc.ExecuteReader("SELECT * FROM ApproveFinantialData WHERE EmployeeID=%n AND SalaryMonth=%d", EmpID, dt);
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM ApproveFinantialData Where ObjectID=%n", nID.Integer);
}
internal static IDataReader GetByMonth(TransactionContext tc, DateTime dtStart, DateTime dtEnd)
{
return tc.ExecuteReader("SELECT * FROM ApproveFinantialData Where SalaryMonth between %d AND %d", dtStart, dtEnd);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ApproveFinantialData item)
{
tc.ExecuteNonQuery("DELETE FROM ApproveFinantialData Where objectID=%n AND FinanatialDataType=%n", item.ObjectID, (int)item.FinanatialDataType);
}
#endregion
}
#endregion
}