/// <summary> /// find any single matches and get rid of them /// </summary> public void CleanUnpairedMatches() { MatchDataTable.CleanUnpairedMatches(); }
/// <summary> /// Determine whether there is a settlement (indirectly) associated with a match. /// </summary> /// <param name="transaction">The current transaction.</param> /// <param name="match">The match to check.</param> /// <returns>True if the account is settled.</returns> public static bool IsSettled(DataModelTransaction transaction, MatchRow match) { return(MatchDataTable.IsSettled(transaction, match, true)); }
/// <summary> /// find any single matches and get rid of them /// </summary> public void RematchAllWorkingOrders() { MatchDataTable.RematchAllWorkingOrders(); }
/// <summary> /// Delete a credit card /// </summary> /// <returns>True for sucess</returns> public override ErrorCode Delete(CreditCard record) { DataModel dataModel = new DataModel(); DataModelTransaction transaction = DataModelTransaction.Current; CreditCardRow creditCardRow = DataModel.CreditCard.CreditCardKey.Find(record.RowId); WorkingOrderRow workingOrderRow = null; MatchRow[] matchRows; Guid blotterId; if (record.RowId == null || creditCardRow == null) { return(ErrorCode.RecordNotFound); } workingOrderRow = this.FindWorkingOrder(transaction, record.RowId); workingOrderRow.AcquireReaderLock(transaction); matchRows = workingOrderRow.GetMatchRows(); blotterId = workingOrderRow.BlotterId; workingOrderRow.ReleaseLock(transaction.TransactionId); if (!DataModelFilters.HasAccess(transaction, TradingSupport.UserId, blotterId, AccessRight.Write)) { return(ErrorCode.AccessDenied); } MatchPersistence matchPersistence = new MatchPersistence(); foreach (MatchRow matchRow in matchRows) { matchRow.AcquireReaderLock(transaction); Records.Match matchRecord = new Records.Match() { RowId = matchRow.MatchId, RowVersion = matchRow.RowVersion }; ConsumerTrustNegotiationRow[] consumerTrustNegotiationRows = matchRow.GetConsumerTrustNegotiationRows(); ConsumerDebtNegotiationRow[] consumerDebtNegotiationRows = matchRow.GetConsumerDebtNegotiationRows(); matchRow.ReleaseLock(transaction.TransactionId); foreach (ConsumerTrustNegotiationRow negotiationRow in consumerTrustNegotiationRows) { negotiationRow.AcquireReaderLock(transaction); Guid negRowCreditCardId = negotiationRow.CreditCardId; negotiationRow.ReleaseLock(transaction.TransactionId); if (negRowCreditCardId == record.RowId) { if (MatchDataTable.IsSettled(transaction, matchRow, true) == true) { return(ErrorCode.RecordExists); } matchPersistence.Delete(matchRecord); break; } } } dataModel.DestroyCreditCard( new object[] { record.RowId }, record.RowVersion); return(ErrorCode.Success); }