CEL_Payroll/Payroll.Service/Budget/DA/BudgetMasterDA.cs

99 lines
6.1 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Data;
using System.Linq;
using Ease.CoreV35.Model;
using System.Data.SqlClient;
using Ease.CoreV35.DataAccess;
using System.Collections.Generic;
using Ease.CoreV35.DataAccess.SQL;
using Payroll.BO;
namespace Payroll.Service
{
[Serializable]
internal static class BudgetMasterDA
{
public static IDataReader Get(TransactionContext tc, ID nID, ID PayrollTypeID)
{
return tc.ExecuteReader("Select * from BudgetMaster where BudgetMasterID=%n AND PayrollTypeID=%n", nID.Integer, PayrollTypeID.Integer);
}
public static IDataReader Get(TransactionContext tc, ID PayrollTypeID)
{
return tc.ExecuteReader("Select * from BudgetMaster WHERE PayrollTypeID=%n order by FromDate ", PayrollTypeID.Integer);
}
public static IDataReader Get(TransactionContext tc, DateTime dtFromDate, DateTime dtToDate, ID PayrollTypeID)
{
return tc.ExecuteReader("Select * from BudgetMaster WHERE PayrollTypeID=%n AND FromDate>=%d AND ToDate<=%d", PayrollTypeID.Integer,dtFromDate, dtToDate);
}
public static void Insert(TransactionContext tc, BudgetMaster item, ID PayrollTypeID)
{
tc.ExecuteNonQuery("Insert into BudgetMaster(BudgetMasterID,BasedOn,EffectMonth,FromDate,Name,OverAllPercentage,ToDate,PayrollTypeID) Values" +
"(%n,%n,%d,%d,%s,%n,%d,%n)", item.ID.Integer, item.BasedOn, item.EffectMonth, item.FromDate, item.Name, item.OverAllPercentage, item.ToDate, PayrollTypeID.Integer);
}
public static void Update(TransactionContext tc, BudgetMaster item)
{
tc.ExecuteNonQuery("Update BudgetMaster SET BasedOn=%n,EffectMonth=%d,FromDate=%d,Name=%s,OverAllPercentage=%d,ToDate=%d,PayrollTypeID=%n Where BudgetMasterID=%n"
, item.BasedOn, item.EffectMonth, item.FromDate, item.Name, item.OverAllPercentage, item.ToDate, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer, item.ID.Integer);
}
public static void Delete(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("Delete from BudgetMaster where BudgetMasterID=%n AND PayrollTypeID=%n", nID.Integer, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
}
public static void DeleteBudgetCostCenter(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("Delete from BudgetCostCenter where BudgetID=%n", nID.Integer);
}
public static void DeleteBudgetGrade(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("Delete from BudgetGrade where BudgetID=%n", nID.Integer);
}
public static void DeleteBudgetIndivisualChange(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("Delete from BudgetIndivisualChange where BudgetID=%n", nID.Integer);
}
public static void DeleteBudgetNewJoiner(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("Delete from BudgetNewJoiner where BudgetID=%n", nID.Integer);
}
public static void DeleteBudgetProcessMonthly(TransactionContext tc, ID nID, ID PayrollTypeID)
{
tc.ExecuteNonQuery("Delete from BudgetProcessMonthly where BudgetID=%n AND PayrollTypeID=%n", nID.Integer, PayrollTypeID.Integer);
}
public static void DeleteBudgetProcessMonthlyDetail(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("Delete from BudgetProcessMonthlyDetail where BudgetProcessMonthlyID=%n", nID.Integer);
}
public static void DeleteBudgetProcessMonthlyCC(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("Delete from BudgetMonthlyCC where BudgetProcessMonthlyID=%n", nID.Integer);
}
public static void DeleteBudgetComponent(TransactionContext tc, ID nID)
{
tc.ExecuteNonQuery("Delete from BudgetComponent where BudgetID=%n", nID.Integer);
}
public static void DeleteBudgetMaster(TransactionContext tc, ID nID, ID PayrollTypeID)
{
tc.ExecuteNonQuery("Delete from BudgetMaster where BudgetMasterID=%n AND PayrollTypeID=%n", nID.Integer, PayrollTypeID.Integer);
}
public static void DeleteAll(TransactionContext tc, ID nBudId, ID PayrollTypeID)
{
tc.ExecuteNonQuery("Delete from BudgetComponentGrade where BudgetComponentID in(select BudgetComponentID from BudgetComponent where BudgetID=%n)", nBudId.Integer);
tc.ExecuteNonQuery("Delete from BudgetComponentIndivisual where BudgetComponentID in(select BudgetComponentID from BudgetComponent where BudgetID=%n)", nBudId.Integer);
tc.ExecuteNonQuery("Delete from BudgetNewJoinerCrG where BudgetNewJoinerID in(select BudgetNewJoinerID from BudgetNewJoiner where BudgetID=%n)", nBudId.Integer);
tc.ExecuteNonQuery("Delete from BudgetProcessMonthlyDetail where BudgetProcessMonthlyID in(select BudgetProcessMonthlyID from BudgetProcessMonthly where BudgetID=%n AND PayrollTypeID=%n)", nBudId.Integer, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
tc.ExecuteNonQuery("Delete from BudgetMonthlyCC where BudgetProcessMonthlyID in(select BudgetProcessMonthlyID from BudgetProcessMonthly where BudgetID=%n AND PayrollTypeID=%n)", nBudId.Integer, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
tc.ExecuteNonQuery("DELETE FROM BudgetDepartment WHERE BudgetID=%n", nBudId.Integer);
tc.ExecuteNonQuery("Delete from BudgetCostCenter where BudgetID=%n", nBudId.Integer);
tc.ExecuteNonQuery("Delete from BudgetGrade where BudgetID=%n", nBudId.Integer);
tc.ExecuteNonQuery("Delete from BudgetIndivisualChange where BudgetID=%n", nBudId.Integer);
tc.ExecuteNonQuery("Delete from BudgetNewJoiner where BudgetID=%n", nBudId.Integer);
tc.ExecuteNonQuery("Delete from BudgetProcessMonthly where BudgetID=%n AND PayrollTypeID=%n", nBudId.Integer, PayrollTypeID.Integer);
tc.ExecuteNonQuery("Delete from BudgetComponent where BudgetID=%n", nBudId.Integer);
tc.ExecuteNonQuery("Delete from BudgetMaster where BudgetMasterID=%n AND PayrollTypeID=%n", nBudId.Integer, PayrollTypeID.Integer);
}
}
}