Ivan George Borges
|
|
Group: StrataFrame MVPs
Posts: 1.9K,
Visits: 21K
|
As Trent has written to you before, StrataFrame covers many different tasks and this might be the diferential to help you make your decision. About the future plans and features, I wouldn't be able to tell you about your specific question at the moment, but will try and find out with the developers. Anyway, I am glad you got your problem solved.
|
|
|
Lukasz Kustusz
|
|
Group: Forum Members
Posts: 29,
Visits: 125
|
Thanks Ivan, I finally solved the issue with some support from the DevXpress. The problem was with the test for rowcount=0 at the begining of the above procedure: Here's the full description of my solution: http://www.devexpress.com/Support/Center/p/Q275267.aspxI still think that this type of join should be handled at the business layer, though. In SF forums I found some posts where this is mentioned: http://forum.strataframe.net/Topic25388.aspxhttp://forum.strataframe.net/Topic3321.aspxhttp://forum.strataframe.net/Topic5719.aspxThere seems to be several ways, like using DB Views, or dummy ddt profiles, or updating custom fields in the interface (my case). They all seem to have some drawbacks, especially when BOs must be updatable. In contrast, using ADO.NET, while being a more manual approach, does provide a possibility to construct DataSets from joins, with custom UPDATE, DELETE, and INSERT statements if necessary. My situation is special in that I'm just testing the StrataSphere out (using the trial version for almost a week) to see if it can give us an advantage over using other frameworks (I'm also evaluating MereMortals, DevExpress) or just sticking to self-developed n-tier approach with ADO.NET in all our future developments. At the moment I'm undecided. Let me ask you this: Is there a plan to support BO joins in the near future?
|
|
|
Ivan George Borges
|
|
Group: StrataFrame MVPs
Posts: 1.9K,
Visits: 21K
|
That is the way I usually go. On the grid, you probably need an event for the Row Initialization.
|
|
|
Lukasz Kustusz
|
|
Group: Forum Members
Posts: 29,
Visits: 125
|
|
|
|
Lukasz Kustusz
|
|
Group: Forum Members
Posts: 29,
Visits: 125
|
Thank you for your comment. I tried it but it doesn't work exactly as expected. I added an unbound column to the parent view and populate it in the CustomColumnDisplayText like so:
Private Sub GridView2_CustomColumnDisplayText(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs) Handles GridView2.CustomColumnDisplayText If GridView2.RowCount = 0 Then Exit Sub End If If e.Column.FieldName = "Type" Then BoMasterLogType1.SeekToPrimaryKey(e.Value) End If If BoMasterLogType1.CurrentRowIndex >= 0 AndAlso e.Column.FieldName = "colTypeDescription" Then e.DisplayText = BoMasterLogType1.Type_Description End If End Sub
I call the FillAll method of BoMasterLogType1 in Form_Load.
It seems to work as far as the display is concerned, ie every row now has the correct LogDescription in the custom column. But it's not working when I drag the LogDescription column to the Group by section. It only shows one log type at a time - the one that's in the curernt row. Grouping by any of the bound columns works fine, ie. all possible values are shown.
Forgive my ignorance, but shouldn't this linking be done in the Buisness or even Data tier? Is it not possible to link two BOs to produce this effect (like a BO join)? If I wanted to replace grid by a form with text boxes, and I wanted to show the description field instead of ID for any given type or category of a BO, do I have to handle it in the interface like this every time?
|
|
|
Ivan George Borges
|
|
Group: StrataFrame MVPs
Posts: 1.9K,
Visits: 21K
|
You are welcome, Lukasz. To accomplish what you asked, I would add an unbound column to the grid, if DevEx lets you do it. I use Infragistics, and in situations like that this is what I do. After adding the unbound columns into the grid, I use its InitializeRow event, for example, to set the column value for that current row. It would look something like this: Private Sub myGrid_InitializeRow( _ ByVal sender As System.Object, _ ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) _ Handles myGrid.InitializeRow
'-- check if there are rows to be initialized If Me.myGrid.Rows.Count() = 0 Then Exit Sub End If
'-- move record point to current row MyGridBO1.SeekToPrimaryKey(e.Row.Cells("my_pk").Value)
'-- get information from foreign table LogTypeDescriptionBO1.FillByPrimaryKey(MyGridBO1.LogType_ID) '-- if found, set caption If LogTypeDescriptionBO1.CurrentRowIndex < 0 Then e.Row.Cells("unboundcontro_CustomerTypeDescription").Value = RetrieveTextValue("MyLocalizationKey - NotFound") Else e.Row.Cells("unboundcontro_CustomerTypeDescription").Value = LogTypeDescriptionBO1.CustomerTypeDescription End If
End Sub
|
|
|
Lukasz Kustusz
|
|
Group: Forum Members
Posts: 29,
Visits: 125
|
Thank you again for all your support. I've rebuilt my project according to the structure in your sample and it does work. Interestingly it only works with the original DevExpress DataGrid. When I tried to use the SF EnhancedList instead, the entire grid was not visible (of course, the Visible property was true). Now, there's another question that I'd asked initially, that I'm trying to solve: -> How can I specify that the LogType_ID from every BO be "replaced by" LogDescription from the LogTypeDescription BO? In your example this would be equivalent to having a Customer Type where each rec in Customer table would have something like CustomerType_ID, and there would be another table, CUstomerTypeTable, with two fields (CustomerType_ID ,CustomerTypeDescription). What I need is to show the CustomerTypeDescription instead of CustomerType_ID in my grid.
|
|
|
Ivan George Borges
|
|
Group: StrataFrame MVPs
Posts: 1.9K,
Visits: 21K
|
It uses the StrataFrame Sample database that is installed with the SF framework. So you should already have it on your SQL Server.
|
|
|
Lukasz Kustusz
|
|
Group: Forum Members
Posts: 29,
Visits: 125
|
Thank you very much for the sample, I'm eager to try it out. I imagine it uses some sample database to which your BOs are mapped. Could you tell me where I can get a copy of this sample DB?
|
|
|
Ivan George Borges
|
|
Group: StrataFrame MVPs
Posts: 1.9K,
Visits: 21K
|
Hi Lukasz. I went ahead and downloaded DevEx to create a quick sample on how to use the BusinessBindingSource to accomplish a Parent-Child grid situation. You might find the name of my BBSs strange, since I used a sample I had written before on how to accomplish this on a report, and that's why I directed you to those posts when you had the impression that they had nothing to do with what you were asking for. Anyway, this sample has the same principles and uses a DevEx Grid, which is the control that the EnhancedList inherits from, so if you tweak the grid you will probably get the results you want. Here is the link: http://forum.strataframe.net/FindPost28370.aspxHope it helps in some way. Cheers.
|
|
|