95 lines
3.9 KiB
C#
95 lines
3.9 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System;
|
|||
|
using System.Data;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
using HRM.BO;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
internal class FmLoanScheduleDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public FmLoanScheduleDA()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert Function
|
|||
|
|
|||
|
internal static void Insert(TransactionContext tc, FmLoanSchedule loanSchedule)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"INSERT INTO FmLoanSchedule(LoanScheduleID,ActivityID,CustomerID,EffectiveBalance,InstallmentAmount,InstallmentInterest,InstallmentPrincipal,LoanCategoryID,LoanID,PayDate,ScheduledPayDate,SerialNo,CreatedBy,CreatedDate)" +
|
|||
|
" VALUES(%n,%n,%n,%n,%n,%n,%n,%n,%n,%d,%d,%n,%n,%D)", loanSchedule.ID, loanSchedule.ActivityID,
|
|||
|
loanSchedule.CustomerID, loanSchedule.EffectiveBalance, loanSchedule.InstallmentAmount,
|
|||
|
loanSchedule.InstallmentInterest, loanSchedule.InstallmentPrincipal, loanSchedule.LoanCategoryID,
|
|||
|
loanSchedule.LoanID, loanSchedule.PayDate, loanSchedule.ScheduledPayDate, loanSchedule.SerialNo,
|
|||
|
loanSchedule.CreatedBy, loanSchedule.CreatedDate);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, FmLoanSchedule loanSchedule)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"UPDATE FmLoanSchedule Set ActivityID = %n, CustomerID = %n, EffectiveBalance = %n, InstallmentAmount = %n, InstallmentInterest = %n, InstallmentPrincipal = %n, LoanCategoryID = %n, LoanID = %n, PayDate = %d, ScheduledPayDate = %d, SerialNo = %n, ModifiedBy = %n, ModifiedDate = %D" +
|
|||
|
"WHERE LoanScheduleID = %n ", loanSchedule.ActivityID, loanSchedule.CustomerID,
|
|||
|
loanSchedule.EffectiveBalance, loanSchedule.InstallmentAmount, loanSchedule.InstallmentInterest,
|
|||
|
loanSchedule.InstallmentPrincipal, loanSchedule.LoanCategoryID, loanSchedule.LoanID,
|
|||
|
loanSchedule.PayDate, loanSchedule.ScheduledPayDate, loanSchedule.SerialNo, loanSchedule.ModifiedBy,
|
|||
|
loanSchedule.ModifiedDate, loanSchedule.ID);
|
|||
|
}
|
|||
|
|
|||
|
//add LaonScheduleDA
|
|||
|
internal static void UpdateLoanPaid(TransactionContext tc, FmLoanSchedule loanSchedule)
|
|||
|
{
|
|||
|
string str =
|
|||
|
SQLParser.MakeSQL(
|
|||
|
"UPDATE FmLoanSchedule Set PayDate = %d, ModifiedBy = %n, ModifiedDate = %d WHERE LoanScheduleID = %n ",
|
|||
|
loanSchedule.PayDate, loanSchedule.ModifiedBy, loanSchedule.ModifiedDate, loanSchedule.ID);
|
|||
|
tc.ExecuteNonQuery("UPDATE FmLoanSchedule Set PayDate = %d, ModifiedBy = %n, ModifiedDate = %d " +
|
|||
|
"WHERE LoanScheduleID = %n ", loanSchedule.PayDate, loanSchedule.ModifiedBy,
|
|||
|
loanSchedule.ModifiedDate, loanSchedule.ID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete Function
|
|||
|
|
|||
|
internal static void Delete(TransactionContext tc, int loanScheduleID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM FmLoanSchedule WHERE LoanScheduleID=%n", loanScheduleID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, int loanScheduleID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM FmLoanSchedule WHERE LoanScheduleID=%n", loanScheduleID);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
return tc.ExecuteReader(
|
|||
|
"SELECT * FROM FmLoanSchedule Where ProjectID=%n"); //, User.CurrentUser.ProjectID.Integer
|
|||
|
}
|
|||
|
|
|||
|
internal static bool GetSchedule(TransactionContext tc, DateTime dt)
|
|||
|
{
|
|||
|
object ob = tc.ExecuteScalar("SELECT * FROM FmLoanSchedule Where ScheduledPayDate=%d and Paydate is null",
|
|||
|
dt);
|
|||
|
return Convert.ToInt32(ob) > 0;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|