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.
|