90 lines
2.6 KiB
C#
90 lines
2.6 KiB
C#
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
using System;
|
|
using System.Data;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
#region HRDocDA
|
|
|
|
public class HRDocDA
|
|
{
|
|
#region Constructor
|
|
|
|
private HRDocDA()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int id)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM HRDoc WHERE HRDocID=%n", id);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM HRDoc");
|
|
}
|
|
|
|
internal static IDataReader GetParent(TransactionContext tc, EnumStatus status)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM HRDoc WHERE Status=%n", status);
|
|
}
|
|
|
|
internal static IDataReader GetChilds(TransactionContext tc, int parentID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM HRDoc Where ParentID=%n", parentID);
|
|
}
|
|
|
|
|
|
internal static bool IsExists(TransactionContext tc, string Code)
|
|
{
|
|
Object obj = tc.ExecuteScalar("Select Count(*) From HRDoc where Code = %s", Code);
|
|
return Convert.ToInt32(obj) > 0;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insert
|
|
|
|
internal static void Insert(TransactionContext tc, HRDoc oHRDoc)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO HRDoc(HRDocID, Code, Name,Description,ParentID,Status," +
|
|
" CreatedBy, CreationDate)" +
|
|
" VALUES(%n, %s, %s, %s, %n,%n,%n,%d)",
|
|
oHRDoc.ID, oHRDoc.Code, oHRDoc.Name, oHRDoc.Description, DataReader.GetNullValue(oHRDoc.ParentID, 0),
|
|
oHRDoc.Status, DataReader.GetNullValue(oHRDoc.CreatedBy),
|
|
DataReader.GetNullValue(oHRDoc.CreatedDate));
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update
|
|
|
|
internal static void Update(TransactionContext tc, HRDoc oHRDoc)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"UPDATE HRDoc SET Code=%s,Name=%s,Description=%s,ParentID=%n,Status=%n, ModifiedBy=%n,ModifiedDate=%d WHERE HRDocID=%n",
|
|
oHRDoc.Code, oHRDoc.Name, oHRDoc.Description, DataReader.GetNullValue(oHRDoc.ParentID, 0),
|
|
oHRDoc.Status,
|
|
DataReader.GetNullValue(oHRDoc.ModifiedBy),
|
|
DataReader.GetNullValue(oHRDoc.ModifiedDate), oHRDoc.ID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete
|
|
|
|
internal static void Delete(TransactionContext tc, int id)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM HRDoc WHERE HRDocID=%n", id);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
} |