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

137 lines
6.5 KiB
C#

using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA.Fund
{
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 ActivityVoucherSetup(SetupID, ActivityID, " +
" ProjectID, ProcessID, VoucherType, IsMultipleDebit, IsMultipleCredit, DebitControl, " +
" CreditControl, DebitHISeq, CreditHISeq, DrGLID, CrGLID, DrGLCode, CrGLCode, Status, " +
" Version, IsReqSubsidiary, TranElementID, ValueQuery, SeqNo, ActivityRelatedID, " +
" ActivityRelatedValue, IsReqNewURForCr, IsReqNewURForDr, CreatedBy, CreatedDate, IsOptional)" +
" VALUES(%n, %n, %n, %n, %n, %b, %b, %n, %n, %s, %s, %n, %n, " +
" %s, %s, %n, %n, %b, %n, %s, %n, %n, %n, %b, %b, %n, %d, %b)", oItem.ID,
oItem.ActivityID,
oItem.ID, oItem.ProcessID, Convert.ToInt16(oItem.VoucherType),
oItem.IsMultipleDebit, oItem.IsMultipleCredit, oItem.DebitControl, oItem.CreditControl,
oItem.DebitHISeq, oItem.CreditHISeq, oItem.DrGLID, oItem.CrGLID,
oItem.DrGLCode, oItem.CrGLCode, Convert.ToInt16(oItem.Status), oItem.Version, oItem.IsReqSubsidiary,
DataReader.GetNullValue(oItem.TranElementID), oItem.ValueQuery, DataReader.GetNullValue(oItem.SeqNo),
DataReader.GetNullValue(oItem.ActivityRelatedID), DataReader.GetNullValue(oItem.ActivityRelatedValue),
oItem.IsReqNewUserRecordForCr, oItem.IsReqNewUserRecordForDr, oItem.CreatedBy, oItem.CreatedDate,
oItem.IsOptional);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, ActivityVoucherSetup oItem)
{
string sql = SQLParser.MakeSQL("UPDATE ActivityVoucherSetup SET ActivityID=%n, " +
" ProjectID=%n, ProcessID=%n, VoucherType=%n, IsMultipleDebit=%n, IsMultipleCredit=%n, " +
" DebitControl=%n, CreditControl=%n, DebitHISeq=%s, CreditHISeq=%s, DrGLID=%n, CrGLID=%n, " +
" DrGLCode=%s, CrGLCode=%s, Status=%n, Version=%n, IsReqSubsidiary=%n, ModifiedBy=%n, " +
" ModifiedDate=%d , IsOptional=%b, TranElementID=%n, ValueQuery=%s, SeqNo=%n, ActivityRelatedID=%n, " +
" ActivityRelatedValue= %n, IsReqNewURForCr=%b, IsReqNewURForDr=%b WHERE SetupID = %n",
oItem.ActivityID, oItem.ID,
oItem.ProcessID, Convert.ToInt16(oItem.VoucherType), oItem.IsMultipleDebit, oItem.IsMultipleCredit,
oItem.DebitControl, oItem.CreditControl, oItem.DebitHISeq, oItem.CreditHISeq, oItem.DrGLID,
oItem.CrGLID, oItem.DrGLCode, oItem.CrGLCode, Convert.ToInt16(oItem.Status), oItem.Version,
oItem.IsReqSubsidiary, oItem.ModifiedBy, oItem.ModifiedDate, oItem.IsOptional,
DataReader.GetNullValue(oItem.TranElementID), oItem.ValueQuery, DataReader.GetNullValue(oItem.SeqNo),
DataReader.GetNullValue(oItem.ActivityRelatedID), DataReader.GetNullValue(oItem.ActivityRelatedValue),
oItem.IsReqNewUserRecordForCr, oItem.IsReqNewUserRecordForDr, oItem.ID);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Delete Function
internal static void Delete(TransactionContext tc, int Id)
{
tc.ExecuteNonQuery("DELETE FROM ActivityVoucherSetup WHERE SetupID=%n", Id);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, int ID)
{
return tc.ExecuteReader("SELECT * FROM ActivityVoucherSetup WHERE SetupID=%n", ID);
}
internal static IDataReader Get(TransactionContext tc, string sSearch, int fundtypeid)
{
return tc.ExecuteReader("SELECT * FROM ActivityVoucherSetup %q", sSearch + " AND ProjectID =" + fundtypeid);
}
internal static IDataReader GetbyFundType(TransactionContext tc, int fundtypeid)
{
return tc.ExecuteReader("SELECT * FROM ActivityVoucherSetup Where ProjectID =%n", fundtypeid);
}
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 ActivityVoucherSetup WHERE ProcessID=%n AND Status=1 ", 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);
}
}
}