EchoTex_Payroll/HRM.DA/DA/Attendance/ShiftRotationDA.cs

99 lines
3.3 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35.DataAccess;
using System.Data;
using HRM.BO;
using Ease.Core.DataAccess;
namespace HRM.DA
{
#region ShiftRotationDA
internal class ShiftRotationDA
{
#region Constructor
private ShiftRotationDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, ShiftRotation item)
{
tc.ExecuteNonQuery(
"INSERT INTO ShiftRotation(ShiftRotationID, ShiftID, CreatedBy, CreatedDate, SequenceNo, Status, workGroupType, payrolltypeid)" +
" VALUES(%n, %n, %n, %d, %n, %n, %n, %n)", item.ID, item.ShiftID, item.CreatedBy, item.CreatedDate,
item.Sequence, item.Status, item.WorkPlanType, item.payrollTypeID);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, ShiftRotation item)
{
tc.ExecuteNonQuery(
"UPDATE ShiftRotation SET ShiftID=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n, workGroupType=%n, payrolltypeid=%n" +
" WHERE ShiftRotationID=%n", item.ShiftID, item.ModifiedBy, item.ModifiedDate, item.Sequence,
item.Status, item.WorkPlanType, item.payrollTypeID, item.ID);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, EnumWorkPlanGroup workGroup)
{
return tc.ExecuteReader("SELECT * FROM ShiftRotation where workGroupType=%n Order by SequenceNo",
workGroup);
}
internal static IDataReader Get(TransactionContext tc, EnumWorkPlanGroup workGroup, int sequence)
{
return tc.ExecuteReader(
"SELECT * FROM ShiftRotation where workGroupType=%n AND SequenceNo=%n Order by SequenceNo", workGroup,
sequence);
}
//internal static IDataReader Get(TransactionContext tc, EnumWorkPlanGroup workGroup)
//{
// return tc.ExecuteReader("SELECT * FROM ShiftRotation where workGroupType=%n Order by SequenceNo",
// workGroup);
//}
internal static IDataReader Get(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM ShiftRotation WHERE ShiftRotationID=%n", nID);
}
internal static IDataReader Get(TransactionContext tc, EnumStatus status, int payrolltypeid)
{
if (status == EnumStatus.Regardless)
{
return tc.ExecuteReader("SELECT sr.*, s.ShortName ShortName FROM ShiftRotation sr, shift s where s.shiftid=sr.shiftid and sr.payrolltypeid=%n Order By sr.workGroupType", payrolltypeid);
}
else
{
return tc.ExecuteReader("SELECT sr.*, s.ShortName ShortName FROM ShiftRotation sr, shift s where s.shiftid=sr.shiftid and sr.Status=%n and sr.payrolltypeid=%n Order By sr.workGroupType", status, payrolltypeid);
}
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM [ShiftRotation] WHERE ShiftRotationID=%n", nID);
}
#endregion
}
#endregion
}