Control order of BO in _BusinessObjects collection


Author
Message
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Hi,

While waiting for response of one to one relationship thread, I tried to use IncludeInFormAdd, IncludeInFormDelete and etc property to achieve my goal (but I still hope someone can help on my previous posted issue). At first it works fine. But don't know why it just not working now.



I have the BO setting as below. After some debugging, I found that, BaseForm call child BO CompanyAddress.Add() before parent BO CompaniesBO.Add(). Even I set InitializationPriority.



Anyway ideas?



My topmost level BO - CompaniesBO is using PrimaryKeyIsAutoIncremented = true. My child BOs - CompanyAddress and CompanyContacts PK is composite key. Therefore, I set both PrimaryKeyIsAutoIncremented = false.



CompanyAddressBO - CompanyID, AddressTypeID

CompanyContactsBO - CompanyID, ContactTypeID



When I click on new button, I would get error



BusinessLayerException

   An error occurred while retrieving the primary key from the parent business object.

BusinessLayerException

   The CurrentRow could not be evaluated because the CurrentRowIndex is out of range. Business object record count: 0. CurrentRowIndex: -1.



Replies
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Forgot to upload DDT package. Here it is.
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
In case you need this.



Sorry for any inconvinience
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
I cannot get your SQL backup to restore and I cannot use the PKG file because it is password protected.  Either send me the JKInventory.MDF file or give me the password to the PKG file...or give me a PKG file without a password.  Thanks.
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Sorry for that.



PKG is no password.

Attach JKInventory.MDF



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Please check out CompanyMaintenance form. It demonstrates IncludeInFormAdd issue. Run "Company" from Mainform.toolbar and click new button.

You had the IncludeInFormAdd property set to True on the Companies,Addresses, and Contacts.  You also had the Addresses and contacts ParentBusinessObject property set to companies.  In this instance the instantiation order is not controlled and you cannot control which Add() will occur first.  The InitializationPriority property is NOT respected here.  In your situation, let the Companies Add() be fired through the MaintenanceFormToolstrip.  In the AfterAddNew of the Coanies, add a new record to Addresses and Contacts.

Please check out CompanyMaintenance2 form. It demonstrates problem of drop childformdialog on user control. Run "Company2" from Mainform.toolbar and click "Country" linklabel directly.

All you have to do is set the ParentForm property of the ChildFormDialog.

this.CountryAddFormDialog.ParentForm = (MicroFour.StrataFrame.UI.Windows.Forms.BaseForm)this.ParentForm;
            if (this.CountryAddFormDialog.ShowDialog() == DialogResult.OK)
            {
                this.cboCountry.SelectedValue = this.countriesBO.CountryID;
            }

So I was right whe I said that you could drop the ChildFormDialog control on the user control.  You just have to set the ParentForm property.

Attached is your corrected project.

Attachments
FixedInventory.zip (116 views, 1.00 MB)
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Thank you for checking.



Any ideas for the issue below?



JKFramework

------------

1. Try to drop linklabel/label control from JK.Framework.UI.Windows.Forms to SF form. VS will die.

Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
hi,

I tried the "fixedInventory". FYI, it doesn't work. It still hit error unless I add these code as mentioned in other thread.



this._CompaniesBO.ChildAutoFilterOption = AutoChildFilterOptions.Off;

this._CompanyAddressBO.Filter = "";

this._CompanyContactsBO.Filter = "";





Any ideas? When should I restore the ChildAutoFilterOption, Undo/AfterSave event?



Beside, when I click new button, business rules for CompanyAddressBO and CompanyContactsBO will broken. Error providers show little icon beside my controls to complaint for blank value. How to omit this?



Thank you
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
To turn off the business rules checking when adding a new row, you can set the CheckCurrentRowBeforeNavigate method to False.  This will prevent the business object from checking the business rules on the current row before adding a new row. 

Yes, the AfterUndo or AfterSave event is your best place to put the restoring of the ChildAutoFilterOption.  If the Save() or Undo() is cancelled, then those events will not be fired.

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Give me a few minutes to check on the link label killing VS.
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Give me a few minutes to check on the link label killing VS.




May I know any status for this? Without this solved, I got to write keep duplicate my code. Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
We could not reproduce this.  I could not even reproduce this with your source code that you sent me the other day.
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Are you dropping JK.Framework.UI.Windows.Forms.LinkLabel on to form?



Can any other SF users try this out?



Thank you
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Are you using WinXP SP2?

