/// <summary> /// Handle sending data down to the server for a combo box changed event. /// </summary> /// <param name="sender"></param> /// <param name="routedEventArgs"></param> private void OnComboBoxChange(object sender, RoutedEventArgs routedEventArgs) { FluidTrade.Guardian.Windows.Controls.StatusComboBox originalSourceStatusComboBox = routedEventArgs.OriginalSource as FluidTrade.Guardian.Windows.Controls.StatusComboBox; if (originalSourceStatusComboBox != null) { IContent iContent = originalSourceStatusComboBox.DataContext as IContent; FluidTrade.Guardian.Windows.Controls.StatusComboBox sourceStatusComboBox = routedEventArgs.Source as FluidTrade.Guardian.Windows.Controls.StatusComboBox; if (InputHelper.IsUserInitiated(originalSourceStatusComboBox, FluidTrade.Guardian.Windows.Controls.StatusComboBox.PersistentSelectedValueProperty) && (sourceStatusComboBox != null) && (iContent != null) && (iContent.Key is DataTableCoordinate)) { // At this point, a ComboBox was modified by the user and it is connected to a data model field. This will // extract the coordinates of the field in the table. That, in turn, drives the decision about how to update the // shared data model. DataTableCoordinate dataTableCoordiante = iContent.Key as DataTableCoordinate; ConsumerTrustPaymentRow paymentRow = dataTableCoordiante.DataRow as ConsumerTrustPaymentRow; // Update the Payment Status (StatusId) column. if (dataTableCoordiante.DataColumn == DataModel.ConsumerTrustPayment.StatusIdColumn) { Guid selectedItem = (Guid)sourceStatusComboBox.SelectedValue; Guid persistedSelectedItem = (Guid)sourceStatusComboBox.PersistentSelectedValue; FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() => TradingSupportWebService.UpdateConsumerTrustPayment(new ConsumerTrustPayment(paymentRow) { StatusId = persistedSelectedItem }))); } } } }
/// <summary> /// Handle sending data down to the server for a date time picker changed event. /// </summary> /// <param name="sender"></param> /// <param name="routedEventArgs"></param> private void OnDateTimePicker(object sender, RoutedEventArgs routedEventArgs) { FluidTrade.Actipro.DateTimePicker originalSourceDateTimePicker = routedEventArgs.OriginalSource as FluidTrade.Actipro.DateTimePicker; if (originalSourceDateTimePicker != null) { IContent iContent = originalSourceDateTimePicker.DataContext as IContent; FluidTrade.Actipro.DateTimePicker sourceDateTimePicker = routedEventArgs.Source as FluidTrade.Actipro.DateTimePicker; if (InputHelper.IsUserInitiated(originalSourceDateTimePicker, FluidTrade.Actipro.DateTimePicker.DateTimeProperty) && (sourceDateTimePicker != null) && (iContent != null) && (iContent.Key is DataTableCoordinate)) { // At this point, a ComboBox was modified by the user and it is connected to a data model field. This will // extract the coordinates of the field in the table. That, in turn, drives the decision about how to update the // shared data model. DataTableCoordinate dataTableCoordiante = iContent.Key as DataTableCoordinate; ConsumerTrustPaymentRow paymentRow = dataTableCoordiante.DataRow as ConsumerTrustPaymentRow; // Update the Cleared Date column. if (dataTableCoordiante.DataColumn == DataModel.ConsumerTrustPayment.ClearedDateColumn) { if (sourceDateTimePicker.DateTime != null) { DateTime selectedItem = (DateTime)sourceDateTimePicker.DateTime; FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() => TradingSupportWebService.UpdateConsumerTrustPayment(new ConsumerTrustPayment(paymentRow) { ClearedDate = selectedItem }))); } } // Update the Actual Payment Date column. if (dataTableCoordiante.DataColumn == DataModel.ConsumerTrustPayment.ActualPaymentDateColumn) { if (sourceDateTimePicker.DateTime != null) { DateTime selectedItem = (DateTime)sourceDateTimePicker.DateTime; FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() => TradingSupportWebService.UpdateConsumerTrustPayment(new ConsumerTrustPayment(paymentRow) { ActualPaymentDate = selectedItem }))); } } } } }
/// <summary> /// Create a new ConsumerDebtPayment record. /// </summary> /// <param name="row"></param> public ConsumerTrustPayment(ConsumerTrustPaymentRow row) { this.RowId = row.ConsumerTrustPaymentId; this.RowVersion = row.RowVersion; this.ActualPaymentDate = row.IsActualPaymentDateNull() ? null : (DateTime?)row.ActualPaymentDate; this.ActualPaymentValue = row.IsActualPaymentValueNull() ? null : (Decimal?)row.ActualPaymentValue; this.CheckId = row.IsCheckIdNull() ? null : row.CheckId; this.ClearedDate = row.ClearedDate; this.Fee0 = row.IsFee0Null() ? (Decimal?)null : (Decimal?)row.Fee0; this.IsActive = row.IsActive; this.IsCleared = row.IsCleared; this.Memo0 = row.IsMemo0Null() ? null : row.Memo0; this.Memo1 = row.IsMemo1Null() ? null : row.Memo1; this.Memo2 = row.IsMemo2Null() ? null : row.Memo2; this.Memo3 = row.IsMemo3Null() ? null : row.Memo3; this.StatusId = row.StatusId; }
/// <summary> /// Constructor /// </summary> /// <param name="consumerTrustPaymentRow"></param> internal PaymentInfo(ConsumerTrustPaymentRow consumerTrustPaymentRow) { this.BlotterId = consumerTrustPaymentRow.BlotterId; this.ConsumerTrustPaymentId = consumerTrustPaymentRow.ConsumerTrustPaymentId; this.EffectivePaymentDate = consumerTrustPaymentRow.EffectivePaymentDate; this.EffectivePaymentValue = consumerTrustPaymentRow.EffectivePaymentValue; this.Fee0 = consumerTrustPaymentRow.Fee0; this.Fee1 = consumerTrustPaymentRow.Fee1; this.Fee2 = consumerTrustPaymentRow.Fee2; this.Fee3 = consumerTrustPaymentRow.Fee3; this.IsActive = consumerTrustPaymentRow.IsActive; this.IsCleared = consumerTrustPaymentRow.IsCleared; this.Memo0 = consumerTrustPaymentRow.IsMemo0Null() ? string.Empty : consumerTrustPaymentRow.Memo0; this.Memo1 = consumerTrustPaymentRow.IsMemo1Null() ? string.Empty : consumerTrustPaymentRow.Memo1; this.Memo2 = consumerTrustPaymentRow.IsMemo2Null() ? string.Empty : consumerTrustPaymentRow.Memo2; this.Memo3 = consumerTrustPaymentRow.IsMemo3Null() ? string.Empty : consumerTrustPaymentRow.Memo3; this.PaymentId = consumerTrustPaymentRow.ConsumerTrustPaymentId; this.StatusId = consumerTrustPaymentRow.StatusId; this.TrackingNumber = consumerTrustPaymentRow.IsTrackingNumberNull() ? String.Empty : consumerTrustPaymentRow.TrackingNumber; }
/// <summary> /// Proxy to update consumerTrustPayments via TradingSupportClient. /// </summary> /// <param name="consumerTrust"></param> /// <returns></returns> public static MethodResponseErrorCode UpdateConsumerTrustPayment(ConsumerTrustPayment consumerTrustPayment) { if (consumerTrustPayment.RowId == Guid.Empty) { throw new MissingFieldException("RowId is not set"); } lock (DataModel.SyncRoot) { ConsumerTrustPaymentRow row = DataModel.ConsumerTrustPayment.ConsumerTrustPaymentKey.Find(consumerTrustPayment.RowId); if (TradingSupportWebService.ColumnChanged(row, consumerTrustPayment)) { return(UpdateConsumerTrustPayment(new ConsumerTrustPayment[] { consumerTrustPayment })); } else { return(null); } } }
/// <summary> /// Safely retrieve workingOrderRow from a reportRow /// </summary> /// <param name="row"></param> /// <returns></returns> private ConsumerTrustPaymentRow GetandValidateWorkingRow(FluidTrade.Core.Windows.Controls.ReportRow row) { ConsumerTrustPaymentRow workingOrderRow = row.NullSafe(datarow => datarow.IContent).NullSafe(Content => Content.Key) as ConsumerTrustPaymentRow; try { if (workingOrderRow != null) { if (workingOrderRow.ConsumerTrustPaymentId != null) { return(workingOrderRow); } } } catch (RowNotInTableException) { //Deleted row. workingOrderRow = null; } return(workingOrderRow); }
/// <summary> /// Handlers for the Toggle button class of controls. /// </summary> /// <param name="sender">The object that originated the event.</param> /// <param name="routedEventArgs">The routed event arguments.</param> private void OnToggleButtonChange(object sender, RoutedEventArgs routedEventArgs) { // The main idea of this handler is to sort out the user generated actions from the machine generated actions. Once // its determined that it was a user action, a background thread is called to change the associated field to the value // selected by the ToggleButton. ToggleButton toggleButton = routedEventArgs.OriginalSource as ToggleButton; IContent iContent = toggleButton.DataContext as IContent; // This filters all the ToggleButton events looking for user initiated actions that are bound to the data model. if (InputHelper.IsUserInitiated(toggleButton, ToggleButton.IsCheckedProperty) && iContent != null && iContent.Key is DataTableCoordinate) { bool toggleButtonState = toggleButton.IsChecked.GetValueOrDefault(); // At this point, a ToggleButton was modified by the user and it is connected to a data model field. This will // extract the coordinates of the field in the table. That, in turn, drives the decision about how to update the // shared data model. DataTableCoordinate dataTableCoordiante = iContent.Key as DataTableCoordinate; ConsumerTrustPaymentRow paymentRow = dataTableCoordiante.DataRow as ConsumerTrustPaymentRow; // Update the IsActive column. if (dataTableCoordiante.DataColumn == DataModel.ConsumerTrustPayment.IsActiveColumn) { FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() => TradingSupportWebService.UpdateConsumerTrustPayment(new ConsumerTrustPayment(paymentRow) { IsActive = toggleButtonState }))); } // Update the IsCleared column. if (dataTableCoordiante.DataColumn == DataModel.ConsumerTrustPayment.IsClearedColumn) { FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() => TradingSupportWebService.UpdateConsumerTrustPayment(new ConsumerTrustPayment(paymentRow) { IsCleared = toggleButtonState }))); } } }
private bool FilterBlotters(ConsumerTrustPaymentRow paymentRow) { return(paymentRow.ConsumerTrustSettlementId == this.ConsumerTrustSettlementId); }
private Schema.DebtNegotiatorPaymentSummary.PaymentSummary MatchSelector(ConsumerTrustPaymentRow paymentRow) { Schema.DebtNegotiatorPaymentSummary.PaymentSummary match = new Schema.DebtNegotiatorPaymentSummary.PaymentSummary(); return(match.Select(paymentRow)); }
/// <summary> /// Handle sending data down to the server for a text box changed event. /// </summary> /// <param name="textBoxTxt"></param> /// <param name="iContent"></param> private void TextBoxValueChanged(string textBoxTxt, IContent iContent) { DataTableCoordinate dataTableCoordiante = iContent.Key as DataTableCoordinate; ConsumerRow workingOrderRow = dataTableCoordiante.DataRow as ConsumerRow; string textBoxString = textBoxTxt; Guid workingOrderId = dataTableCoordiante.Association; if (dataTableCoordiante.DataColumn == DataModel.ConsumerTrustPayment.CheckIdColumn) { ConsumerTrustPaymentRow consumerTrustPaymentRow = dataTableCoordiante.DataRow as ConsumerTrustPaymentRow; FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() => TradingSupportWebService.UpdateConsumerTrustPayment(new ConsumerTrustPayment(consumerTrustPaymentRow) { CheckId = textBoxTxt }))); } if (dataTableCoordiante.DataColumn == DataModel.ConsumerTrustPayment.Fee0Column) { Decimal result; bool parsed = Decimal.TryParse(textBoxTxt, out result); if (!parsed) { result = 0.0m; } ConsumerTrustPaymentRow consumerTrustPaymentRow = dataTableCoordiante.DataRow as ConsumerTrustPaymentRow; FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() => TradingSupportWebService.UpdateConsumerTrustPayment(new ConsumerTrustPayment(consumerTrustPaymentRow) { Fee0 = result }))); } if (dataTableCoordiante.DataColumn == DataModel.ConsumerTrustPayment.ActualPaymentValueColumn) { Decimal result; bool parsed = Decimal.TryParse(textBoxTxt, out result); if (!parsed) { result = 0.0m; } ConsumerTrustPaymentRow consumerTrustPaymentRow = dataTableCoordiante.DataRow as ConsumerTrustPaymentRow; FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() => TradingSupportWebService.UpdateConsumerTrustPayment(new ConsumerTrustPayment(consumerTrustPaymentRow) { ActualPaymentValue = result }))); } if (dataTableCoordiante.DataColumn == DataModel.ConsumerTrustPayment.Memo0Column) { ConsumerTrustPaymentRow consumerTrustPaymentRow = dataTableCoordiante.DataRow as ConsumerTrustPaymentRow; FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() => TradingSupportWebService.UpdateConsumerTrustPayment(new ConsumerTrustPayment(consumerTrustPaymentRow) { Memo0 = textBoxTxt }))); } if (dataTableCoordiante.DataColumn == DataModel.ConsumerTrustPayment.Memo1Column) { ConsumerTrustPaymentRow consumerTrustPaymentRow = dataTableCoordiante.DataRow as ConsumerTrustPaymentRow; FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() => TradingSupportWebService.UpdateConsumerTrustPayment(new ConsumerTrustPayment(consumerTrustPaymentRow) { Memo1 = textBoxTxt }))); } if (dataTableCoordiante.DataColumn == DataModel.ConsumerTrustPayment.Memo2Column) { ConsumerTrustPaymentRow consumerTrustPaymentRow = dataTableCoordiante.DataRow as ConsumerTrustPaymentRow; FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() => TradingSupportWebService.UpdateConsumerTrustPayment(new ConsumerTrustPayment(consumerTrustPaymentRow) { Memo2 = textBoxTxt }))); } if (dataTableCoordiante.DataColumn == DataModel.ConsumerTrustPayment.TrackingNumberColumn) { ConsumerTrustPaymentRow consumerTrustPaymentRow = dataTableCoordiante.DataRow as ConsumerTrustPaymentRow; FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() => TradingSupportWebService.UpdateConsumerTrustPayment(new ConsumerTrustPayment(consumerTrustPaymentRow) { TrackingNumber = textBoxTxt }))); } }
/// <summary> /// Update Consumer Debt Payment Record /// </summary> /// <param name="record"></param> public override void Update(ConsumerDebtPayment record) { DataModel dataModel = new DataModel(); //Use the current transaction DataModelTransaction transaction = DataModelTransaction.Current; Guid userId = TradingSupport.UserId; //Use the deamonUser so that Modified user can be resolved from the other side of the chinese firewall. Guid deamonUser = TradingSupport.DaemonUserId; Guid blotterId; Int64 contraPaymentRowVersion; //Sanity Check ConsumerDebtPaymentRow consumerDebtPaymentRow = DataModel.ConsumerDebtPayment.ConsumerDebtPaymentKey.Find(record.RowId); if (consumerDebtPaymentRow == null) { throw new FaultException <RecordNotFoundFault>(new RecordNotFoundFault("ConsumerDebtPayment", new object[] { record.RowId })); } consumerDebtPaymentRow.AcquireWriterLock(transaction.TransactionId, DataModel.LockTimeout); try { blotterId = consumerDebtPaymentRow.BlotterId; } finally { consumerDebtPaymentRow.ReleaseReaderLock(transaction.TransactionId); } if (!DataModelFilters.HasAccess(transaction, userId, blotterId, AccessRight.Write)) { throw new FaultException <SecurityFault>(new SecurityFault("Current user does not have write access to the payment summary")); } ConsumerTrustPaymentRow consumerTrustPaymentRow = DataModel.ConsumerTrustPayment.ConsumerTrustPaymentKey.Find(record.RowId); consumerTrustPaymentRow.AcquireReaderLock(transaction.TransactionId, DataModel.LockTimeout); try { contraPaymentRowVersion = consumerTrustPaymentRow.RowVersion; } finally { consumerTrustPaymentRow.ReleaseLock(transaction.TransactionId); } dataModel.UpdateConsumerDebtPayment( record.ActualPaymentDate == null? DBNull.Value : (object)record.ActualPaymentDate.Value, record.ActualPaymentValue == null ? DBNull.Value : (object)record.ActualPaymentValue.Value, null, record.CheckId, record.ClearedDate, record.RowId, new object[] { record.RowId }, null, null, null, null, null, null, record.Fee0 == null ? DBNull.Value : (object)record.Fee0, null, null, null, record.IsActive, record.IsCleared, record.Memo0, record.Memo1, record.Memo2, record.Memo3, DateTime.UtcNow, userId, record.RowVersion, record.StatusId, record.TrackingNumber); //Update Contra side dataModel.UpdateConsumerTrustPayment( record.ActualPaymentDate == null ? DBNull.Value : (object)record.ActualPaymentDate.Value, record.ActualPaymentValue == null ? DBNull.Value : (object)record.ActualPaymentValue.Value, null, record.CheckId, record.ClearedDate, null, new object[] { record.RowId }, null, null, null, null, null, record.Fee0 == null ? DBNull.Value : (object)record.Fee0, null, null, null, record.IsActive, record.IsCleared, record.Memo0, record.Memo1, record.Memo2, record.Memo3, DateTime.UtcNow, deamonUser, contraPaymentRowVersion, record.StatusId, record.TrackingNumber); }