107 lines
3.6 KiB
C#
107 lines
3.6 KiB
C#
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
using System;
|
|
using System.Data;
|
|
|
|
|
|
namespace HRM.DA
|
|
{
|
|
#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, payrolltypeid, nameinbangla)" +
|
|
" VALUES(%n, %s, %s, %n, %d, %n, %n,%n, %n, %u)", item.ID, item.Code, item.Name, item.CreatedBy,
|
|
item.CreatedDate, item.Sequence, item.Status, item.TermType, item.payrolltypeid, item.NameInBangla);
|
|
}
|
|
|
|
#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" +
|
|
", payrolltypeid=%n, nameinbangla=%u WHERE termID=%n", item.Code, item.Name, item.ModifiedBy, item.ModifiedDate, item.Sequence,
|
|
item.Status, item.TermType, item.payrolltypeid, item.NameInBangla, item.ID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader GetAllTerm(TransactionContext tc, int payrollTypeID, EnumStatus status, string code,
|
|
string name)
|
|
{
|
|
string sqlClause = string.Empty;
|
|
sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("PayrollTypeID = %n", payrollTypeID);
|
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|
{
|
|
sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("status = %n", status);
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(code))
|
|
{
|
|
sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("Code = %s", code);
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(name))
|
|
{
|
|
sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("Name LIKE %s", ("%" + name + "%"));
|
|
}
|
|
|
|
return tc.ExecuteReader("SELECT * FROM Term %q order by SequenceNo", sqlClause);
|
|
}
|
|
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status, int payrolltypeid)
|
|
{
|
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Term where Status=%n and payrolltypeid=%n Order By SequenceNo", status, payrolltypeid);
|
|
}
|
|
else
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Term where payrolltypeid=%n Order By SequenceNo", payrolltypeid);
|
|
}
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Term WHERE termID=%n", nID);
|
|
}
|
|
|
|
internal static IDataReader GetBySlabTerm(TransactionContext tc, EnumTermType slabType, int payrolltypeid)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Term WHERE TermType=%n", slabType, payrolltypeid);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, int nID)
|
|
{
|
|
// tc.ExecuteNonQuery("UPDATE Term SET CreatedBy=%n,ModifiedBy=%n Where termID=%n", User.CurrentUser.ID, User.CurrentUser.ID, nID);
|
|
tc.ExecuteNonQuery("DELETE FROM Term WHERE termID=%n", nID);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
} |