示例#1
0
        public override bool Equals(object obj)
        {
            if (typeof(MarkThree.Guardian.Object).IsAssignableFrom(obj.GetType()))
            {
                MarkThree.Guardian.Object markThreeObject = (MarkThree.Guardian.Object)obj;
                return(this.ObjectId.Equals(markThreeObject.ObjectId));
            }

            return(this.ObjectId.Equals(obj));
        }
示例#2
0
        /// <summary>
        /// Shows a dialog box for maintaining an object or fund.
        /// </summary>
        /// <param name="objectId">Primary identifier for the object.</param>
        public virtual void Show(MarkThree.Guardian.Object guardianObject)
        {
            try
            {
                // Make sure locks are not nested.
                Debug.Assert(!ClientMarketData.IsLocked);

                // Lock the tables needed for the dialog.
                ClientMarketData.ObjectLock.AcquireReaderLock(CommonTimeout.LockWait);
                ClientMarketData.TypeLock.AcquireReaderLock(CommonTimeout.LockWait);

                // Find the object in the data model.
                ClientMarketData.ObjectRow objectRow = ClientMarketData.Object.FindByObjectId(guardianObject.ObjectId);
                if (objectRow == null)
                {
                    throw new Exception("Some else has deleted this object.");
                }

                // General Tab
                this.textBoxName.Text        = objectRow.Name;
                this.labelTypeText.Text      = objectRow.TypeRow.Description;
                this.textBoxDescription.Text = (objectRow.IsDescriptionNull()) ? string.Empty : objectRow.Description;
                this.pictureBox.Image        = guardianObject.Image32x32;
            }
            finally
            {
                // Release the tables used for the dialog.
                if (ClientMarketData.ObjectLock.IsReaderLockHeld)
                {
                    ClientMarketData.ObjectLock.ReleaseReaderLock();
                }
                if (ClientMarketData.TypeLock.IsReaderLockHeld)
                {
                    ClientMarketData.TypeLock.ReleaseReaderLock();
                }

                // Make sure all locks have been released
                Debug.Assert(!ClientMarketData.IsLocked);
            }

            // Display the dialog.
            ShowDialog();
        }