CEL_Payroll/Payroll.Service/HRBasic/DA/ExtraCurricularActivityDA.cs

82 lines
2.8 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using Payroll.BO;
using System.Data;
using System.Linq;
using Ease.CoreV35.Model;
using System.Data.SqlClient;
using Ease.CoreV35.DataAccess;
using System.Collections.Generic;
using Ease.CoreV35.DataAccess.SQL;
namespace Payroll.Service
{
#region class ExtraCurricularActivityDA
internal class ExtraCurricularActivityDA
{
#region constructor
public ExtraCurricularActivityDA()
{ }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, ExtraCurricularActivity item)
{
tc.ExecuteNonQuery("INSERT INTO EXTRACURRICULARACTIVITY(EXTRACURRICULARACTIVITYID, CODE, DESCRIPTION, SEQUENCENO, STATUS, CREATEDBY, CREATIONDATE)" +
" VALUES(%n, %s, %s, %n, %n, %n, %d)", item.ID.Integer, item.Code, item.Description, item.Sequence, item.Status, item.CreatedBy.Integer, item.CreatedDate);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, ExtraCurricularActivity item)
{
tc.ExecuteNonQuery("UPDATE EXTRACURRICULARACTIVITY SET code=%s, description=%s, sequencenO=%n, status=%n, modifiedby=%n, modifieddate=%d" +
" WHERE EXTRACURRICULARACTIVITYID=%n", item.Code, item.Description, item.Sequence, item.Status, item.ModifiedBy.Integer, item.ModifiedDate, item.ID.Integer);
}
#endregion
#region Get function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM EXTRACURRICULARACTIVITY");
}
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
{
if(EnumStatus.Active==status)
{
return tc.ExecuteReader("SELECT * FROM EXTRACURRICULARACTIVITY Where Status=%n Order By SequenceNo", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM EXTRACURRICULARACTIVITY Order By SequenceNo");
}
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM EXTRACURRICULARACTIVITY WHERE EXTRACURRICULARACTIVITYID=%n", nID.Integer);
}
internal static IDataReader Get(TransactionContext tc, string sCode)
{
return tc.ExecuteReader("SELECT * FROM EXTRACURRICULARACTIVITY WHERE Code=%s",sCode);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM [EXTRACURRICULARACTIVITY] WHERE EXTRACURRICULARACTIVITYID=%n", nID.Integer);
}
#endregion
}
#endregion
}