2 issues with the browse-dialog


Author
Message
Philipp Guntermann
Philipp Guntermann
StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)
Group: Forum Members
Posts: 141, Visits: 263
hi,

i got two issues with the browse dialog:

1) how do i set it up, so that instead of populating the business object with the selected search result, it would only navigate to the selected search result instead ?

2) the waitwindow message appearing while it performs the search is not localized. (appears in english)

thanks.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
how do i set it up, so that instead of populating the business object with the selected search result, it would only navigate to the selected search result instead ?

I am not sure that I follow you on this.  It actually does navigate to the selected record.  If you are wanting to update a BO other than the BusinessObjectToPopulate, then create a second BO on the for and set that to the BusinessObjectToPopulate, then in the BrowseDialogClosing (or where ever meets your needs) navigate the record on the other BO to which you are wanting to update.

2) the waitwindow message appearing while it performs the search is not localized. (appears in english)

Hmmm...OK, thanks.  I will look into this.

Philipp Guntermann
Philipp Guntermann
StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)
Group: Forum Members
Posts: 141, Visits: 263
Trent L. Taylor (03/10/2009)

I am not sure that I follow you on this.  It actually does navigate to the selected record.

It fills the BO with the selected record, and then navigates there too. instead it should: leave the BO as it is (keep all records as they are) and ONLY navigate to the selected record. dont re-populate.

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
It fills the BO with the selected record, and then navigates there too. instead it should: leave the BO as it is (keep all records as they are) and ONLY navigate to the selected record. dont re-populate.

Well, this can only be accomplished if you have all records already populated in the form's BO, otherwise, you run the risk of selecting a record that is not populated in it yet. Anyway, I guess that if you follow what Trent told you, you can still do it. Create a second BO, populate it through the BD, once you get out of the BD, get the primary key of the select record and navigate the form's BO to it. You can even add the selected record to the form's BO with a bit of coding, if it is not there yet.

Philipp Guntermann
Philipp Guntermann
StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)
Group: Forum Members
Posts: 141, Visits: 263
Ivan George Borges (03/10/2009)
It fills the BO with the selected record, and then navigates there too. instead it should: leave the BO as it is (keep all records as they are) and ONLY navigate to the selected record. dont re-populate.

Well, this can only be accomplished if you have all records already populated in the form's BO, otherwise, you run the risk of selecting a record that is not populated in it yet. Anyway, I guess that if you follow what Trent told you, you can still do it. Create a second BO, populate it through the BD, once you get out of the BD, get the primary key of the select record and navigate the form's BO to it. You can even add the selected record to the form's BO with a bit of coding, if it is not there yet.

yes. i have the forms bo filled with all records. i was hoping i could use the browse-dialog to enable a search within theese and then have the bo being navigated to the selected record without having to create another bo. imo that is not an optimal solution. maybe i'll just relable the search button to "filter" or something, but i think the browsedialog should have a property of the selected pk that could be accessed directly / without having to create another bo.

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
imo that is not an optimal solution.

OK, I guess we will just have to agree to disagree then! Wink

Since the BD is designed to search the database table, and not the BO, creating a second BO, just for the sake of the BD, wouldn't do any harm. And it would accomplish exactly what you are looking for.

Just my 0.02 ... which in "reais" are even cheaper! BigGrin

Philipp Guntermann
Philipp Guntermann
StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)
Group: Forum Members
Posts: 141, Visits: 263
i just think it could be a small addition to the browsedialog. and i think many people use it like that (have a form with a populated bo and then use browsedialog to enable a search).

it would turn this code:

private void btnSearch_Click(object sender, EventArgs e)
{
        Business_Objekte.Basis.KundenBO ErgebnisBO = new Business_Objekte.Basis.KundenBO();
        KVbrowseDialog.BusinessObjectToPopulate = ErgebnisBO;

        if (KVbrowseDialog.ShowDialog() == DialogResult.OK && ErgebnisBO.Count > 0)
           this.KVkundenBO.NavigateToPrimaryKey(ErgebnisBO.ID);
        ErgebnisBO.Dispose();
}

into this much cleaner code:

private void btnSearch_Click(object sender, EventArgs e)
{
        if (KVbrowseDialog.ShowDialog() == DialogResult.OK && kvbrowseDialog.SelectedRowPK > 0)
         this.KVkundenBO.NavigateToPrimaryKey(kvbrowseDialog.SelectedRowPK);
}


Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Philipp,



What you appear to want seems to be a bit more complicated than just getting the PK of the selected record. As Ivan said, the BD is going to query the database. That is what is designed for. However, since you have already pulled all the records over, this isn't really that efficient. It seems to me that what you want to do is to find the record within the existing set of data you've already pull over.



Now, to use the BD to do this could get complicated. You'd have to build a filter based on the search criterion in order to display the correct records, then return the selected record's PK so you could navigate to it in your BO. This might be possible by handling the various events, but I'm not real confident that it could even be done.



You might find it easier to just roll your own browse dialog, that simply looks up records within your prepopulated BO.
Philipp Guntermann
Philipp Guntermann
StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)StrataFrame User (231 reputation)
Group: Forum Members
Posts: 141, Visits: 263
Hi Greg,

the first codesnippet in my post above actually does exactly what i want. i was just hoping for a cleaner way to do it, without the requirement to instanciate a temporary bo.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Yeah, I understand. I was just trying to point out that what you are doing is kind of running against the grain of how the BD works. This may work great in your situation, but it wouldn't work well in many others. I know I'm constantly attempting to reduce the trips to the database, reduce the amount of data returned, increase the efficiency of the queries I run because these all slow down the app. Thus, I wouldn't want to requery the database to get data I already had, which is what you are doing (you have a BO that already contains all the records, then you use to BD to query the database and get some subset of those records again). However, it may work fine for you, which is great.



Also, I don't think your suggested code would work because you still need to set a BO to populate that isn't your primary BO (otherwise it will reload that BO and you'll loose all the records not found). You might try to just sub-class the browse dialog, adding the desired functionality. You might add a generic method to replace the ShowDialog method that accepts the source BO and then does everything you need:



public class NavBrowseDialog : BrowseDialog

{

  // Shows the browse dialog, populates a local BO (so the source BO

  // remains unchanged) and then navigates the source BO to the

  // selected record in the browse dialog.

  // Params:

  // boToNav:= source bo

  public DialogResult ShowDialogAndNav<T>(BusinessLayer boToNav) where T: BusinessLayer, new()

  {

    T localBoToPopulate = new T;

    this.BusinessObjectToPopulate = localBoToPopulate;

    if (this.ShowDialog() == DialogResult.OK && localBoToPopulate.Count > 0)

    {

      boToNav.NavigateToPrimaryKey(localBoToPopulate.Items[localBoToPopulate.PrimaryKey]);

    }

  }

}




I'm not sure that the generic is strictly needed, but I think you do, so your local BO is of the correct type.



Now your code would be:



private void btnSearch_Click(object sender, EventArgs e)

{

  KVbrowseDialog.MyShowDialog<Business_Objekte.Basis.KundenBO>();

}

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