I tried to create an user control in the same project with my linklabel subclass. VS prompted error, and mentioned it is WinXP SP2 problem.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
I am running WinXP SP2 and not having any trouble.  Chan, create me another solution that has nothing in it but a subclassed LinkLabel and a form with it dropped on.  This should prove two things, one, it may have something to do with you other solution, and two, if you can reproduce it in a second solution then it is hard and I should be able to reproduce it on this side using your sample.
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Here is the project, which have problem mentioned.



If you still unable to reproduce it, I can arrange to let you to remotely access my laptop.



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
OK...this definitely failed and I was able to reproduce it.  I see several things wrong with the solution, but I do not think this is the problem.  I will look into it some more and get back with you.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
OK...here is the problem.  It is the designer attribute of the StrataFrame LinkLabel.  There is a designer that allows the localization of the control to be set through a form designer.  This designer is in the Extensibility assembly which you are not allowed to distribute.

To get around this problem, just overwrite the designer attribute on your inherited control.  This way you get all of the benefits of the inheritance, you just will not have access to the form designer, which is really no big deal.

Second, your application is not using a StrataFrame application.  This is going to cause all kinds of problems.  When you create a StrataFrame application, use the StrataFrame Application template.

Attached is a sample that has a working inherited LinkLabel and a StrataFrame application.

Finally, note that the System.Design reference must be added in order to access the ControlDesigner attribute.

Attachments
LinkLabelSample.zip (104 views, 44.00 KB)
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I managed to do New/Undo/Save in my CompanyMaintenance form. Thank you for your help.



Now, I got another problem. I have my CompaniesBO set ChildAutoFilterOptions = MatchCurrentRow. When I launch my form, I click browse button, search and select record. My ChildBO (CompanyAddressBO and CompanyContactsBO) doesn't auto requery.



Any ideas? Do I need to requery manually?
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, you will need to manually requery.  The ChildAutoFilterOption only cascades the row filter to the child business objects and the row filter only affects the records already in the business object.  The CurrentDataTableRefilled event fires on the business object when the business object is repopulated with the results of the browse dialog.  So, you can handle the CurrentDataTable filled event of the parent business object and call child.FillByParent(parent) on each of the child business objects.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Chan - 18 Years Ago
Trent L. Taylor - 18 Years Ago
Chan - 18 Years Ago
                 Hi,
Forgot to upload DDT package. Here it is.
Chan - 18 Years Ago
                     In case you need this.

Sorry for any inconvinience
Chan - 18 Years Ago
                         I cannot get your SQL backup to restore and I cannot use the PKG file...
Trent L. Taylor - 18 Years Ago
                             Sorry for that.

PKG is no password.
Attach...
Chan - 18 Years Ago
                                 [quote]Please check out CompanyMaintenance form. It demonstrates...
Trent L. Taylor - 18 Years Ago
                                     Hi,
Thank you for checking.

Any ideas for the issue...
Chan - 18 Years Ago
                                     hi,
I tried the "fixedInventory". FYI, it doesn't work. It still...
Chan - 18 Years Ago
                                         To turn off the business rules checking when adding a new row, you can...
StrataFrame Team - 18 Years Ago
                                             Give me a few minutes to check on the link label killing VS.
StrataFrame Team - 18 Years Ago
                                                 Hi,
[quote]Give me a few minutes to check on the link label...
Chan - 18 Years Ago
                                                     We could not reproduce this. I could not even reproduce this with your...
Trent L. Taylor - 18 Years Ago
                                                         Hi,
Are you dropping JK.Framework.UI.Windows.Forms.LinkLabel on...
Chan - 18 Years Ago
                                                         Hi,
Are you using WinXP SP2?
I tried to create an user...
Chan - 18 Years Ago
                                                             I am running WinXP SP2 and not having any trouble. Chan, create me...
Trent L. Taylor - 18 Years Ago
                                                                 Hi,
Here is the project, which have problem mentioned.
...
Chan - 18 Years Ago
                                                                     OK...this definitely failed and I was able to reproduce it. I see...
Trent L. Taylor - 18 Years Ago
                                                                         OK...here is the problem. It is the designer attribute of the...
Trent L. Taylor - 18 Years Ago
                                             Hi,
I managed to do New/Undo/Save in my CompanyMaintenance form....
Chan - 18 Years Ago
                                                 Yes, you will need to manually requery. The ChildAutoFilterOption only...
StrataFrame Team - 18 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search