using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { #region LoanParameterDA public class LoanParameterDA { #region Constructor private LoanParameterDA() { } #endregion #region Insert internal static void Insert(TransactionContext tc, LoanParameter oLoanParameter, int payrollTypeID) { tc.ExecuteNonQuery("INSERT INTO LoanParameter(LoanParameterID, LoanID, NoOfGross, NoOfBasic," + " MinInstallmentMonth, MaxInstallmentMonth, MinReconcileMonth, PayrollTypeID, CreatedBy, CreationDate,MinFlatAmount, MaxFlatAmount)" + " VALUES(%n, %n, %n, %n, %n, %n, %n,%n,%n,%d,%n,%n)", oLoanParameter.ID, oLoanParameter.LoanID, oLoanParameter.NoOfGross, oLoanParameter.NoOfBasic, oLoanParameter.MinInstallmentMonth, oLoanParameter.MaxInstallmentMonth, oLoanParameter.MinReconcileMonth, payrollTypeID, DataReader.GetNullValue(oLoanParameter.CreatedBy), DataReader.GetNullValue(oLoanParameter.CreatedDate), oLoanParameter.MinFlatAmount, oLoanParameter.MaxFlatAmount); } internal static void InsertLoadGrades(TransactionContext tc, LoanGrades oLoanGrades) { tc.ExecuteNonQuery("INSERT INTO LoanGrades(LoanGradesID, LoanID, LoanParameterID, GradeID)" + " VALUES(%n, %n, %n, %n)", oLoanGrades.ID, oLoanGrades.LoanID, oLoanGrades.LoanParameterID, oLoanGrades.GradeID); } internal static void InsertDocItem(TransactionContext tc, LoanDoc docItem) { tc.ExecuteNonQuery("INSERT INTO LoanDocs(LoanDocsID, LoanID, LoanParameterID, HRDocID)" + " VALUES(%n, %n, %n, %n)", docItem.ID, docItem.LoanID, docItem.LoanParameterID, docItem.HRDocID); } #endregion #region Update internal static void Update(TransactionContext tc, LoanParameter oLoanParameter, int payrollTypeID) { string sSQL = SQLParser.MakeSQL("UPDATE LoanParameter SET LoanID=%n,NoOfGross=%n,NoOfBasic=%n," + " MinInstallmentMonth=%n,MaxInstallmentMonth=%n,MinReconcileMonth=%n, PayrollTypeID=%n, " + " ModifiedBy=%n,ModifiedDate=%d,MinFlatAmount=%n, MaxFlatAmount=%n WHERE LoanParameterID=%n", oLoanParameter.LoanID, oLoanParameter.NoOfGross, oLoanParameter.NoOfBasic, oLoanParameter.MinInstallmentMonth, oLoanParameter.MaxInstallmentMonth, oLoanParameter.MinReconcileMonth, payrollTypeID, DataReader.GetNullValue(oLoanParameter.ModifiedBy), DataReader.GetNullValue(oLoanParameter.ModifiedDate), oLoanParameter.MinFlatAmount, oLoanParameter.MaxFlatAmount, oLoanParameter.ID); tc.ExecuteNonQuery(sSQL); } #endregion #region Delete internal static void Delete(TransactionContext tc, int id) { tc.ExecuteNonQuery("DELETE FROM LoanParameter WHERE LoanParameterID=%n", id); } internal static void DeleteLoanGrade(TransactionContext tc, int loanParameterID) { tc.ExecuteNonQuery("DELETE FROM LoanGrades WHERE LoanParameterID=%n", loanParameterID); } internal static void DeleteLoanDoc(TransactionContext tc, int loanParameterID) { tc.ExecuteNonQuery("DELETE FROM LoanDocs WHERE LoanParameterID=%n", loanParameterID); } #endregion #region Get internal static IDataReader Get(TransactionContext tc, int id, int payrollTypeID) { return tc.ExecuteReader("SELECT * FROM LoanParameter WHERE LoanParameterID=%n AND PayrollTypeID=%n", id, payrollTypeID); } internal static IDataReader Get(TransactionContext tc, int payrollTypeID) { return tc.ExecuteReader("SELECT * FROM LoanParameter WHERE PayrollTypeID=%n", payrollTypeID); } internal static IDataReader GetLoanGrades(TransactionContext tc, int loanParameterID) { return tc.ExecuteReader("SELECT * FROM LoanGrades WHERE LoanParameterID=%n", loanParameterID); } internal static IDataReader GetLoanDoc(TransactionContext tc, int parameterID) { return tc.ExecuteReader("SELECT * FROM LoanDocs WHERE LoanParameterID=%n", parameterID); } #endregion } #endregion }