using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA.Fund { internal class InvestmentTranDA { #region Constructor public InvestmentTranDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, InvestmentTran oItem) { tc.ExecuteNonQuery( "INSERT INTO FM_InvestmentTran(ActivityID, TranTypeID, CategoryID, InvestmentID, TemplateVoucherID," + " FundTypeID, TranDate, TranID, Amount, CreatedBy, CreatedDate, InvestmentAIT) VALUES(%n, %n, %n, %n, %n, %n, %d, %n, %n, %n, %d, %n)", DataReader.GetNullValue(oItem.ActivityID), oItem.TranTypeID, oItem.CategoryID, oItem.InvestmentID, oItem.TemplateVoucherID, oItem.FundTypeID, oItem.TranDate, oItem.ID, oItem.PrincipalAmount, oItem.CreatedBy, oItem.CreatedDate, oItem.InvestmentAIT); } #endregion #region Update function internal static void Update(TransactionContext tc, InvestmentTran oItem) { tc.ExecuteNonQuery( "UPDATE FM_InvestmentTran SET ActivityID=%n, TranTypeID=%n, CategoryID=%n, InvestmentID=%n, TemplateVoucherID=%n, FundTypeID=%n, TranDate=%d, ModifiedBy=%n, ModifiedDate=%d, InvestmentAIT" + " WHERE TranID=%n", DataReader.GetNullValue(oItem.ActivityID), oItem.TranTypeID, oItem.CategoryID, oItem.InvestmentID, oItem.TemplateVoucherID, oItem.ID, oItem.TranDate, oItem.ModifiedBy, oItem.ModifiedDate, oItem.InvestmentAIT, oItem.ID); } internal static void UpdateInvestmentTranGLTranID(TransactionContext tc, int InterestGlTranID, int AITGLTranID, int InvestmentTranID) { tc.ExecuteNonQuery("UPDATE FM_InvestmentTran SET InterestGlTranID = %n, AITGLTranID = %n Where TRANID = %n", InterestGlTranID, AITGLTranID, InvestmentTranID); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc, int nTranID) { return tc.ExecuteReader("SELECT * FROM FM_InvestmentTran WHERE TranID=%n", nTranID); } internal static IDataReader GetbyGLtranID(TransactionContext tc, int gltranid) { return tc.ExecuteReader("SELECT * FROM FM_InvestmentTran WHERE TemplateVoucherID=%n", gltranid); } internal static DataSet Get(TransactionContext tc, DateTime fromDate, DateTime toDate) { string sSQL = SQLParser.MakeSQL(@"SELECT INVESTMENTID,sum(AMOUNT) TranAccruedAmount FROM FM_InvestmentTran iTran WHERE TranTypeid = %n AND TranDate BETWEEN %d AND %d GROUP BY INVESTMENTID", (int)EnumInvestmentActivities.InvestMonthlyAccrualInterest, fromDate, toDate); return tc.ExecuteDataSet(sSQL); } internal static IDataReader Get(TransactionContext tc, InvestmentInfo investmentInfo) { return tc.ExecuteReader("SELECT * FROM FM_InvestmentTran WHERE InvestmentID = %n order by trandate", investmentInfo.ID); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int nTranID) { tc.ExecuteNonQuery("DELETE FROM FM_InvestmentTran WHERE TranID=%n", nTranID); } internal static void DeleteByParent(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM FM_InvestmentTran WHERE InvestmentID=%n ", nID); } #endregion } }