Example #1
0
        /// <summary>
        /// Handles the Closing of the Popup form.
        /// By default this saves the Business Object that is currently selectedin the Popup  (if there is one)
        /// Reloads the Combo Box using <see cref="ReloadLookupValues"/>.
        /// and Sets the Currently selected Business Object as the selected Item for the ComboBox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void HandlePopUpFormClosedEvent(object sender, EventArgs e)
        {
            IBOGridAndEditorControl iboGridAndEditorControl = GetIBOGridAndEditorControl();
            IBusinessObject         currentBusinessObject   = iboGridAndEditorControl.CurrentBusinessObject;

            if ((currentBusinessObject != null) && currentBusinessObject.Status.IsValid())
            {
                currentBusinessObject.Save();
            }
            ReloadLookupValues();
            if (currentBusinessObject != null)
            {
                ExtendedComboBox.ComboBox.SelectedValue = currentBusinessObject.ID.GetAsValue().ToString();
            }
        }
Example #2
0
        ///<summary>
        /// Shows the popup form that is displayed when the button is clicked.
        /// This popup form is used to edit the <see cref="BusinessObject"/>s that fill the combobox.
        ///</summary>
        public virtual void ShowPopupForm()
        {
            Type classType;

            CheckBoNotNull();
            IClassDef lookupTypeClassDef = GetLookupTypeClassDef(out classType);

            PopupForm        = ControlFactory.CreateForm();
            PopupForm.Height = 600;
            PopupForm.Width  = 800;

            _iboGridAndEditorControl = this.ControlFactory.CreateGridAndBOEditorControl
                                           (lookupTypeClassDef);
            _iboGridAndEditorControl.Dock = DockStyle.Fill;
            PopupForm.Controls.Add(_iboGridAndEditorControl);
            IBusinessObjectCollection col = GetCollection(classType);

            _iboGridAndEditorControl.BusinessObjectCollection = col;
        }
Example #3
0
        public void Test_ShowGridAndBOEditorControlWinWithSuperClassDef()
        {
            //--------------- Set up test pack ------------------
            ClassDef.ClassDefs.Clear();
            PersonTestBO.LoadDefaultClassDefWithTestOrganisationBOLookup();
            ContactPersonTestBO.LoadDefaultClassDefWithPersonTestBOSuperClass();
            BusinessObjectCollection <OrganisationTestBO> organisationTestBOS = CreateSavedOrganisationTestBOSCollection();


            IControlFactory        controlFactory   = GetControlFactory();
            IExtendedComboBox      extendedComboBox = CreateExtendedComboBox();
            const string           propName         = "OrganisationID";
            ExtendedComboBoxMapper mapper           = new ExtendedComboBoxMapper(
                extendedComboBox, propName, true, controlFactory);

            mapper.BusinessObject = new ContactPersonTestBO();
            // mapper.RelatedBusinessObject = OrganisationTestBO.CreateSavedOrganisation();
            //--------------- Test Preconditions ----------------
            Assert.IsNull(mapper.PopupForm);
            //--------------- Execute Test ----------------------
            //extendedComboBox.Button.PerformClick();
            mapper.ShowPopupForm();
            //--------------- Test Result -----------------------
            Assert.IsNotNull(mapper.PopupForm);
            IFormHabanero form = mapper.PopupForm;

            Assert.AreEqual(800, form.Width);
            Assert.AreEqual(600, form.Height);
            Assert.AreEqual(1, form.Controls.Count);
            Assert.AreEqual(DockStyle.Fill, form.Controls[0].Dock);

            Assert.IsInstanceOf(typeof(IBOGridAndEditorControl), form.Controls[0]);
            IBOGridAndEditorControl andBOGridAndEditorControlWin = (IBOGridAndEditorControl)form.Controls[0];

            //Assert.AreSame(mapper.BusinessObject, BOGridAndEditorControlWin.BOEditorControlWin.BusinessObject);
            Assert.IsTrue(andBOGridAndEditorControlWin.GridControl.IsInitialised);
            IBusinessObjectCollection collection = andBOGridAndEditorControlWin.GridControl.Grid.BusinessObjectCollection;

            Assert.IsNotNull(collection);
            Assert.AreEqual(organisationTestBOS.Count, collection.Count);
            Assert.AreEqual(organisationTestBOS.Count, mapper.LookupList.Count);
        }
        ///<summary>
        /// Shows the popup form that is displayed when the button is clicked.
        /// This popup form is used to edit the <see cref="BusinessObject"/>s that fill the combobox.
        ///</summary>
        public virtual void ShowPopupForm()
        {
            Type classType;
            CheckBoNotNull();
            IClassDef lookupTypeClassDef = GetLookupTypeClassDef(out classType);
            PopupForm = ControlFactory.CreateForm();
            PopupForm.Height = 600;
            PopupForm.Width = 800;

            _iboGridAndEditorControl = this.ControlFactory.CreateGridAndBOEditorControl
                (lookupTypeClassDef);
            _iboGridAndEditorControl.Dock = DockStyle.Fill;
            PopupForm.Controls.Add(_iboGridAndEditorControl);
            IBusinessObjectCollection col = GetCollection(classType);
            _iboGridAndEditorControl.BusinessObjectCollection = col;
        }