88 lines
3.1 KiB
C#
88 lines
3.1 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 LoanCustomerDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public LoanCustomerDA()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert Function
|
|||
|
|
|||
|
internal static void Insert(TransactionContext tc, LoanCustomer loanCustomer)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"INSERT INTO LoanCustomer(CustomerID,AccNo,Address,DateOfBirth,DateOfJoining,EmpCode,IsMember,MemberShipNo,Name,CreatedBy,CreatedDate)" +
|
|||
|
" VALUES(%n,%s,%s,%d,%d,%s,%n,%s,%s,%n,%D)", loanCustomer.ID,
|
|||
|
DataReader.GetNullValue(loanCustomer.AccNo), DataReader.GetNullValue(loanCustomer.Address),
|
|||
|
loanCustomer.DateOfBirth, loanCustomer.DateOfJoining, loanCustomer.EmpCode, loanCustomer.IsMember,
|
|||
|
loanCustomer.MemberShipNo, loanCustomer.Name, loanCustomer.CreatedBy, loanCustomer.CreatedDate);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, LoanCustomer loanCustomer)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"UPDATE LoanCustomer Set AccNo = %s, Address = %s, DateOfBirth = %d, DateOfJoining = %d, EmpCode = %s, IsMember = %n, MemberShipNo = %s, Name = %s, ModifiedBy = %n, ModifiedDate = %D)" +
|
|||
|
"WHERE LoanCustomerID = %n ", loanCustomer.AccNo, loanCustomer.Address, loanCustomer.DateOfBirth,
|
|||
|
loanCustomer.DateOfJoining, loanCustomer.EmpCode, loanCustomer.IsMember, loanCustomer.MemberShipNo,
|
|||
|
loanCustomer.Name, loanCustomer.ModifiedBy, loanCustomer.ModifiedDate, loanCustomer.ID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete Function
|
|||
|
|
|||
|
internal static void Delete(TransactionContext tc, int loanCustomerID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM LoanCustomer WHERE LoanCustomerID=%n", loanCustomerID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, int loanCustomerID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM LoanCustomer WHERE CustomerID=%n", loanCustomerID);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetByMemberID(TransactionContext tc, int memberID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM LoanCustomer WHERE MemberID=%n AND ProjectID=%n",
|
|||
|
memberID); //,User.CurrentUser.ProjectID.Integer
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
return tc.ExecuteReader(
|
|||
|
"SELECT * FROM LoanCustomer Where ProjectID=%n"); //, User.CurrentUser.ProjectID.Integer
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region isExists function
|
|||
|
|
|||
|
internal static bool IsExist(TransactionContext tc, int memberID)
|
|||
|
{
|
|||
|
object ob = tc.ExecuteScalar("SELECT COUNT(*) FROM LoanCustomer WHERE MemberID = %n AND ProjectID=%n",
|
|||
|
memberID); //, User.CurrentUser.ProjectID.Integer
|
|||
|
return Convert.ToInt32(ob) > 0;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|