2 issues with the browse-dialog


Author
Message
Philipp Guntermann
Philipp Guntermann
StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 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.

Replies
Philipp Guntermann
Philipp Guntermann
StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 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 (4.8K 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 (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 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 (4.8K 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>();

}

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
This is most likely not going to hapen within this release, Philipp as it doesn't fall in line with the current design.  This is why we added the ReturnSeelctedRowOnly property to accomodate such needs.  Greg's commentary is good, but in any case, I hope this at least gives you an answer so you can move forward.  It was a good idea, but at the moment it is most likley not going to make it into the build.  We will keep it on the table for a later date.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Philipp Guntermann - 16 Years Ago
Trent L. Taylor - 16 Years Ago
Philipp Guntermann - 16 Years Ago
Ivan George Borges - 16 Years Ago
Philipp Guntermann - 16 Years Ago
                         [quote]imo that is not an optimal solution.[/quote] OK, I guess we...
Ivan George Borges - 16 Years Ago
                             i just think it could be a small addition to the browsedialog. and i...
Philipp Guntermann - 16 Years Ago
                                 Philipp,

What you appear to want seems to be a bit more...
Greg McGuffey - 16 Years Ago
                                     Hi Greg, the first codesnippet in my post above actually does exactly...
Philipp Guntermann - 16 Years Ago
                                         Yeah, I understand. I was just trying to point out that what you are...
Greg McGuffey - 16 Years Ago
                                             This is most likely not going to hapen within this release,Philipp as...
Trent L. Taylor - 16 Years Ago
Philipp Guntermann - 16 Years Ago
             Not yet.
Trent L. Taylor - 16 Years Ago
hector - 14 Years Ago
Ivan George Borges - 14 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search