EchoTex_Payroll/HRM.DA/DA/Fund/Transaction/TranElementDA.cs
2024-10-14 10:01:49 +06:00

82 lines
2.4 KiB
C#

using System;
using System.Data;
using System.Linq;
using System.Text;
using Ease.Core.DataAccess;
using HRM.BO;
namespace HRM.DA
{
internal class TranElementDA
{
#region Constructor
public TranElementDA()
{
}
#endregion
#region Insert Function
internal static void Insert(TransactionContext tc, TranElement tran)
{
string sql = SQLParser.MakeSQL(
"INSERT INTO TranElement (TranElementID,TranElementName,Source,ProjectID,CreatedBy,CreatedDate)" +
" VALUES(%n,%s,%s,%n,%n,%D)", tran.ID, tran.Name, tran.Source, tran.ProjectID, tran.CreatedBy,
tran.CreatedDate);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, TranElement tran)
{
string sql = SQLParser.MakeSQL(
"UPDATE TranElement Set Name = %s, Source = %s, ProjectID = %n, ModifiedBy = %n, ModifiedDate = %D" +
"WHERE TranElementID = %n ", tran.Name, tran.Source, tran.ProjectID, tran.ModifiedBy, tran.ModifiedDate,
tran.ID);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Delete Function
internal static void Delete(TransactionContext tc, int tranId)
{
tc.ExecuteNonQuery("DELETE FROM TranElement WHERE TranElementID=%n", tranId);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, int tranID)
{
return tc.ExecuteReader("SELECT * FROM TranElement WHERE TranElementID=%n", tranID);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM TranElement");
}
internal static IDataReader Get(TransactionContext tc, string source)
{
return tc.ExecuteReader("SELECT * FROM TranElement WHERE SourceTablename=%s", source);
}
internal static IDataReader Get(TransactionContext tc, string source, EnumElementType ntype)
{
string sSQL = SQLParser.MakeSQL("SELECT * FROM TranElement WHERE SourceTablename=%s AND ElementType=%n",
source, ntype);
return tc.ExecuteReader(sSQL);
}
#endregion
}
}