コード例 #1
0
        /// <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;
                    ConsumerDebtPaymentRow paymentRow          = dataTableCoordiante.DataRow as ConsumerDebtPaymentRow;

                    // Update the Payment Status (StatusId) column.
                    if (dataTableCoordiante.DataColumn == DataModel.ConsumerDebtPayment.StatusIdColumn)
                    {
                        Guid selectedItem          = (Guid)sourceStatusComboBox.SelectedValue;
                        Guid persistedSelectedItem = (Guid)sourceStatusComboBox.PersistentSelectedValue;


                        FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() =>
                                                                                                                           TradingSupportWebService.UpdateConsumerDebtPayment(new ConsumerDebtPayment(paymentRow)
                        {
                            StatusId = persistedSelectedItem
                        })));
                    }
                }
            }
        }
コード例 #2
0
        /// <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;
                    ConsumerDebtPaymentRow paymentRow          = dataTableCoordiante.DataRow as ConsumerDebtPaymentRow;

                    // Update the Cleared Date column.
                    if (dataTableCoordiante.DataColumn == DataModel.ConsumerDebtPayment.ClearedDateColumn)
                    {
                        if (sourceDateTimePicker.DateTime != null)
                        {
                            DateTime selectedItem = (DateTime)sourceDateTimePicker.DateTime;
                            FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() =>
                                                                                                                               TradingSupportWebService.UpdateConsumerDebtPayment(new ConsumerDebtPayment(paymentRow)
                            {
                                ClearedDate = selectedItem
                            })));
                        }
                    }

                    // Update the Actual Payment Date column.
                    if (dataTableCoordiante.DataColumn == DataModel.ConsumerDebtPayment.ActualPaymentDateColumn)
                    {
                        if (sourceDateTimePicker.DateTime != null)
                        {
                            DateTime selectedItem = (DateTime)sourceDateTimePicker.DateTime;
                            FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() =>
                                                                                                                               TradingSupportWebService.UpdateConsumerDebtPayment(new ConsumerDebtPayment(paymentRow)
                            {
                                ActualPaymentDate = selectedItem
                            })));
                        }
                    }
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// Create a new ConsumerDebtPayment record.
 /// </summary>
 /// <param name="row"></param>
 public ConsumerDebtPayment(ConsumerDebtPaymentRow row)
 {
     this.RowId              = row.ConsumerDebtPaymentId;
     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;
 }
