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

88 lines
3.1 KiB
C#
Raw 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 Ease.CoreV35.Model;
using System.Data;
using Payroll.BO;
namespace Payroll.Service.Attendence.DA
{
#region WorkPlanGroupDA
internal class WorkPlanGroupDA
{
#region Constructor
private WorkPlanGroupDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, WorkPlanGroup item, ID PayrolltypeID)
{
tc.ExecuteNonQuery("INSERT INTO WorkPlanGroup(WorkPlanGroupID, Name, Type, CreatedBy, CreatedDate, SequenceNo, Status, FromTime, ToTime,PayrollTypeID)" +
" VALUES(%n, %s, %n, %n, %d, %n, %n, %D, %D, %n)", item.ID.Integer, item.Name, item.Type, item.CreatedBy.Integer, item.CreatedDate, item.Sequence, item.Status, item.FromTime,item.ToTime, PayrolltypeID.Integer);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, WorkPlanGroup item, ID PayrolltypeID)
{
tc.ExecuteNonQuery("UPDATE WorkPlanGroup SET Name=%s, Type=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n, FromTime = %D, ToTime = %D, PayrollTypeID=%n" +
" WHERE WorkPlanGroupID=%n", item.Name, item.Type, item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status, item.FromTime, item.ToTime, PayrolltypeID.Integer, item.ID.Integer);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, ID PayrolltypeID)
{
return tc.ExecuteReader("SELECT * FROM WorkPlanGroup WHERE PayrollTypeID=%n", PayrolltypeID.Integer);
}
internal static IDataReader Get(TransactionContext tc, ID nID, ID PayrolltypeID)
{
return tc.ExecuteReader("SELECT * FROM WorkPlanGroup WHERE WorkPlanGroupID=%n and PayrollTypeID=%n", nID.Integer,PayrolltypeID.Integer);
}
internal static IDataReader Get(TransactionContext tc, EnumStatus status, ID PayrolltypeID)
{
if (EnumStatus.Active == status)
{
return tc.ExecuteReader("SELECT * FROM WorkPlanGroup where Status=%n and PayrollTypeID=%n order by SequenceNO", status, PayrolltypeID.Integer);
}
else
{
return tc.ExecuteReader("SELECT * FROM WorkPlanGroup where PayrollTypeID=%n order by SequenceNO", PayrolltypeID.Integer);
}
}
internal static IDataReader Get(TransactionContext tc, EnumWorkPlanGroup wpg, ID PayrolltypeID)
{
return tc.ExecuteReader("SELECT * FROM WorkPlanGroup where Type=%n and PayrollTypeID=%n order by SequenceNO", wpg, PayrolltypeID.Integer);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM [WorkPlanGroup] WHERE WorkPlanGroupID=%n", nID.Integer);
}
#endregion
}
#endregion
}