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

76 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35.DataAccess;
using System.Data;
using Ease.CoreV35.Model;
using Payroll.BO;
namespace Payroll.Service.Attendence.DA
{
#region BuyerSetupDA
internal class BuyerSetupDA
{
#region Constructor
private BuyerSetupDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, BuyerSetup item)
{
tc.ExecuteNonQuery("INSERT INTO BuyerSetup(BuyerSetupID, Name, AcceptHour, IsCurrent, CreatedBy, CreatedDate, SequenceNo, Status)" +
" VALUES(%n, %s, %n, %b, %n, %d, %n, %n)", item.ID.Integer, item.Name, item.AcceptHour, item.IsCurrent, item.CreatedBy.Integer, item.CreatedDate, item.Sequence, item.Status);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, BuyerSetup item)
{
tc.ExecuteNonQuery("update BuyerSetup set IsCurrent=0");
tc.ExecuteNonQuery("UPDATE BuyerSetup SET Name=%s, AcceptHour=%n, IsCurrent=%b, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" +
" WHERE BuyerSetupID=%n", item.Name, item.AcceptHour, item.IsCurrent, item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status, item.ID.Integer);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM BuyerSetup");
}
internal static IDataReader GetCurrentBuyer(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM BuyerSetup WHERE ISCURRENT=1");
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM BuyerSetup WHERE BuyerSetupID=%n", nID.Integer);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM [BuyerSetup] WHERE BuyerSetupID=%n", nID.Integer);
}
#endregion
}
#endregion
}