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; } }
/// <summary> /// Opens the Blotter Document. /// </summary> /// <param name="blotterId">The blotter identifier.</param> protected override void OpenCommand() { try { // Lock the tables. System.Diagnostics.Debug.Assert(!ClientMarketData.IsLocked); ClientMarketData.BlotterLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.MatchLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.ObjectLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.StylesheetLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.WorkingOrderLock.AcquireReaderLock(CommonTimeout.LockWait); if (this.Tag is BlotterMatchDetail) { this.blotter = ((BlotterMatchDetail)this.Tag).Blotter; } if (this.Tag is Blotter) { this.blotter = (Blotter)this.Tag; } // 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.hasAdvertisementViewer = !blotterRow.IsAdvertisementStylesheetIdNull(); this.hasDestinationOrderViewer = !blotterRow.IsDestinationOrderStylesheetIdNull(); this.hasExecutionViewer = !blotterRow.IsExecutionStylesheetIdNull(); this.hasMatchViewer = !blotterRow.IsMatchStylesheetIdNull(); this.hasMatchHistoryViewer = !blotterRow.IsMatchHistoryStylesheetIdNull(); this.hasSourceOrderViewer = !blotterRow.IsSourceOrderStylesheetIdNull(); this.hasWorkingOrderViewer = !blotterRow.IsWorkingOrderStylesheetIdNull(); } 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.MatchLock.IsReaderLockHeld) { ClientMarketData.MatchLock.ReleaseReaderLock(); } if (ClientMarketData.ObjectLock.IsReaderLockHeld) { ClientMarketData.ObjectLock.ReleaseReaderLock(); } if (ClientMarketData.StylesheetLock.IsReaderLockHeld) { ClientMarketData.StylesheetLock.ReleaseReaderLock(); } if (ClientMarketData.WorkingOrderLock.IsReaderLockHeld) { ClientMarketData.WorkingOrderLock.ReleaseReaderLock(); } System.Diagnostics.Debug.Assert(!ClientMarketData.IsLocked); } BeginInvoke(new EventHandler(OpenChildren)); }