using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA.Fund { internal class GFSettlementDA { public GFSettlementDA() { } #region Insert function internal static void Insert(TransactionContext tc, GFSettlement oItem) { string sql = SQLParser.MakeSQL(@"INSERT INTO FM_GFSettlement (GFSettlementID, MemberID, SettlementDate, GFAmount, GFInterest, GLTranID, GLTranInterestID, CreatedDate,CreatedBy, SeperationMode, ExitNoticeDate, LastWorkingDay, TerminationEffectiveDate, NoticePeriodEndDate, NoticePeriodRequired, NoticePeriodGiven, LengthOfService, FundTypeID) VALUES(%n,%n, %d, %n,%n, %n, %n,%d, %n, %n, %d, %d, %d, %d, %n, %n, %n, %n )", oItem.ID, oItem.MemberID, oItem.SettlementDate, oItem.GFAmount, oItem.GFInterest, oItem.GLTranID, oItem.GLTranInterestID, oItem.CreatedDate, oItem.CreatedBy, oItem.SeparationMode, oItem.ExitNoticeDate, oItem.LastWorkingDay, oItem.TerminationEffectiveDate, oItem.NoticePeriodEndDate, oItem.NoticePeriodRequired, oItem.NoticePeriodGiven, oItem.LengthOfService, oItem.FundTypeID); tc.ExecuteNonQuery(sql); } #endregion #region Update function internal static void Update(TransactionContext tc, GFSettlement oItem) { tc.ExecuteNonQuery("UPDATE FM_GFSettlement SET MemberID=%n, SettlementDate=%d, GFAmount=%n, GFInterest=%n, GLTranID=%n, GLTranInterestID=%n, ModifiedDate=%d, ModifiedBy=%n SeperationMode = %n, ExitNoticeDate = %d, LastWorkingDay = %d, TerminationEffectiveDate = %d,NoticePeriodEndDate = %d, NoticePeriodRequired = %n, NoticePeriodGiven = %n, LengthOfService= %n" + " WHERE GFSettlementID=%n", oItem.MemberID, oItem.SettlementDate, oItem.GFAmount, oItem.GFInterest, oItem.GLTranID, oItem.GLTranInterestID, oItem.ModifiedDate, oItem.ModifiedBy, oItem.SeparationMode, oItem.ExitNoticeDate, oItem.LastWorkingDay, oItem.TerminationEffectiveDate, oItem.NoticePeriodEndDate, oItem.NoticePeriodRequired, oItem.NoticePeriodGiven, oItem.LengthOfService, oItem.ID); } #endregion #region int Generation function internal static int GetNewID(TransactionContext tc) { return tc.GenerateID("FM_GFSettlement", "GFSettlementID"); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM FM_GFSettlement"); } internal static IDataReader Get(TransactionContext tc, int nFinalSettlementID) { return tc.ExecuteReader("SELECT * FROM FM_GFSettlement WHERE GFSettlementID=%n", nFinalSettlementID); } internal static IDataReader Get(TransactionContext tc, DateTime fromDate, DateTime toDate, int fundTypeID) { return tc.ExecuteReader("SELECT * FROM FM_GFSettlement WHERE SETTLEMENTDATE BETWEEN %d and %d and FundTypeID = %n", fromDate, toDate, fundTypeID); } #endregion internal static IDataReader Get(TransactionContext tc, string sSql) { return tc.ExecuteReader("SELECT * FROM FM_GFSettlement %q order by SettlementDate", sSql); } internal static void Delete(TransactionContext tc, int settlementID) { string sUpdate = SQLParser.MakeSQL("Delete FM_GFSettlement where GFSettlementID = %n", settlementID); tc.ExecuteNonQuery(sUpdate); } internal static IDataReader GetByMemberID(TransactionContext tc, int memberID) { return tc.ExecuteReader("SELECT * FROM FM_GFSettlement where MEMBERID = %n", memberID); } } }