2 issues with the browse-dialog


Author
Message
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Hector.

This hasn't made into the framework yet, but it certainly will.

For the time being, if you would like it to be localized, you could make a small change in the framework, as I have done.

First I created localization keys into my Message & Localization Project.  Then I added code into the BrowseDialogWindow's SetFormTextValues method, as follows:

        ''' <summary>
        ''' Sets all of the forms text values (allows for localized values to be used)
        ''' </summary>
        Private Sub SetFormTextValues()
            '-- Establish Locals
            Dim loCVT As New KeysConverter

            With _BrowseDialog
                Me.lblStatus.Text = String.Format(.EnterSearchCriteraStatusText, "[" & loCVT.ConvertToString(.SearchKey) & "]")
                Me.tsiSearch.Text = .SearchText
                Me.tsiClear.Text = .ClearText
                Me.cmdHideResults.Text = .HideResultsText
                Me.cmdSearchFields.Text = .SearchFieldsText
                Me.tscSearchFields.grpContent.Title = .SearchCriteriaText
                Me.chkAdvanced.Text = .AdvancedOptionsText
                Me.cmdOK.Text = .OKText
                Me.cmdCancel.Text = .CancelText
            End With

            '-- IGB - added on 2011/04/08 - START
            '-- localize missing text key
            Try
                MyWaitwindow.Title = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("PFNT_MSG - BrowseDialogSearchingTitle")
                MyWaitwindow.Message = MicroFour.StrataFrame.UI.Localization.RetrieveTextValue("PFNT_MSG - BrowseDialogSearchingMessage")
            Catch ex As Exception
            End Try
            '-- IGB - added on 2011/04/08 - END
        End Sub


Hope it helps. Wink
hector
hector
StrataFrame User (144 reputation)StrataFrame User (144 reputation)StrataFrame User (144 reputation)StrataFrame User (144 reputation)StrataFrame User (144 reputation)StrataFrame User (144 reputation)StrataFrame User (144 reputation)StrataFrame User (144 reputation)StrataFrame User (144 reputation)
Group: StrataFrame Users
Posts: 52, Visits: 559
Hi Trent,

I am having the same difficulty for localizing the waitwindow.

The last message seems to be on 2009,

Could you please tell me if this is fixed with the new update and how can I localize it?
Trent Taylor
Trent Taylor
StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Not yet.
Philipp Guntermann
Philipp Guntermann
StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)
Group: Forum Members
Posts: 141, Visits: 263
Ok. Thanks.

Have you had a look on the missing localization ?

Trent Taylor
Trent Taylor
StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)StrataFrame Developer (9.8K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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.
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>();

}

Philipp Guntermann
Philipp Guntermann
StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 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
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 (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 reputation)StrataFrame User (227 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);
}


Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K 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

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