HRM-10/HRM.DA/DA/Fund/VoucherSetup/ActivityVoucherSetupDA.cs
Mohaimen Hasan 838b8d4480 first commit
2026-11-03 13:06:00 +06:00

146 lines
5.6 KiB
C#

using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
internal class ActivityVoucherSetupDA
{
#region Constructor
public ActivityVoucherSetupDA()
{
}
#endregion
#region Insert Function
internal static void Insert(TransactionContext tc, ActivityVoucherSetup oItem)
{
string sql = SQLParser.MakeSQL("INSERT INTO FM_ActivityVoucherSetup (SetupID, FundTypeID, ProcessID, GLID, GLSide, ReferenceType, ReferenceID, VoucherSetupItemType, CreatedBy, CreatedDate) " +
"VALUES (%n, %n, %n, %n, %n, %n, %n, %n, %n, %d)",
oItem.ID,
oItem.FundTypeID,
(int)oItem.ProcessID,
oItem.GLID,
(int)oItem.GLSide,
oItem.ReferenceType,
oItem.ReferenceID,
oItem.VouhcerSetupItemType,
oItem.CreatedBy,
oItem.CreatedDate);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, ActivityVoucherSetup oItem)
{
string sql = SQLParser.MakeSQL("UPDATE FM_ActivityVoucherSetup SET FundTypeID=%n, ProcessID=%n, GLID=%n, GLSide=%n, ReferenceType=%n, ReferenceID=%n, VoucherSetupItemType=%n, ModifiedBy=%n, ModifiedDate=%d WHERE SetupID=%n",
oItem.FundTypeID,
(int)oItem.ProcessID,
oItem.GLID,
(int)oItem.GLSide,
oItem.ReferenceType,
oItem.ReferenceID,
oItem.VouhcerSetupItemType,
oItem.ModifiedBy,
oItem.ModifiedDate,
oItem.ID);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Delete Function
internal static void Delete(TransactionContext tc, int Id)
{
tc.ExecuteNonQuery("DELETE FROM FM_ActivityVoucherSetup WHERE SetupID=%n", Id);
}
internal static void DeleteByProcessID(TransactionContext tc, int Id)
{
tc.ExecuteNonQuery("DELETE FROM FM_ActivityVoucherSetup WHERE ProcessID=%n", Id);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, int ID)
{
return tc.ExecuteReader("SELECT * FROM FM_ActivityVoucherSetup WHERE SetupID=%n", ID);
}
internal static DataTable GetProcessIDsByFundType(TransactionContext tc, int ID)
{
return tc.ExecuteDataTable("select Distinct(PROCESSID) from FM_ActivityVoucherSetup where FundTypeID = %n group by PROCESSID", ID);
}
internal static IDataReader Get(TransactionContext tc, string sSearch, int fundtypeid)
{
return tc.ExecuteReader("SELECT * FROM FM_ActivityVoucherSetup %q", sSearch + " AND ProjectID =" + fundtypeid);
}
internal static IDataReader GetByFundType(TransactionContext tc, int fundtypeid)
{
return tc.ExecuteReader("SELECT a.*, b.FundProcessType FROM FM_ActivityVoucherSetup a join FM_ProjectProcess b on a.PROCESSID=b.PROCESSID Where a.FundTypeID =%n", fundtypeid);
}
internal static IDataReader GetByProcessType(TransactionContext tc, int fundtypeid, EnumFundProcessType type)
{
string sql = SQLParser.MakeSQL("SELECT a.*, b.FundProcessType FROM FM_ActivityVoucherSetup a join FM_ProjectProcess b " +
"on a.PROCESSID=b.PROCESSID Where a.FundTypeID =%n and a.ProcessID IN " +
" (select ProcessID from FM_ProjectProcess where fundtypeid =%n and FundprocessType=%n)", fundtypeid, fundtypeid, type);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetbyActivityid(TransactionContext tc, int ID, int fundtypeid)
{
return tc.ExecuteReader(
"SELECT * FROM ActivityVoucherSetup WHERE Status = %n AND ActivityID=%n AND ProjectID =%n",
EnumVoucherSetupStatus.Active, ID, fundtypeid);
}
internal static IDataReader GetbyProjectid(TransactionContext tc, int ID)
{
return tc.ExecuteReader("SELECT * FROM ActivityVoucherSetup WHERE ProjectID=%n AND Status=1", ID);
}
internal static IDataReader GetByProcessID(TransactionContext tc, int ID)
{
return tc.ExecuteReader("SELECT * FROM FM_ActivityVoucherSetup a join FM_ProjectProcess b on a.PROCESSID=b.PROCESSID WHERE a.ProcessID=%n", ID);
}
internal static IDataReader GetbyProcessidActivityid(TransactionContext tc, int Processid, int Activityid,
int fundtypeid)
{
return tc.ExecuteReader(
"SELECT * FROM ActivityVoucherSetup WHERE Status=1 And ActivityID=%n AND ProcessID=%n AND ProjectID=%n",
Activityid, Processid, fundtypeid);
}
internal static IDataReader GetbyActivityProjectProcessID(TransactionContext tc, int Activityid, int Projectid,
int Processid)
{
return tc.ExecuteReader(
"SELECT * FROM ActivityVoucherSetup WHERE ActivityID=%n AND ProjectID=%n AND ProcessID=%n AND Status=1 ORDER BY SeqNo",
Activityid, Projectid, Processid);
}
#endregion
internal static IDataReader GetActivityVoucherSetupByProcessActivityID(TransactionContext tc, int ID,
int fundtypeid)
{
return tc.ExecuteReader("SELECT * FROM ProcessActivity WHERE ActivityID=%n AND Status=1 AND ProjectID=%n",
ID, fundtypeid);
}
}
}