EchoTex_Payroll/HRM.DA/DA/Fund/VoucherSetup/ProcessActivityDA.cs

106 lines
3.5 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA.Fund
{
internal class ProcessActivityDA
{
#region Constructor
public ProcessActivityDA()
{
}
#endregion
#region Insert Function
internal static void Insert(TransactionContext tc, ProcessActivity oItem)
{
string sql = SQLParser.MakeSQL(
"INSERT INTO ProcessActivity(Serial, ActivityID, ProcessID, ProjectID, Description, ActivityRelatedTo, RelatedValue,CreatedBy, CreatedDate)" +
" VALUES(%n, %n, %n, %n, %s, %n, %n, %n, %d)", oItem.Serial, oItem.ID, oItem.ProcessID, oItem.ID,
oItem.Description,
oItem.ActivityRelatedTo, oItem.RelatedValue, oItem.CreatedBy, oItem.CreatedDate);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, ProcessActivity oItem)
{
string sql = SQLParser.MakeSQL(
"UPDATE ProcessActivity SET ProcessID=%n, ProjectID=%n, Description=%s, ActivityRelatedTo=%n, RelatedValue=%n,ModifiedBy=%n, ModifiedDate=%d" +
" WHERE ActivityID=%n", oItem.ProcessID, oItem.ID, oItem.Description, oItem.ActivityRelatedTo,
oItem.RelatedValue,
oItem.ModifiedBy, oItem.ModifiedDate, oItem.ID);
tc.ExecuteNonQuery(sql);
}
internal static void UpdatePosition(TransactionContext tc, ProcessActivity oItem)
{
tc.ExecuteNonQuery("UPDATE ProcessActivity SET Serial=%n WHERE ActivityID=%n", oItem.Serial, oItem.ID);
}
#endregion
#region Delete Function
internal static void Delete(TransactionContext tc, int Id)
{
tc.ExecuteNonQuery("DELETE FROM ProcessActivity WHERE ActivityID=%n", Id);
}
#endregion
#region Get Function
internal static int GetMaxSerial(TransactionContext tc)
{
int maxSerial = 0;
object ob = tc.ExecuteScalar("SELECT Max(Serial) FROM ProcessActivity");
if (ob != DBNull.Value)
{
maxSerial = Convert.ToInt32(ob);
}
return maxSerial;
}
internal static IDataReader Get(TransactionContext tc, int ID, int fundtypeid)
{
return tc.ExecuteReader("SELECT * FROM ProcessActivity WHERE SetupID=%n AND ProjectID=%n order by Serial",
ID, fundtypeid);
}
internal static IDataReader Get(TransactionContext tc, int fundtypeid)
{
return tc.ExecuteReader("SELECT * FROM ProcessActivity Where ProjectID=%n order by Serial", fundtypeid);
}
internal static IDataReader GetbyProjectID(TransactionContext tc, int ID)
{
return tc.ExecuteReader("SELECT * FROM ProcessActivity WHERE ProjectID=%n order by Serial", ID);
}
internal static IDataReader GetbyProcessID(TransactionContext tc, int ID)
{
return tc.ExecuteReader("SELECT * FROM ProcessActivity WHERE ProcessID=%n order by Serial", ID);
}
internal static IDataReader GetbyProjectProcessID(TransactionContext tc, int Projectid, int Processid)
{
return tc.ExecuteReader(
"SELECT * FROM ProcessActivity WHERE ProjectID=%n AND ProcessID=%n order by Serial ", Projectid,
Processid);
}
#endregion
}
}