CEL_Payroll/Payroll.Service/Organogram/DA/SkillLevelDA.cs

90 lines
2.8 KiB
C#
Raw Permalink 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 SkilLevelDA
internal class SkillLevelDA
{
#region Constructor
private SkillLevelDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, SkillLevel item)
{
//SkillPoint
tc.ExecuteNonQuery("INSERT INTO SkillLevel(SkillLevelID, Code, Name,CreatedBy, CreationDate, SequenceNo,Status)" +
" VALUES(%n, %s, %s,%n, %d, %n,%n)", item.ID.Integer, item.Code, item.Name,item.CreatedBy.Integer, item.CreatedDate,item.Sequence,item.Status );
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, SkillLevel item)
{
tc.ExecuteNonQuery("UPDATE SkillLevel SET Code=%s, Name=%s,ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" +
"WHERE SkillLevelID=%n", item.Code, item.Name,item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status, item.ID.Integer);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("DELETE FROM [SkillLevel] Where SkillLevelID=%n", nID.Integer);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM SkillLevel Order By SequenceNo");
}
internal static IDataReader Get(TransactionContext tc, ID nID)
{
return tc.ExecuteReader("SELECT * FROM SkillLevel Where SkillLevelID=%n", nID.Integer);
}
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
{
if (EnumStatus.Active == status)
{
return tc.ExecuteReader("SELECT * FROM SkillLevel Where Status=%n Order By SequenceNo", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM SkillLevel Order By SequenceNo");
}
}
//internal static IDataReader GetChilds(TransactionContext tc, ID parentID)
//{
// return tc.ExecuteReader("SELECT * FROM SkillLevel Where ParentID=%n", parentID.Integer);
//}
#endregion
internal static bool IsExists(TransactionContext tc, string Code)
{
Object obj = tc.ExecuteScalar("Select Count(*) From SkillLevel where Code = %s", Code);
return Convert.ToInt32(obj) > 0;
}
}
#endregion
}