Where to locate BO instances?


Author
Message
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
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?
Replies
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
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;

}

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
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.
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
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?
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
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. 


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search