Exemplo n.º 1
0
        protected override void OpenCommand()
        {
            try
            {
                // Lock the tables.
                System.Diagnostics.Debug.Assert(!ClientMarketData.IsLocked);
                ClientMarketData.BlotterLock.AcquireReaderLock(CommonTimeout.LockWait);
                ClientMarketData.StylesheetLock.AcquireReaderLock(CommonTimeout.LockWait);

                // Each blotter can have a stylesheet assigned to it so Fixed Income traders view Fixed Income data,
                // equity traders Equity data, and so forth.  If no blotter is assigned, a default will be provided.
                ClientMarketData.BlotterRow blotterRow = ClientMarketData.Blotter.FindByBlotterId(this.blotter.BlotterId);
                if (blotterRow == null)
                {
                    throw new ArgumentException("This blotter has been deleted", this.blotter.BlotterId.ToString());
                }

                // If a viewer is avaiable for the objects associated with the blotter, then we'll enable the viewers for those
                // objects.  For example, debt blotters don't require destinationOrder viewers, so there won't be one associated
                // with that blotter.
                this.hasDestinationOrderViewer = !blotterRow.IsDestinationOrderStylesheetIdNull();
                this.hasExecutionViewer        = !blotterRow.IsExecutionStylesheetIdNull();
                this.hasSourceOrderViewer      = !blotterRow.IsSourceOrderStylesheetIdNull();
            }
            catch (Exception exception)
            {
                // Write the error out to the debug listener
                EventLog.Error("{0}, {1}", exception.Message, exception.StackTrace);
            }
            finally
            {
                // Release the tables.
                if (ClientMarketData.BlotterLock.IsReaderLockHeld)
                {
                    ClientMarketData.BlotterLock.ReleaseReaderLock();
                }
                if (ClientMarketData.StylesheetLock.IsReaderLockHeld)
                {
                    ClientMarketData.StylesheetLock.ReleaseReaderLock();
                }
                System.Diagnostics.Debug.Assert(!ClientMarketData.IsLocked);
            }

            if (this.hasExecutionViewer)
            {
                this.executionViewer.Open(this.Tag);
            }
        }
Exemplo n.º 2
0
 public Blotter(int objectId) : base(objectId)
 {
     // Initialize the object
     ClientMarketData.BlotterRow blotterRow = ClientMarketData.Blotter.FindByBlotterId(objectId);
     if (!(this.IsWorkingOrderStylesheetIdNull = blotterRow.IsWorkingOrderStylesheetIdNull()))
     {
         this.WorkingOrderStylesheetId = blotterRow.WorkingOrderStylesheetId;
     }
     if (!(this.IsDestinationOrderStylesheetIdNull = blotterRow.IsDestinationOrderStylesheetIdNull()))
     {
         this.DestinationOrderStylesheetId = blotterRow.DestinationOrderStylesheetId;
     }
     if (!(this.IsMatchesStylesheetIdNull = blotterRow.IsMatchStylesheetIdNull()))
     {
         this.MatchesStylesheetId = blotterRow.MatchStylesheetId;
     }
     if (!(this.IsAdvertisementStylesheetIdNull = blotterRow.IsAdvertisementStylesheetIdNull()))
     {
         this.AdvertisementStylesheetId = blotterRow.AdvertisementStylesheetId;
     }
 }