EchoTex_Payroll/HRM.DA/DA/Basic/AutoObjectDA.cs
2024-10-14 10:01:49 +06:00

85 lines
2.5 KiB
C#

using Ease.Core.DataAccess;
using System;
using System.Data;
using HRM.BO;
namespace HRM.DA
{
internal class AutoObjectDA
{
#region Constructor
private AutoObjectDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, AutoObject item)
{
tc.ExecuteNonQuery("INSERT INTO AutoObjectName(TableID, FormName,MenuKey)" +
" VALUES(%n, %s,%s)", item.ID, item.Name, item.MenuKey);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, AutoObject item)
{
tc.ExecuteNonQuery("UPDATE AutoObjectName SET FormName=%s,MenuKey=%s" +
" WHERE TableID=%n", item.Name, item.MenuKey, item.ID);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, string sFormName)
{
return tc.ExecuteReader("SELECT * FROM AutoObjectName WHERE MenuKey=%s", sFormName);
}
internal static DataSet GetInformation(TransactionContext tc, DateTime FromDate, DateTime ToDate,
string sTableName)
{
DataSet ds = new DataSet();
try
{
ds = tc.ExecuteDataSet("select a.Code,a.description Name,case a.__$operation " +
"when 1 then 'Deleted' " +
"when 2 then 'Inserted' " +
"when 3 then 'Before Updated'" +
"when 4 then 'After Updated'" +
" end operation,b.tran_begin_time fromdate from cdc.dbo_Category_CT a, cdc.lsn_time_mapping b" +
" where a.__$start_lsn=b.start_lsn AND b.tran_begin_time between %D AND %D ORDER BY b.tran_begin_time",
FromDate, ToDate);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return ds;
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int ID)
{
tc.ExecuteNonQuery("DELETE FROM AutoObjectName WHERE TableID=%n", ID);
}
internal static void DeleteAll(TransactionContext tc)
{
tc.ExecuteNonQuery("DELETE FROM AutoObjectName");
}
#endregion
}
}