/// <summary> /// Marks a set of record(s) as read. /// </summary> /// <param name="state">The list to delete.</param> private void ApproveSettlementThread(object state) { List <ConsumerDebtSettlementRow> consumerDebtSettlementRows = state as List <ConsumerDebtSettlementRow>; List <ConsumerDebtSettlementAcceptInfo> consumerDebtSettlementAcceptInfos = new List <ConsumerDebtSettlementAcceptInfo>(); // Set up the list of accept records to send. try { lock (DataModel.SyncRoot) { foreach (ConsumerDebtSettlementRow consumerDebtSettlementRow in consumerDebtSettlementRows) { // Construct a version of the negotiation record from the known information and update the 'IsRead' flag. ConsumerDebtSettlementAcceptInfo consumerDebtSettlementAcceptInfo = new ConsumerDebtSettlementAcceptInfo(); consumerDebtSettlementAcceptInfo.ConsumerDebtSettlementId = consumerDebtSettlementRow.ConsumerDebtSettlementId; consumerDebtSettlementAcceptInfo.RowVersion = consumerDebtSettlementRow.RowVersion; consumerDebtSettlementAcceptInfos.Add(consumerDebtSettlementAcceptInfo); } } } catch (Exception exception) { // Any issues trying to communicate to the server are logged or might not have a valid match row cell to bold or unbold. EventLog.Error("{0}, {1}", exception.Message, exception.StackTrace); this.Dispatcher.BeginInvoke(new Action(() => MessageBox.Show(Application.Current.MainWindow, "Failed to perform Approve Settlement operation.", Application.Current.MainWindow.Title))); return; } // Send the accept records. TradingSupportClient tradingSupportClient = new TradingSupportClient(Guardian.Properties.Settings.Default.TradingSupportEndpoint); try { tradingSupportClient.AcceptConsumerDebtSettlement(consumerDebtSettlementAcceptInfos.ToArray()); } catch (FaultException faultException) { EventLog.Error("{0}, {1}", faultException.Message, faultException.StackTrace); this.Dispatcher.BeginInvoke(new Action(() => MessageBox.Show(Application.Current.MainWindow, faultException.Message, Application.Current.MainWindow.Title))); } catch (Exception exception) { // Any issues trying to communicate to the server are logged or might not have a valid match row cell to bold or unbold. EventLog.Error("{0}, {1}", exception.Message, exception.StackTrace); this.Dispatcher.BeginInvoke(new Action(() => MessageBox.Show(Application.Current.MainWindow, "Failed to perform Approve Settlement operation.", Application.Current.MainWindow.Title))); } finally { if (tradingSupportClient != null && tradingSupportClient.State == CommunicationState.Opened) { tradingSupportClient.Close(); } } }