91 lines
4.1 KiB
C#
91 lines
4.1 KiB
C#
using Ease.Core.DataAccess;
|
|
using HRM.BO;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Data.SqlClient;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
public class FMLoanAttachmentDA
|
|
{
|
|
public FMLoanAttachmentDA() { }
|
|
#region Insert
|
|
internal static void Insert(TransactionContext tc, FMLoanAttachment item)
|
|
{
|
|
|
|
string commandText = @"INSERT INTO FM_LoanAttachment(LoanAttachmentID, LoanAppID, LoanID, LoanDocType, FileName, FileData, uploadDate, uploadBy)
|
|
VALUES (@LoanAttachmentID, @LoanAppID, @LoanID, @LoanDocType, @FileName, @FileData, @uploadDate, @uploadBy)";
|
|
|
|
using (SqlCommand cmd = new SqlCommand(commandText, (SqlConnection)tc.Connection))
|
|
{
|
|
cmd.CommandType = CommandType.Text;
|
|
cmd.Transaction = (SqlTransaction)tc.Transaction;
|
|
|
|
cmd.Parameters.Add("@LoanAttachmentID", SqlDbType.Int).Value = item.ID;
|
|
cmd.Parameters.Add("@LoanAppID", SqlDbType.Int).Value = item.LoanAppID;
|
|
cmd.Parameters.Add("@LoanID", SqlDbType.Int).Value = item.LoanID;
|
|
cmd.Parameters.Add("@LoanDocType", SqlDbType.SmallInt).Value = (int)item.LoanDocType;
|
|
cmd.Parameters.Add("@FileName", SqlDbType.VarChar).Value = item.FileName;
|
|
cmd.Parameters.Add("@FileData", SqlDbType.VarBinary).Value = item.FileData;
|
|
cmd.Parameters.Add("@uploadDate", SqlDbType.DateTime).Value = item.uploadDate;
|
|
cmd.Parameters.Add("@uploadBy", SqlDbType.Int).Value = item.uploadBy;
|
|
|
|
cmd.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Update
|
|
|
|
internal static void Update(TransactionContext tc, LoanApplication loanApp)
|
|
{
|
|
//string sql = SQLParser.MakeSQL(
|
|
// @"UPDATE FM_LoanAttachment SET LoanAppNO = %n, ApplyDate = %d, MemberID = %n, EmployeeID = %n, LoanAmount = %n,
|
|
// NoOfInstallment = %n, InstallmentAmount = %n, Principal = %n, Interest = %n, purposeID = %n, Remarks = %s,
|
|
// FundJoining = %d, BasicSalary = %n, GrossSalary = %n, PreviouslyTakenLoan = %b, CreatedDate = %d,
|
|
// CreatedBy = %n, AccountUserID = %n, AccountAppDate = %d, AccountsRemarks = %s, HRUserID = %n, HRApproveDate = %d,
|
|
// HRApproveRemarks = %s, TrusteesID = %n, TrusteesApproveDate = %d, TrusteesApproveRemarks = %s, LoanCategoryID = %n WHERE LoanAppID = %n",
|
|
// loanApp.LoanAppNO, loanApp.ApplyDate, loanApp.MemberID, loanApp.EmployeeID, loanApp.LoanAmount,
|
|
// loanApp.NoOfInstallment, loanApp.InstallmentAmount, loanApp.Principal, loanApp.Interest, loanApp.purposeID,
|
|
// loanApp.Remarks, loanApp.FundJoining, loanApp.BasicSalary, loanApp.GrossSalary, loanApp.PreviouslyTakenLoan,
|
|
// loanApp.CreatedDate, loanApp.CreatedBy, loanApp.AccountUserID, loanApp.AccountAppDate, loanApp.AccountsRemarks,
|
|
// loanApp.HRUserID, loanApp.HRApproveDate, loanApp.HRApproveRemarks, loanApp.TrusteesID,
|
|
// loanApp.TrusteesApproveDate, loanApp.TrusteesApproveRemarks, loanApp.LoanCategoryID, loanApp.LoanAppID);
|
|
|
|
//tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Get
|
|
internal static IDataReader GetByLoanAppID(TransactionContext tc, int iD)
|
|
{
|
|
return tc.ExecuteReader("Select * From FM_LoanAttachment Where LoanAppID=%n", iD);
|
|
}
|
|
internal static IDataReader GetByLoanID(TransactionContext tc, int iD)
|
|
{
|
|
return tc.ExecuteReader("Select * From FM_LoanAttachment Where LoanID=%n", iD);
|
|
}
|
|
#endregion
|
|
|
|
#region Delete
|
|
internal static void DeleteByLoanAppID(TransactionContext tc, int iD)
|
|
{
|
|
tc.ExecuteNonQuery("Delete From FM_LoanAttachment Where LoanAppID=%n", iD);
|
|
}
|
|
internal static void DeleteByLoanID(TransactionContext tc, int iD)
|
|
{
|
|
tc.ExecuteNonQuery("Delete From FM_LoanAttachment Where LoanID=%n", iD);
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|