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

68 lines
2.5 KiB
C#

using System;
using System.Data;
using System.Linq;
using System.Text;
using Ease.Core.DataAccess;
using HRM.BO;
namespace HRM.DA
{
internal class LoanTransactionDA
{
#region Insert Function
internal static void Insert(TransactionContext tc, LoanTransaction loanTransaction)
{
string sql = SQLParser.MakeSQL(
"INSERT INTO LoanTransaction (LoanTransactionID,CustomerID,LoanID,TranType,Amount,LoanScheduleID,PaymentDate,CreatedBy,CreatedDate,ProjectID)" +
" VALUES(%n,%n,%n,%n,%n,%n,%d,%n,%D,%n)", loanTransaction.ID, loanTransaction.CustomerID,
loanTransaction.LoanID, loanTransaction.TranType,
loanTransaction.Amount, DataReader.GetNullValue(loanTransaction.LoanScheduleID),
loanTransaction.PaymentDate, loanTransaction.CreatedBy,
loanTransaction.CreatedDate, loanTransaction.ProjectID);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, LoanTransaction loanTransaction)
{
string sql = SQLParser.MakeSQL(
"UPDATE LoanTransaction Set CustomerID = %n, LoanID = %n, TranType = %n, Amount = %n, LoanScheduleID = %n, PaymentDate = %d, ModifiedBy = %n, ModifiedDate = %D, ProjectID = %n" +
"WHERE LoanTransactionID = %n ", loanTransaction.CustomerID, loanTransaction.LoanID,
loanTransaction.TranType, loanTransaction.Amount,
DataReader.GetNullValue(loanTransaction.LoanScheduleID), loanTransaction.PaymentDate,
loanTransaction.ModifiedBy, loanTransaction.ModifiedDate, loanTransaction.ProjectID,
loanTransaction.ID);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Delete Function
internal static void Delete(TransactionContext tc, int loanTransactionId)
{
tc.ExecuteNonQuery("DELETE FROM LoanTransaction WHERE LoanTransactionID=%n", loanTransactionId);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, int loanTransactionId)
{
return tc.ExecuteReader("SELECT * FROM LoanTransaction WHERE LoanTransactionID=%n", loanTransactionId);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM LoanTransaction");
}
#endregion
}
}