using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { internal static class BudgetMasterDA { public static IDataReader Get(TransactionContext tc, int nID, int payrollTypeID) { return tc.ExecuteReader("Select * from BudgetMaster where BudgetMasterID=%n AND PayrollTypeID=%n", nID, payrollTypeID); } public static IDataReader Get(TransactionContext tc, int payrollTypeID) { return tc.ExecuteReader("Select * from BudgetMaster WHERE PayrollTypeID=%n order by FromDate ", payrollTypeID); } public static IDataReader Get(TransactionContext tc, DateTime dtFromDate, DateTime dtToDate, int payrollTypeID) { return tc.ExecuteReader("Select * from BudgetMaster WHERE PayrollTypeID=%n AND FromDate>=%d AND ToDate<=%d", payrollTypeID, dtFromDate, dtToDate); } public static void Insert(TransactionContext tc, BudgetMaster item) { tc.ExecuteNonQuery( "Insert into BudgetMaster(BudgetMasterID,BasedOn,EffectMonth,FromDate,Name,OverAllPercentage,ToDate,PayrollTypeID) Values" + "(%n,%n,%d,%d,%s,%n,%d,%n)", item.ID, item.BasedOn, item.EffectMonth, item.FromDate, item.Name, item.OverAllPercentage, item.ToDate, item.PayrollTypeID); } 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, item.PayrollTypeID); } public static void Delete(TransactionContext tc, int nID) { tc.ExecuteNonQuery("Delete from BudgetMaster where BudgetMasterID=%n ", nID); } public static void DeleteBudgetCostCenter(TransactionContext tc, int nID) { tc.ExecuteNonQuery("Delete from BudgetCostCenter where BudgetID=%n", nID); } public static void DeleteBudgetGrade(TransactionContext tc, int nID) { tc.ExecuteNonQuery("Delete from BudgetGrade where BudgetID=%n", nID); } public static void DeleteBudgetIndivisualChange(TransactionContext tc, int nID) { tc.ExecuteNonQuery("Delete from BudgetIndivisualChange where BudgetID=%n", nID); } public static void DeleteBudgetNewJoiner(TransactionContext tc, int nID) { tc.ExecuteNonQuery("Delete from BudgetNewJoiner where BudgetID=%n", nID); } public static void DeleteBudgetProcessMonthly(TransactionContext tc, int nID, int payrollTypeID) { tc.ExecuteNonQuery("Delete from BudgetProcessMonthly where BudgetID=%n AND PayrollTypeID=%n", nID, payrollTypeID); } public static void DeleteBudgetProcessMonthlyDetail(TransactionContext tc, int nID) { tc.ExecuteNonQuery("Delete from BudgetProcessMonthlyDetail where BudgetProcessMonthlyID=%n", nID); } public static void DeleteBudgetProcessMonthlyCC(TransactionContext tc, int nID) { tc.ExecuteNonQuery("Delete from BudgetMonthlyCC where BudgetProcessMonthlyID=%n", nID); } public static void DeleteBudgetComponent(TransactionContext tc, int nID) { tc.ExecuteNonQuery("Delete from BudgetComponent where BudgetID=%n", nID); } public static void DeleteBudgetMaster(TransactionContext tc, int nID, int payrollTypeID) { tc.ExecuteNonQuery("Delete from BudgetMaster where BudgetMasterID=%n AND PayrollTypeID=%n", nID, payrollTypeID); } public static void DeleteAll(TransactionContext tc, int nBudId, int payrollTypeID) { tc.ExecuteNonQuery( "Delete from BudgetComponentGrade where BudgetComponentID in(select BudgetComponentID from BudgetComponent where BudgetID=%n)", nBudId); tc.ExecuteNonQuery( "Delete from BudgetComponentIndivisual where BudgetComponentID in(select BudgetComponentID from BudgetComponent where BudgetID=%n)", nBudId); tc.ExecuteNonQuery( "Delete from BudgetNewJoinerCrG where BudgetNewJoinerID in(select BudgetNewJoinerID from BudgetNewJoiner where BudgetID=%n)", nBudId); tc.ExecuteNonQuery( "Delete from BudgetProcessMonthlyDetail where BudgetProcessMonthlyID in(select BudgetProcessMonthlyID from BudgetProcessMonthly where BudgetID=%n AND PayrollTypeID=%n)", nBudId, payrollTypeID); tc.ExecuteNonQuery( "Delete from BudgetMonthlyCC where BudgetProcessMonthlyID in(select BudgetProcessMonthlyID from BudgetProcessMonthly where BudgetID=%n AND PayrollTypeID=%n)", nBudId, payrollTypeID); tc.ExecuteNonQuery("DELETE FROM BudgetDepartment WHERE BudgetID=%n", nBudId); } } }