94 lines
2.8 KiB
C#
94 lines
2.8 KiB
C#
|
using System;
|
|||
|
using System.Data;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using HRM.BO;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
#region SkillDA
|
|||
|
|
|||
|
internal class SkillDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
private SkillDA()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert function
|
|||
|
|
|||
|
internal static void Insert(TransactionContext tc, Skill item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"INSERT INTO Skill(SkillID, Code, Name,ParentID,CreatedBy, CreationDate, SequenceNo,Status,Tire)" +
|
|||
|
" VALUES(%n, %s, %s, %n,%n, %d, %n,%n,%n)", item.ID, item.Code, item.Name,
|
|||
|
DataReader.GetNullValue(item.ParentID, 0), item.CreatedBy, item.CreatedDate, item.Sequence, item.Status,
|
|||
|
item.Tier);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, Skill item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"UPDATE Skill SET Code=%s, Name=%s,ParentID=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n,Tire=%n" +
|
|||
|
"WHERE SkillID=%n", item.Code, item.Name, DataReader.GetNullValue(item.ParentID, 0), item.ModifiedBy,
|
|||
|
item.ModifiedDate, item.Sequence, item.Status, item.Tier, item.ID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete function
|
|||
|
|
|||
|
internal static void Delete(TransactionContext tc, int nID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM Skill Where SkillID=%n", nID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM Skill Order By SequenceNo");
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM Skill Where SkillID=%n", nID);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetParents(TransactionContext tc, EnumStatus status)
|
|||
|
{
|
|||
|
if (EnumStatus.Active == status)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM Skill Where ParentID IS NULL and Status=%n Order By SequenceNo",
|
|||
|
status);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM Skill Where ParentID IS NULL Order By SequenceNo");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetChilds(TransactionContext tc, int parentID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM Skill Where ParentID=%n", parentID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
internal static bool IsExists(TransactionContext tc, string Code)
|
|||
|
{
|
|||
|
Object obj = tc.ExecuteScalar("Select Count(*) From Skill where Code = %s", Code);
|
|||
|
return Convert.ToInt32(obj) > 0;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|