private void AddBOPanel(IBusinessObject businessObject)
        {
            IPanel panel = _controlFactory.CreatePanel();

            panel.Name = businessObject.ID.ObjectID.ToString();
            ICollapsiblePanel control = this.AddControl(panel, businessObject.ToString(), 100);

            control.Name = businessObject.ID.ObjectID.ToString();
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a ListViewItem from the business object provided.  This
        /// method is used by SetListViewCollection() to populate the ListView.
        /// </summary>
        /// <param name="bo">The business object to represent</param>
        /// <returns>Returns a new ListViewItem</returns>
        private ListViewItem CreateListViewItem(IBusinessObject bo)
        {
            var listViewItem = new ListViewItem(bo.ToString())
            {
                Tag = bo
            };

            _listItemsHash.Add(bo, listViewItem);
            return(listViewItem);
        }
 private void CheckBusinessObjectCorrectType(IBusinessObject value)
 {
     if (value != null && !this.ClassDef.ClassType.IsInstanceOfType(value))
     {
         string errorMessage = string.Format
                                   ("You cannot set the Business Object to the '{0}' identified as '{1}' "
                                   + "since it is not of the appropriate type ('{2}') for this '{3}'", value.ClassDef.ClassNameFull,
                                   value.ToString(), this.ClassDef.ClassNameFull, this.GetType().FullName);
         throw new HabaneroDeveloperException(errorMessage, errorMessage);
     }
 }
        protected virtual string GetTitleText(IBusinessObject businessObject)
        {
            ArgumentUtility.CheckNotNull("businessObject", businessObject);

            if (businessObject is IBusinessObjectWithIdentity)
            {
                return(((IBusinessObjectWithIdentity)businessObject).GetAccessibleDisplayName());
            }
            else
            {
                return(businessObject.ToString());
            }
        }
Esempio n. 5
0
        public CloseBOEditorDialogResult ShowDialog(IBusinessObject businessObject)
        {
            if (businessObject == null)
            {
                BOEditorDialogResult = CloseBOEditorDialogResult.CloseWithoutSaving;
                this.Close();
                return(BOEditorDialogResult);
            }


            var isInValidState = businessObject.Status.IsValid();
            var isDirty        = businessObject.Status.IsDirty;

            SaveAndCloseBtn.Enabled   = isInValidState;
            this.BOEditorDialogResult = CloseBOEditorDialogResult.CancelClose;


            if (!isDirty)
            {
                this.BOEditorDialogResult = CloseBOEditorDialogResult.CloseWithoutSaving;
                this.Close();
                return(this.BOEditorDialogResult);
            }
            string isValidString;

            if (isInValidState)
            {
                isValidString = " and is in a valid state to be saved";
            }

            else
            {
                string isValidMessage = businessObject.Status.IsValidMessage;

                isValidString = " and is not in a valid state to be saved: " + Environment.NewLine +
                                isValidMessage + Environment.NewLine;
            }
            var fullDisplayName = businessObject.ClassDef.DisplayName
                                  + " '" + businessObject.ToString() + "'";

            _label.Text = "The " + fullDisplayName + " is has been edited" + isValidString +
                          ". Please choose the appropriate action";
            this.SaveAndCloseBtn.Enabled = isInValidState;
            ShowForm();
            return(this.BOEditorDialogResult);
        }
        public CloseBOEditorDialogResult ShowDialog(IBusinessObject businessObject)
        {
            if (businessObject == null)
            {
                BOEditorDialogResult = CloseBOEditorDialogResult.CloseWithoutSaving;
                this.Close();
                return BOEditorDialogResult;
            }


            var isInValidState = businessObject.Status.IsValid();
            var isDirty = businessObject.Status.IsDirty;
            SaveAndCloseBtn.Enabled = isInValidState;
            this.BOEditorDialogResult = CloseBOEditorDialogResult.CancelClose;


            if (!isDirty)
            {
                this.BOEditorDialogResult = CloseBOEditorDialogResult.CloseWithoutSaving;
                this.Close();
                return this.BOEditorDialogResult;
            }
            string isValidString;
            if (isInValidState)
            {
                isValidString = " and is in a valid state to be saved";
            }

            else
            {
                string isValidMessage = businessObject.Status.IsValidMessage;

                isValidString = " and is not in a valid state to be saved: " + Environment.NewLine +
                                isValidMessage + Environment.NewLine;
            }
            var fullDisplayName = businessObject.ClassDef.DisplayName
                    + " '" + businessObject.ToString() + "'";
            _label.Text = "The " + fullDisplayName + " is has been edited" + isValidString +
                          ". Please choose the appropriate action";
            this.SaveAndCloseBtn.Enabled = isInValidState;
            ShowForm();
            return this.BOEditorDialogResult;
        }
        public void TestSortingCollection_PropOnlySpecified()
        {
            //---------------Set up test pack-------------------
            BusinessObjectLookupList businessObjectLookupList =
                GetBusinessObjectLookupListForContactPerson("surname");
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Dictionary <string, string> col = businessObjectLookupList.GetLookupList(DatabaseConnection.CurrentConnection);
            //---------------Test Result -----------------------
            ArrayList items = new ArrayList(col.Values);

            Assert.AreEqual(3, col.Count);
            object          item           = items[0];
            IBusinessObject businessObject = BORegistry.DataAccessor.BusinessObjectLoader.GetBusinessObjectByValue(typeof(ContactPersonTestBO), item);

            Assert.AreEqual("abc", businessObject.ToString());
            AssertCorrectlySortedBusinessObjectInList(items, 0, "abc");
            AssertCorrectlySortedBusinessObjectInList(items, 1, "abcd");
            AssertCorrectlySortedBusinessObjectInList(items, 2, "zzz");
        }
 private void RemoveNode(IBusinessObject businessObject, ITreeNode node)
 {
     try
     {
         node.Remove();
     }
     catch (System.ObjectDisposedException ex)
     {
         log.Debug
             ("RemoveNode : cannot remove node for Business Object : " + businessObject.ToString()
             + Environment.NewLine + " Error :" + ex.Message);
     }
     finally
     {
         try
         {
             ObjectNodes.Remove(businessObject);
         }
         finally
         {
             UnRegisterForBusinessObjectEvents(businessObject);
         }
     }
 }
Esempio n. 9
0
 protected override void OnClick()
 {
     base.OnClick();
     System.Diagnostics.Debug.WriteLine("Clicked menu item '" + ItemID + "' for BusinessObject '" + _businessObject.ToString() + "'.");
     // handle the click
     base.OwnerControl.LoadValue(true);
 }
 private void AddBOPanel(IBusinessObject businessObject)
 {
     IPanel panel = _controlFactory.CreatePanel();
     panel.Name = businessObject.ID.ObjectID.ToString();
     ICollapsiblePanel control = this.AddControl(panel, businessObject.ToString(), 100);
     control.Name = businessObject.ID.ObjectID.ToString();
 }
 private void RemoveNode(IBusinessObject businessObject, ITreeNode node)
 {
     try
     {
         node.Remove();
     }
     catch (System.ObjectDisposedException ex)
     {
         log.Debug
             ("RemoveNode : cannot remove node for Business Object : " + businessObject.ToString()
              + Environment.NewLine + " Error :" + ex.Message);
     }
     finally
     {
         try
         {
             ObjectNodes.Remove(businessObject);
         }
         finally
         {
             UnRegisterForBusinessObjectEvents(businessObject);
         }
     }
 }
Esempio n. 12
0
        private void AddTabPage(IBusinessObject bo)
        {
            ITabPage page = _controlFactory.CreateTabPage(bo.ToString());

            AddTabPage(page, bo);
        }
 private void AddTabPage(IBusinessObject bo)
 {
     ITabPage page = _controlFactory.CreateTabPage(bo.ToString());
     AddTabPage(page, bo);
 }
 private void CheckBusinessObjectCorrectType(IBusinessObject value)
 {
     if (value != null && !this.ClassDef.ClassType.IsInstanceOfType(value))
     {
         string errorMessage = string.Format
             ("You cannot set the Business Object to the '{0}' identified as '{1}' "
              + "since it is not of the appropriate type ('{2}') for this '{3}'", value.ClassDef.ClassNameFull,
              value.ToString(), this.ClassDef.ClassNameFull, this.GetType().FullName);
         throw new HabaneroDeveloperException(errorMessage, errorMessage);
     }
 }
 /// <summary>
 /// Creates a ListViewItem from the business object provided.  This
 /// method is used by SetListViewCollection() to populate the ListView.
 /// </summary>
 /// <param name="bo">The business object to represent</param>
 /// <returns>Returns a new ListViewItem</returns>
 private ListViewItem CreateListViewItem(IBusinessObject bo)
 {
     var listViewItem = new ListViewItem(bo.ToString()) {Tag = bo};
     _listItemsHash.Add(bo, listViewItem);
     return listViewItem;
 }
 private string FormatEventMessage(string eventName, int index, IBusinessObject businessObject)
 {
     return(string.Format("{0}: {1}, {2}", eventName, index, businessObject.ToString()));
 }