private static BankStmtCashFlowForecast ReconcileForecast(Session session, BankStmt bankStmtObj, CashFlow cashFlowObj, bool commit) { // use the same session for both BankStmt and CashFlow object BankStmt bankStmt = bankStmtObj; if (session != bankStmtObj.Session) { bankStmt = session.GetObjectByKey <BankStmt>(session.GetKeyValue(bankStmtObj)); } CashFlow cashFlow = cashFlowObj; if (session != cashFlowObj.Session) { cashFlow = session.GetObjectByKey <CashFlow>(session.GetKeyValue(cashFlowObj)); } // associate the bank stmt object with the cash flow forecast object using a link object (BankStmtCashFlowForecast) // if link object does not exist, then create it var bsCff = session.FindObject <BankStmtCashFlowForecast>(CriteriaOperator.Parse( "BankStmt = ?", bankStmt)); if (bsCff == null) { bsCff = new BankStmtCashFlowForecast(session); bsCff.BankStmt = bankStmt; } bsCff.CashFlow = cashFlow; if (commit) { session.CommitTransaction(); } return(bsCff); }
public BankStmtCashFlowForecast ReconcileItem(BankStmt bankStmt, CashFlow cashFlow) { // TODO: can selected objects be cast into a List? // Record the Cash Flow Forecast that was reconciled with the Bank Stmt BankStmtCashFlowForecast bsCff = ReconcileForecast(objSpace.Session, bankStmt, cashFlow); ChangeBankStmtToCashFlowForecast(bsCff.BankStmt, bsCff.CashFlow); return(bsCff); }
private static void ChangeBankStmtToCashFlowForecast(BankStmt bankStmt, CashFlow cashFlow) { bool oldCalculateEnabled = bankStmt.CalculateEnabled; bankStmt.CalculateEnabled = false; bankStmt.CounterCcy = cashFlow.CounterCcy; bankStmt.CounterCcyAmt = cashFlow.CounterCcyAmt; bankStmt.FunctionalCcyAmt = cashFlow.FunctionalCcyAmt; bankStmt.SummaryDescription = cashFlow.Description; bankStmt.Counterparty = cashFlow.Counterparty; bankStmt.Activity = cashFlow.Activity; bankStmt.CalculateEnabled = oldCalculateEnabled; }
private static BankStmtCashFlowForecast ReconcileForecast(Session session, BankStmt bankStmtObj, CashFlow cashFlowObj) { return(ReconcileForecast(session, bankStmtObj, cashFlowObj, false)); }