Ejemplo n.º 1
0
        /// <summary>
        /// Event handler for a match.
        /// </summary>
        /// <param name="sender">The object that originated the event.</param>
        /// <param name="e">The event arguments.</param>
        private void OnMatchRowChanged(Object sender, MatchRowChangeEventArgs e)
        {
            // When a new, pending match record has been added to the data mode, start a thread that will
            // display the notification window.
            if (e.Action == DataRowAction.Commit && e.Row.RowState != DataRowState.Detached)
            {
                if (e.Row.StatusRow.StatusCode == Status.Active ||
                    e.Row.StatusRow.StatusCode == Status.PartialMatch ||
                    e.Row.StatusRow.StatusCode == Status.ValidMatch ||
                    e.Row.StatusRow.StatusCode == Status.ValidMatchFunds ||
                    e.Row.StatusRow.StatusCode == Status.Declined)
                {
                    NotificationInfo notificationInfo = new NotificationInfo();

                    // The match record, working order, order type and security records are used to construct the title, symbol and
                    // logo used by the notification window.
                    MatchRow        matchRow        = e.Row;
                    WorkingOrderRow workingOrderRow = matchRow.WorkingOrderRow;
                    OrderTypeRow    orderTypeRow    = workingOrderRow.OrderTypeRow;
                    SecurityRow     securityRow     = workingOrderRow.SecurityRowByFK_Security_WorkingOrder_SecurityId;

                    // This is the primary method of identifying a match between two working orders.
                    notificationInfo.MatchId = matchRow.MatchId;

                    // The current status of the match is used to tell whether we're coming or going.
                    notificationInfo.Status = matchRow.StatusRow.StatusCode;

                    // Get the security symbol.
                    notificationInfo.Symbol = securityRow.Symbol;

                    // Create a logo bitmap.
                    notificationInfo.Logo = securityRow.IsLogoNull() ? String.Empty : securityRow.Logo;

                    // Provide a handler for the notification.
                    if (!securityRow.EntityRow.TypeRow.IsNotifyingTypeNull())
                    {
                        notificationInfo.NotifierType = securityRow.EntityRow.TypeRow.NotifyingType;

                        // Construct the title for the notification window.
                        notificationInfo.Message = String.Format("{0} of {1}", workingOrderRow.SideRow.Description, securityRow.Symbol);

                        // Now that the information has been extracted for the data model, the background execution queue can handle the rest of the
                        // notification of the user.
                        this.OnNotification(notificationInfo);
                    }
                }
            }
        }
 /// <summary>
 /// Handles a change to the MatchRow table.
 /// </summary>
 /// <param name="sender">The object that originated the event.</param>
 /// <param name="e">The event arguments.</param>
 void OnMatchRowChanged(object sender, MatchRowChangeEventArgs e)
 {
     // When the merge is completed, this indicates that the document should be refreshed.
     this.isDataChanged = true;
 }