CEL_Payroll/Payroll.Service/Loan/DA/LoanParameterDA.cs

106 lines
4.7 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35.Model;
using System.Data.SqlClient;
using Ease.CoreV35.DataAccess;
using Payroll.BO;
using System.Data;
using Ease.CoreV35.DataAccess.SQL;
namespace Payroll.Service
{
#region LoanParameterDA
public class LoanParameterDA
{
#region Constructor
private LoanParameterDA() { }
#endregion
#region Insert
internal static void Insert(TransactionContext tc, LoanParameter oLoanParameter)
{
tc.ExecuteNonQuery("INSERT INTO LoanParameter(LoanParameterID, LoanID, NoOfGross, NoOfBasic," +
" MinInstallmentMonth, MaxInstallmentMonth, MinReconcileMonth,CreatedBy, CreationDate,MinFlatAmount, MaxFlatAmount)" +
" VALUES(%n, %n, %n, %n, %n, %n, %n,%n,%d,%n,%n)",
oLoanParameter.ID.Integer, oLoanParameter.LoanID.Integer, oLoanParameter.NoOfGross,
oLoanParameter.NoOfBasic, oLoanParameter.MinInstallmentMonth,
oLoanParameter.MaxInstallmentMonth, oLoanParameter.MinReconcileMonth,
DataReader.GetNullValue(oLoanParameter.CreatedBy.Integer),
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.Integer, oLoanGrades.LoanID.Integer, oLoanGrades.LoanParameterID.Integer,
oLoanGrades.GradeID.Integer);
}
internal static void InsertDocItem(TransactionContext tc, LoanDoc docItem)
{
tc.ExecuteNonQuery("INSERT INTO LoanDocs(LoanDocsID, LoanID, LoanParameterID, HRDocID)" +
" VALUES(%n, %n, %n, %n)",
docItem.ID.Integer, docItem.LoanID.Integer, docItem.LoanParameterID.Integer,
docItem.HRDocID.Integer);
}
#endregion
#region Update
internal static void Update(TransactionContext tc, LoanParameter oLoanParameter)
{
string sSQL= SQLParser.MakeSQL("UPDATE LoanParameter SET [LoanID]=%n,[NoOfGross]=%n,[NoOfBasic]=%n," +
" [MinInstallmentMonth]=%n,[MaxInstallmentMonth]=%n,[MinReconcileMonth]=%n," +
" [ModifiedBy]=%n,[ModifiedDate]=%d,MinFlatAmount=%n, MaxFlatAmount=%n WHERE [LoanParameterID]=%n",
oLoanParameter.LoanID.Integer, oLoanParameter.NoOfGross, oLoanParameter.NoOfBasic,
oLoanParameter.MinInstallmentMonth, oLoanParameter.MaxInstallmentMonth,oLoanParameter.MinReconcileMonth,
DataReader.GetNullValue(oLoanParameter.ModifiedBy.Integer), DataReader.GetNullValue(oLoanParameter.ModifiedDate), oLoanParameter.MinFlatAmount, oLoanParameter.MaxFlatAmount,
oLoanParameter.ID.Integer);
tc.ExecuteNonQuery(sSQL);
}
#endregion
#region Delete
internal static void Delete(TransactionContext tc, ID id)
{
tc.ExecuteNonQuery("DELETE FROM [LoanParameter] WHERE LoanParameterID=%n", id.Integer);
}
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, ID id)
{
return tc.ExecuteReader("SELECT * FROM LoanParameter WHERE LoanParameterID=%n", id.Integer);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM LoanParameter");
}
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
}