using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA.Fund { internal class InvestmentScheduleDA { #region Constructor public InvestmentScheduleDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, InvestmentSchedule oItem) { tc.ExecuteNonQuery( "INSERT INTO InvestmentSchedule(FromDate, ID, InvestmentID, ProjectID, Percentage, RecalculationNeeded, TillDate, TranDate, CreatedBy, CreatedDate)" + " VALUES(%d, %n, %n, %n, %n, %b, %d, %d, %n, %d)", oItem.FromDate, oItem.ID, oItem.InvestmentID, oItem.ID, oItem.Percentage, oItem.RecalculationNeeded, oItem.TillDate, oItem.TranDate, oItem.CreatedBy, oItem.CreatedDate); } #endregion #region Update function internal static void Update(TransactionContext tc, InvestmentSchedule oItem) { tc.ExecuteNonQuery( "UPDATE InvestmentSchedule SET FromDate=%d, InvestmentID=%n, ProjectID=%n, Percentage=%n, RecalculationNeeded=%b, TillDate=%d, TranDate=%d, ModifiedBy=%n, ModifiedDate=%d" + " WHERE ID=%n", oItem.FromDate, oItem.InvestmentID, oItem.ID, oItem.Percentage, oItem.RecalculationNeeded, oItem.TillDate, oItem.TranDate, oItem.ModifiedBy, oItem.ModifiedDate, oItem.ID); } #endregion #region int Generation function internal static int GetNewID(TransactionContext tc) { return tc.GenerateID("InvestmentSchedule", "ID"); } #endregion #region Get Function internal static IDataReader Getbyfundtype(TransactionContext tc, int fundtypeid) { string sSQL = SQLParser.MakeSQL("SELECT * FROM InvestmentSchedule Where ProjectID=%n", fundtypeid); return tc.ExecuteReader(sSQL); } internal static IDataReader Get(TransactionContext tc, int nID) { return tc.ExecuteReader("SELECT * FROM InvestmentSchedule WHERE ID=%n", nID); } internal static IDataReader GetByParent(TransactionContext tc, int nInvestmentID) { return tc.ExecuteReader("SELECT * FROM InvestmentSchedule WHERE InvestmentID=%n ", nInvestmentID); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM InvestmentSchedule WHERE ID=%n", nID); } internal static void DeleteByParent(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM InvestmentSchedule WHERE InvestmentID=%n AND ProjectID=%n", nID); } #endregion } }