EchoTex_Payroll/HRM.DA/DA/Loan/LoanDA.cs

86 lines
2.8 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
#region LoanDA
internal class LoanDA
{
#region Constructor
private LoanDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, Loan item)
{
tc.ExecuteNonQuery(
"INSERT INTO LOANBASIC(LoanID, description,LoanGroup, isConfirmationRequired, interestRate, USERID, CreatedBy, CreationDate, SequenceNo, Status, calculationType, descriptioninbangla)" +
" VALUES(%n, %s,%n, %b, %n, %n, %n, %d, %n, %n, %n, %u)", item.ID, item.Name, (int)item.LoanGroup,
item.IsConfirmationRequired, item.InterestRate, DataReader.GetNullValue(item.CreatedBy),
DataReader.GetNullValue(item.CreatedBy), DataReader.GetNullValue(item.CreatedDate), item.Sequence,
item.Status, item.calculationType, item.NameInBangla);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, Loan item)
{
tc.ExecuteNonQuery(
"UPDATE LOANBASIC SET description=%s, isConfirmationRequired=%b, interestRate=%n, LoanGroup=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n, descriptioninbangla=%u" +
", calculationType=%n WHERE LoanID=%n", item.Name, item.IsConfirmationRequired, item.InterestRate, (int)item.LoanGroup,
DataReader.GetNullValue(item.ModifiedBy), DataReader.GetNullValue(item.ModifiedDate), item.Sequence,
item.Status, item.NameInBangla, item.calculationType, item.ID);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
{
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
{
return tc.ExecuteReader("SELECT * FROM LOANBASIC where Status=%n Order By SequenceNo", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM LOANBASIC Order By SequenceNo");
}
}
internal static IDataReader Get(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM LOANBASIC WHERE LoanID=%n", nID);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM LOANBASIC WHERE LoanID=%n", nID);
}
#endregion
internal static IDataReader Get(TransactionContext tc, string loanNo)
{
return tc.ExecuteReader(
"SELECT * from LoanBasic where LoanID in(select LoanID FROM LOANISSUE where LoanNo=%s)", loanNo);
}
}
#endregion
}