102 lines
3.4 KiB
C#
102 lines
3.4 KiB
C#
|
using HRM.BO;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using System;
|
|||
|
using System.Data;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
internal class GradeSegmentDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
private GradeSegmentDA()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert function
|
|||
|
|
|||
|
internal static void Insert(TransactionContext tc, GradeSegment item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"INSERT INTO GradeSegment(GradeSegmentID, code, description,BasicPer, CreatedBy, CreationDate, SequenceNo, Status)" +
|
|||
|
" VALUES(%n, %s, %s, %n, %n,%d, %n, %n)", item.ID, item.Code, item.Name, item.BasicPer, item.CreatedBy,
|
|||
|
item.CreatedDate, item.Sequence, 1);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, GradeSegment item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"UPDATE GradeSegment SET code=%s, description=%s,BasicPer=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" +
|
|||
|
" WHERE GradeSegmentID=%n", item.Code, item.Name, item.BasicPer, item.ModifiedBy, item.ModifiedDate,
|
|||
|
item.Sequence, item.Status, item.ID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|||
|
{
|
|||
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM GradeSegment Where Status=%n Order By SequenceNo", status);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM GradeSegment Order By SequenceNo");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, int ID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM GradeSegment WHERE GradeSegmentID=%n", ID);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, string sCode)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM GradeSegment WHERE Code=%s", sCode);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetAllGradeSegment(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 GradeSegment %q Order By SequenceNo", sqlClause, payrollTypeID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete function
|
|||
|
|
|||
|
internal static void Delete(TransactionContext tc, int ID, int userID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("UPDATE GradeSegment SET CreatedBy=%n,ModifiedBy=%n Where GradeSegmentID=%n", userID,
|
|||
|
userID, ID);
|
|||
|
tc.ExecuteNonQuery("DELETE FROM GradeSegment WHERE GradeSegmentID=%n", ID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|