コード例 #4
0
        /// <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;
                ConsumerDebtPaymentRow paymentRow          = dataTableCoordiante.DataRow as ConsumerDebtPaymentRow;

                // Update the IsActive column.
                if (dataTableCoordiante.DataColumn == DataModel.ConsumerDebtPayment.IsActiveColumn)
                {
                    FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() =>
                                                                                                                       TradingSupportWebService.UpdateConsumerDebtPayment(new ConsumerDebtPayment(paymentRow)
                    {
                        IsActive = toggleButtonState
                    })));
                }

                // Update the IsCleared column.
                if (dataTableCoordiante.DataColumn == DataModel.ConsumerDebtPayment.IsClearedColumn)
                {
                    FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() =>
                                                                                                                       TradingSupportWebService.UpdateConsumerDebtPayment(new ConsumerDebtPayment(paymentRow)
                    {
                        IsCleared = toggleButtonState
                    })));
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Proxy to update consumerDebtPayments via TradingSupportClient.
        /// </summary>
        /// <param name="consumerDebt"></param>
        /// <returns></returns>
        public static MethodResponseErrorCode UpdateConsumerDebtPayment(ConsumerDebtPayment consumerDebtPayment)
        {
            if (consumerDebtPayment.RowId == Guid.Empty)
            {
                throw new MissingFieldException("RowId is not set");
            }

            lock (DataModel.SyncRoot)
            {
                ConsumerDebtPaymentRow row = DataModel.ConsumerDebtPayment.ConsumerDebtPaymentKey.Find(consumerDebtPayment.RowId);

                if (TradingSupportWebService.ColumnChanged(row, consumerDebtPayment))
                {
                    return(UpdateConsumerDebtPayment(new ConsumerDebtPayment[] { consumerDebtPayment }));
                }
                else
                {
                    return(null);
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// Safely retrieve workingOrderRow from a reportRow
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        private ConsumerDebtPaymentRow GetandValidateWorkingRow(FluidTrade.Core.Windows.Controls.ReportRow row)
        {
            ConsumerDebtPaymentRow workingOrderRow = row.NullSafe(datarow => datarow.IContent).NullSafe(Content => Content.Key) as ConsumerDebtPaymentRow;

            try
            {
                if (workingOrderRow != null)
                {
                    if (workingOrderRow.ConsumerDebtPaymentId != null)
                    {
                        return(workingOrderRow);
                    }
                }
            }
            catch (RowNotInTableException)
            {
                //Deleted row.
                workingOrderRow = null;
            }

            return(workingOrderRow);
        }
コード例 #7
0
 private bool FilterBlotters(ConsumerDebtPaymentRow paymentRow)
 {
     return(paymentRow.ConsumerDebtSettlementId == this.ConsumerTrustSettlementId);
 }
コード例 #8
0
 private Schema.DebtHolderPaymentSummary.PaymentSummary MatchSelector(ConsumerDebtPaymentRow paymentRow)
 {
     Schema.DebtHolderPaymentSummary.PaymentSummary match = new Schema.DebtHolderPaymentSummary.PaymentSummary();
     return(match.Select(paymentRow));
 }
コード例 #9
0
        /// <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.ConsumerDebtPayment.CheckIdColumn)
            {
                ConsumerDebtPaymentRow consumerDebtPaymentRow = dataTableCoordiante.DataRow as ConsumerDebtPaymentRow;
                FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() =>
                                                                                                                   TradingSupportWebService.UpdateConsumerDebtPayment(new ConsumerDebtPayment(consumerDebtPaymentRow)
                {
                    CheckId = textBoxTxt
                })));
            }

            if (dataTableCoordiante.DataColumn == DataModel.ConsumerDebtPayment.Fee0Column)
            {
                Decimal result;
                bool    parsed = Decimal.TryParse(textBoxTxt, out result);
                if (!parsed)
                {
                    result = 0.0m;
                }

                ConsumerDebtPaymentRow consumerDebtPaymentRow = dataTableCoordiante.DataRow as ConsumerDebtPaymentRow;
                FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() =>
                                                                                                                   TradingSupportWebService.UpdateConsumerDebtPayment(new ConsumerDebtPayment(consumerDebtPaymentRow)
                {
                    Fee0 = result
                })));
            }

            if (dataTableCoordiante.DataColumn == DataModel.ConsumerDebtPayment.ActualPaymentValueColumn)
            {
                Decimal result;
                bool    parsed = Decimal.TryParse(textBoxTxt, out result);
                if (!parsed)
                {
                    result = 0.0m;
                }

                ConsumerDebtPaymentRow consumerDebtPaymentRow = dataTableCoordiante.DataRow as ConsumerDebtPaymentRow;
                FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() =>
                                                                                                                   TradingSupportWebService.UpdateConsumerDebtPayment(new ConsumerDebtPayment(consumerDebtPaymentRow)
                {
                    ActualPaymentValue = result
                })));
            }

            if (dataTableCoordiante.DataColumn == DataModel.ConsumerDebtPayment.Memo0Column)
            {
                ConsumerDebtPaymentRow consumerDebtPaymentRow = dataTableCoordiante.DataRow as ConsumerDebtPaymentRow;
                FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() =>
                                                                                                                   TradingSupportWebService.UpdateConsumerDebtPayment(new ConsumerDebtPayment(consumerDebtPaymentRow)
                {
                    Memo0 = textBoxTxt
                })));
            }

            if (dataTableCoordiante.DataColumn == DataModel.ConsumerDebtPayment.Memo1Column)
            {
                ConsumerDebtPaymentRow consumerDebtPaymentRow = dataTableCoordiante.DataRow as ConsumerDebtPaymentRow;
                FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() =>
                                                                                                                   TradingSupportWebService.UpdateConsumerDebtPayment(new ConsumerDebtPayment(consumerDebtPaymentRow)
                {
                    Memo1 = textBoxTxt
                })));
            }

            if (dataTableCoordiante.DataColumn == DataModel.ConsumerDebtPayment.Memo2Column)
            {
                ConsumerDebtPaymentRow consumerDebtPaymentRow = dataTableCoordiante.DataRow as ConsumerDebtPaymentRow;
                FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() =>
                                                                                                                   TradingSupportWebService.UpdateConsumerDebtPayment(new ConsumerDebtPayment(consumerDebtPaymentRow)
                {
                    Memo2 = textBoxTxt
                })));
            }

            if (dataTableCoordiante.DataColumn == DataModel.ConsumerDebtPayment.TrackingNumberColumn)
            {
                ConsumerDebtPaymentRow consumerDebtPaymentRow = dataTableCoordiante.DataRow as ConsumerDebtPaymentRow;
                FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(UpdateField, new Func <MethodResponseErrorCode>(() =>
                                                                                                                   TradingSupportWebService.UpdateConsumerDebtPayment(new ConsumerDebtPayment(consumerDebtPaymentRow)
                {
                    TrackingNumber = textBoxTxt
                })));
            }
        }
コード例 #10
0
        /// <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);
        }