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

81 lines
2.6 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 Payroll.BO;
using Ease.CoreV35.Model;
using System.Data;
namespace Payroll.Service.Attendence.DA
{
#region AttnNationalHolidayDA
internal class AttnNationalHolidayDA
{
#region Constructor
private AttnNationalHolidayDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, AttnNationalHoliday item)
{
tc.ExecuteNonQuery("INSERT INTO AttnNationalHoliday(AttnNationalHolidayID, Description, FromDate, ToDate, CreatedBy, CreatedDate,SequenceNo,Status)" +
" VALUES(%n, %s, %d, %d, %n, %d,%n,%n)", item.ID.Integer, item.Description, item.FromDate, item.ToDate, item.CreatedBy.Integer, item.CreatedDate, item.Sequence, item.Status);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, AttnNationalHoliday item)
{
tc.ExecuteNonQuery("UPDATE AttnNationalHoliday SET Description=%s, FromDate=%d, ToDate=%d, ModifiedBy=%n, ModifiedDate=%d,Status=%n,SequenceNo=%n" +
" WHERE AttnNationalHolidayID=%n", item.Description, item.FromDate, item.ToDate, item.ModifiedBy.Integer, item.ModifiedDate, item.Status, item.Sequence, item.ID.Integer);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
{
if (EnumStatus.Active == status)
{
return tc.ExecuteReader("SELECT * FROM AttnNationalHoliday where Status=%n Order By SequenceNo", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM AttnNationalHoliday Order By SequenceNo");
}
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM AttnNationalHoliday WHERE AttnNationalHolidayID=%n", nID);
}
internal static IDataReader Get(TransactionContext tc, DateTime fromDate, DateTime todate)
{
return tc.ExecuteReader("SELECT * FROM AttnNationalHoliday WHERE FromDate between %d and %d", fromDate, todate);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM [AttnNationalHoliday] WHERE AttnNationalHolidayID=%n", nID.Integer);
}
#endregion
}
#endregion
}