using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA.Fund { internal class InvestmentLogDA { #region Constructor public InvestmentLogDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, InvestmentLog oItem) { string sSQL = string.Empty; sSQL = SQLParser.MakeSQL( @"INSERT INTO InvestmentLog(RecordID, InvestmentID, ProjectID, ActivityID, FMActivityID, TranDate, PrincipalAmount, AccountNo, BankID, BranchID, CategoryID, CertificateNo, RefID, PreStatus, CurrentStatus, CreatedBy, CreatedDate) VALUES(%n, %n, %n, %n, %n, %d, %n, %s, %n, %n, %s, %s, %n, %n, %n, %n, %d)", oItem.ID, oItem.InvestmentID, oItem.ID, DataReader.GetNullValue(oItem.ActivityID), oItem.FMActivityID, oItem.TranDate, oItem.PrincipalAmount, oItem.AccountNo, oItem.BankID, oItem.BranchID, oItem.CategoryID, oItem.CertificateNo, DataReader.GetNullValue(oItem.RefID), oItem.PreStatus, oItem.CurrentStatus, oItem.CreatedBy, oItem.CreatedDate); tc.ExecuteNonQuery(sSQL); } #endregion #region Update function internal static void Update(TransactionContext tc, InvestmentLog oItem) { tc.ExecuteNonQuery( "UPDATE InvestmentLog SET InvestmentID=%n, ProjectID=%n, TranDate=%d, PrincipalAmount=%n, AccountNo=%s, BankID=%n, BranchID=%n, CategoryID=%s, CertificateNo=%n, RefID=%n, PreStatus=%n, CurrentStatus=%n, ModifiedBy=%n, ModifiedDate=%d" + " WHERE RecordID=%n", oItem.InvestmentID, oItem.ID, oItem.TranDate, oItem.PrincipalAmount, oItem.AccountNo, oItem.BankID, oItem.BranchID, oItem.CategoryID, oItem.CertificateNo, DataReader.GetNullValue(oItem.RefID), oItem.PreStatus, oItem.CurrentStatus, oItem.ModifiedBy, oItem.ModifiedDate, oItem.ID); } #endregion #region int Generation function internal static int GetNewID(TransactionContext tc) { return tc.GenerateID("InvestmentLog", "RecordID"); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc, int fundtypeid) { return tc.ExecuteReader("SELECT * FROM InvestmentLog Where ProjectID=%n", fundtypeid); } internal static IDataReader Get(TransactionContext tc, int nRecordID, int fundtypeid) { return tc.ExecuteReader("SELECT * FROM InvestmentLog WHERE RecordID=%n AND ProjectID=%n", nRecordID, fundtypeid); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int nRecordID) { tc.ExecuteNonQuery("DELETE FROM InvestmentLog WHERE RecordID=%n AND ProjectID=%n", nRecordID); } internal static void DeleteByParent(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM InvestmentLog WHERE InvestmentID=%n", nID); } #endregion } }