CEL_Payroll/Payroll.Service/Attendence/DA/OutsideDutyDA.cs
2024-09-17 14:30:13 +06:00

84 lines
2.4 KiB
C#

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 OutsideDutyDA
internal class OutsideDutyDA
{
#region Constructor
private OutsideDutyDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, OutsideDuty item)
{
tc.ExecuteNonQuery("INSERT INTO OutsideDuty(OutsideDutyID, Name, SequenceNo, Status, CreatedBy, CreatedDate)" +
" VALUES(%n, %s, %n, %n, %n, %D)", item.ID.Integer, item.Name, item.Sequence, item.Status, item.CreatedBy.Integer, item.CreatedDate);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, OutsideDuty item)
{
tc.ExecuteNonQuery("UPDATE OutsideDuty SET Name=%s, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" +
" WHERE OutsideDutyID=%n", item.Name, item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status, item.ID.Integer);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, Payroll.BO.EnumStatus status)
{
if (EnumStatus.Active == status)
{
return tc.ExecuteReader("SELECT * FROM OutsideDuty where Status=%n Order By SequenceNo", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM OutsideDuty Order By SequenceNo");
}
//return tc.ExecuteReader("SELECT * FROM OutsideDuty Where Status=%n Order By SequenceNo", status);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM OutsideDuty");
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM OutsideDuty WHERE OutsideDutyID=%n", nID.Integer);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM OutsideDuty WHERE OutsideDutyID=%n", nID.Integer);
}
#endregion
}
#endregion
}