StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Where to locate BO instances?Expand / Collapse
Author
Message
Posted 03/09/2006 6:33:50 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
Here's a question. The tutorials demonstrate dragging BOs onto forms and raise the suggestion that one might open other forms, e.g. a maintenance form, toi work on a record that is the current row in a BO on a search form. But - there is no example that demonstrates your preferred (or envisioned) method of linking the 2nd form to a BO. Do you put a separate one on the 2nd form and use a copydata function? Do you pass a reference to the BO on the first form? Does the DataLayer take care of this automatically somehow?

My inclination would be to create all of the BOs in some root form and then pass references to those BOs to each subordinate form as I create or activate them. Is this an acceptable/desireable approach?

What would you recommend?
Post #609
Posted 03/10/2006 5:22:07 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 4:58:13 AM
Posts: 4,379, Visits: 4,421

Daniel,

Sorry for the delayed response.  I literally just walkted in the door from Little Rock which is about 650 miles from here.  There was a .NET Users conference that I was at.  To answer your question, there is actually a sample that comes with the framework.  It is a C# example, which is what you use if I remember correctly.  To get to the sample, click on the Start -> Programs -> MicroFour StrataFrame -> CSharp Samples -> CSharp -> Child Form Dialog.

This is actually what the ChildFormDialog control does for you.  It translates an instance of a business object on one form to an separate instance on another form.  This is a very nice feature and makes it really easy to reference a single instance across multiple forms.

However, you can use some of the approaches you mentioned as well.  Depending upon your circumstances, you may want to pass the reference to the child form.  If you use the ChildFormDialog control, you don't have to worry about the translation.  What is really nice is that you program the child form (including the references in code) to the BO instance that is dropped on that form.  When you call the child form through the CHildFormDialog control, it will automatically manage the delegates, code references, and anything that touches the BO instance on the child form for you automatically.  So this is my recommended route.  But if this does not answer your question, please let me know.

Post #610
Posted 03/10/2006 7:03:18 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
I will give it a try.

Also, I'm having some trouble getting a listview to populate manually after invoking a fill method. IfI use FillTop100Affinity as the formLoad type of population, the list populates. If I do something like below, it does not.

private void buttonSearch_Click(object sender, EventArgs e)
{
if (_Mode == EntitySelectMode.PROGRAM)
{
_Entity.FillOneFromEnrolledProgram(textMRN.Text, _ProgramName);
}
else
{
_Entity.FillTop100Affinity();
//_Entity.FillFromAffinity(textMRN.Text);
}
}

private void listView1_ListPopulating(MicroFour.StrataFrame.UI.ListPopulatingEventArgs e)
{
e.Parameters[0].Value = _Entity;
e.Parameters[1].Value = MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable;
}
Post #616
Posted 03/10/2006 7:55:52 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 4:58:13 AM
Posts: 4,379, Visits: 4,421
From looking at the ListPopulating event, I assume that your PopulationDataSource settings is using the Entity BO and the method selected is CopyDataFrom(BusinessLayer, FillType).  If so, are you calling the ListView.Requery() method after you fill the business object in the button click.  If you do not call the ListView.Requery() method, it will not populate with the new contents of the business object.  I think this is your problem.  Let me know.
Post #618
Posted 03/11/2006 7:13:21 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
I'm making a bit of headway on this. Are the listviews "bound" to the BO's? When I click on a row in the listview it does not seem to navigate to the corrensponding row in the BO like am used to with other databinging techniques that I have tried.

How do I do it? Is some kind of manual navigate call required?
Post #619
Posted 03/12/2006 11:12:55 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 4:58:13 AM
Posts: 4,379, Visits: 4,421
When populating a listview an internal instance of the BO is dynamically created.  Even if you use the CopyDataFrom method, it is using the internal BO of the listview to populate itself.  To navigate a specific instance of a BO to another record place the following code in the SelectedIndexChanged event of the listview:

If MyListView.SelectedItems.Count > 0
    FormInstanceBO.NavigateToPrimaryKey(CType(MyListView.SelectedItem(0).Tag, Integer))
End If

Obviously you will need to make any necessary changes to match your PK value. 

Post #623
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 9:27am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.094. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.