86 lines
2.8 KiB
C#
86 lines
2.8 KiB
C#
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 TermDA
|
|
|
|
internal class TermDA
|
|
{
|
|
#region Constructor
|
|
|
|
private TermDA() { }
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, Term item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO Term(termID, code, name, CreatedBy, CreationDate, SequenceNo, Status,TermType,EntityMode,MaxValue,ItemCode,IsFestival)" +
|
|
" VALUES(%n, %s, %s, %n, %d, %n, %n,%n,%n,%n,%s,%b)", item.ID.Integer, item.Code, item.Name, item.CreatedBy.Integer, item.CreatedDate, item.Sequence, item.Status,item.TermType,item.EntityMode,item.MaxValue,item.ItemCode,item.IsFestival);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, Term item)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE Term SET code=%s, name=%s, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n,TermType=%n,EntityMode=%n,MaxValue=%n,ItemCode=%s,IsFestival=%b" +
|
|
" WHERE termID=%n", item.Code, item.Name, item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status, item.TermType, item.EntityMode, item.MaxValue, item.ItemCode, item.IsFestival,item.ID.Integer);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc,EnumStatus status)
|
|
{
|
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Term where Status=%n Order By SequenceNo",status);
|
|
}
|
|
else
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Term Order By SequenceNo");
|
|
}
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, ID nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Term WHERE termID=%n", nID.Integer);
|
|
}
|
|
|
|
internal static IDataReader GetBySlabTerm(TransactionContext tc, EnumTermType slabType)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Term WHERE TermType=%n", slabType);
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, ID nID)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE [Term] SET CreatedBy=%n,ModifiedBy=%n Where termID=%n", Payroll.BO.User.CurrentUser.ID.Integer, Payroll.BO.User.CurrentUser.ID.Integer, nID.Integer);
|
|
tc.ExecuteNonQuery("DELETE FROM [Term] WHERE termID=%n", nID.Integer);
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
}
|