using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; using System.Collections.Generic; namespace HRM.DA { internal class WPPFSettlementDA { #region Insert function internal static void Insert(TransactionContext tc, WPPFSettlement oItem) { string sql = SQLParser.MakeSQL(@"INSERT INTO FM_WPPFSettlement (WPPFSettlementID, MemberID, SettlementDate, WPPFAmount, WPPFInterest, GLTranID, GLTranInterestID, VoucherDate, Remarks, CheckNo, CheckDate, ServiceLength, FundTypeID, CreatedDate,CreatedBy) VALUES(%n,%n, %d, %n,%n, %n, %n, %d, %s, %s, %d, %n, %n, %d, %n)", oItem.ID, oItem.MemberID, oItem.SettlementDate, oItem.WPPFAmount, oItem.WPPFInterest, oItem.GLTranID, oItem.GLTranInterestID, oItem.VoucherDate, oItem.Remarks, oItem.CheckNo, oItem.CheckDate, oItem.ServiceLength, oItem.FundTypeID, oItem.CreatedDate, oItem.CreatedBy); tc.ExecuteNonQuery(sql); } #endregion #region Update function internal static void Update(TransactionContext tc, WPPFSettlement oItem) { tc.ExecuteNonQuery( "UPDATE FM_WPPFSettlement SET MemberID=%n, SettlementDate=%d, WPPFAmount=%n, WPPFInterest=%n, GLTranID=%n, GLTranInterestID=%n,VoucherDate=%d, Remarks=%s, CheckNo=%s, CheckDate=%d, ModifiedDate=%d, ModifiedBy=%n" + " WHERE WPPFSettlementID=%n", oItem.MemberID, oItem.SettlementDate, oItem.WPPFAmount, oItem.WPPFInterest, oItem.GLTranID, oItem.GLTranInterestID, oItem.VoucherDate, oItem.Remarks, oItem.CheckNo, oItem.CheckDate, oItem.ModifiedDate, oItem.ModifiedBy, oItem.ID); } #endregion #region int Generation function internal static int GetNewID(TransactionContext tc) { return tc.GenerateID("FM_WPPFSettlement", "WPPFSettlementID"); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM FM_WPPFSettlement"); } internal static IDataReader Get(TransactionContext tc, DateTime fromDate, DateTime toDate, int fundTypeID) { return tc.ExecuteReader("select * from FM_WPPFSettlement where SettlementDate between %d and %d and FundTypeID = %n",fromDate, toDate, fundTypeID); } internal static IDataReader Get(TransactionContext tc, int nFinalSettlementID) { return tc.ExecuteReader("SELECT * FROM FM_WPPFSettlement WHERE WPPFSettlementID=%n", nFinalSettlementID); } internal static IDataReader GetByMemberID(TransactionContext tc, int memberID) { return tc.ExecuteReader("SELECT * FROM FM_WPPFSettlement WHERE memberID=%n", memberID); } #endregion internal static IDataReader Get(TransactionContext tc, string sSql) { return tc.ExecuteReader("SELECT * FROM FM_WPPFSettlement %q order by SettlementDate", sSql); } internal static void Delete(TransactionContext tc, int settlementID) { string sUpdate = SQLParser.MakeSQL("Delete FM_WPPFSettlement where WPPFSettlementID = %n", settlementID); tc.ExecuteNonQuery(sUpdate); } } }