BO Problem


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
I've got a bo with FillByMrn(), FillBySSN and FillByLastName methods. Regardless of the search strategy, I want to fill the same ListView. Obviously you can't do this solely by using the properties of the ListView since it specs a single fill method. To deal with this I've done the following:



private void buttonMRNSearch_Click(object sender, EventArgs e)

{

try

{

_CurrentMode = SearchMode.MRN;

if (MRN.Text.Length != 7) return;

listView1.PopulationDataSourceSettings.MethodToExecute = "FillByMRN;System.String";

listView1.PopulationDataSourceSettings.ValueMember = "MRN";

listView1.Requery();

//boPatientSearch1.FillByMRN(MRN.Text);

mSearched = true;

}

catch (System.Exception ex)

{

((FormMain)MdiParent).StatusMessage = ex.Message;

}

}



Then, on the ListView i've got:



private void listView1_ListPopulating(MicroFour.StrataFrame.UI.ListPopulatingEventArgs e)

{

MicroFour.StrataFrame.UI.ListPopulatingEventArgs a = (MicroFour.StrataFrame.UI.ListPopulatingEventArgs)e;

switch (_CurrentMode)

{

case SearchMode.LASTFIRST:

a.Parameters[0].Value = LastName.Text;

a.Parameters[1].Value = FirstName.Text;

a.Parameters[2].Value = Gender.Text;

break;

case SearchMode.LASTNAME:

a.Parameters[0].Value = LastName.Text;

a.Parameters[1].Value = Gender.Text;

break;

case SearchMode.MRN:

a.Parameters[0].Value = MRN.Text;

break;

case SearchMode.SSN:

a.Parameters[0].Value = SSN.Text;

break;

}

}



This works BUT there are 2 problems:

1) Even when the ListView is populated with records the bo.CurrentDataTable.Rows.Count = 0

2) The fill method in the bo is never called (i've put breakpoints in the fill methods but they are never reached)



This has me very confused and I don't know how to proceed.
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
1.  The ListView creates its own instance of your business object to populate the list; it doesn't use the object on the page, so bo.CurrentDataTable.Rows.Count will equal 0 until you fill it yourself.  You could always use the CopyDataFrom method on the PopulationDataSourceSettings.  In this case, you would fill the business object on the form, and the ListView would copy the data from that business object into its own business object to populate the list.

2.  The fill methods should be being called.  When you set the breakpoint, does the breakpoint symbol have a warning icon on it?  There are a few reasons that breakpoints might never be reached, but if the list is being populated correctly, then the ListView is definitely executing those methods to gather the data.

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




2. The fill methods should be being called. When you set the breakpoint, does the breakpoint symbol have a warning icon on it?



no



There are a few reasons that breakpoints might never be reached, but if the list is being populated correctly, then the ListView is definitely executing those methods to gather the data.



the listmitems are correct.
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
Well, I don't know what to tell you on the breakpoint not hitting except you might try changing the PopulationDataSourceSettings MethodToExecute to CopyDataFrom and populate the business object that you dropped on the form and use it to copy the data into the business object being used to build the list.
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
Based on what you told me about IsListSource, I put the datagridview back and bound it to the instance of the bo that is on the form. That is working fine.
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
Good to hear.
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