StrataFrame Forum

Custom Business Binding Source

http://forum.strataframe.net/Topic32422.aspx

By Charles Thomas Blankenship - 2/9/2014

I've created a new Project for reporting ... created a custom business binding source ... as Ehdy recommended ... but after building the solution the only thing that shows up is the HolidaysBO ... not the HolidaysBBS ... the HolidaysBO cannot be dropped onto the DevExpressReport ... I assume only the HolidaysBBS can perform that function.

Any ideas to help straighten me out?

Thanks
By Edhy Rijo - 2/9/2014

Hi Charles,

You need to modify the BBS class so it can be shown in the VS ToolBox as follows:

Imports System.ComponentModel
Namespace Reports.Transactions
    <ToolboxItem(True)>
    Public Class PaymentScheduleViewBBS
        Inherits MicroFour.StrataFrame.Business.BusinessBindingSource(Of PaymentScheduleViewBO)
    End Class
End Namespace

Then re-build the solution, so the VS ToolBox will be populated with your BBS.
By Charles Thomas Blankenship - 2/10/2014

Thanks so much Edhy ... it's great to have you around!
By Edhy Rijo - 2/10/2014

You are welcome Charles!!!
By Charles Thomas Blankenship - 2/14/2014

OK Edhy:

I've wasted a ton of time trying to figure this DevExpress XtraReport (13.2) / SF Custom Business Binding Source integration problem and am stumped.

Here is the skinny on this particular simple situation I have:

I have a report that displays a list of all Defined Holidays in the system ... however, the report header has to be dynamic in that this application will be sold to any number of companies that have different names and the Company Name at the top of the report has to be pulled from a CompanyConfig table.  So, I created two custom BBSs, one for the CompanyConfig and one for the Holiday business object.  I then followed the StrataFlix example of adding the CompanyConfigBO to the Holiday BO (all created by the Custom BBS wizard).  Then, I created the HolidayListingDataSource as specified in StrataFlix ... created the methods to populate the associated business objects and then dropped the HolidayBBS onto the DevExpress XtraReport.  When I attempt to databind the labels the only table that shows up is the HolidayBO ... the CompanyConfigBO is nowhere to be found.

I was able to get around this by dropping both the xrCompanyConfigBBS and the xrHolidayBBS onto the report. 

I was under the impression that one BBS could be created that contained both the required tables.  I'm going to need a working example in order to figure this out because I'm obviously too dense to do it on my own.

I've reviewed you example on another post ... but it always comes back to the StrataFlix example that ends with each datasouce being added to the rdlc.DataSources.Add() ... DevExpress XtraReport does not have an equivalent method of adding DataSources.  I've been chasing my tail for too long and don't know which way is up anymore.

Can you clarify?

Happy Valentine's Day.
By Edhy Rijo - 2/22/2014

Hi Charles,

My solution to your situation is to create a class in my Business project, I name my AppSettings.vb.  In this class I would create a Public Shared ReadOnly Property for the CompanyConfig BO, then I would use objects of this properties in my report directly instead of using a BBS, also I use those properties in many other parts of my applications when needed, here is quick sample of the AppSettings.vb class:

Imports InsuranceBrokerSystem.Business

Public Class AppSettings
    Private Sub New()
    End Sub

    '-- Set the Company Setting Object
    Public Shared ReadOnly Property CompanyConfig() As CompanyConfigBO
        Get
            Using bo As New bizCompany
                bo.FillAll()
                If bo.Count = 0 Then
                    bo.NewRow()
                    bo.Save()
                End If

                Return bo
            End Using
        End Get
    End Property
End Class


Then in your Master Report report PageHeader.BeforePrint you can do things like this with your own share property, be aware that in the sample code below, I already created some parameters in my Master report like "BusinessCompanyName":

Private Sub PageHeader_BeforePrint(sender As Object, e As Drawing.Printing.PrintEventArgs) Handles PageHeader.BeforePrint
        '-- Set the Internal Parameters values for the report header
        Dim ShowCompanyName As Boolean = True
        Dim sb As New System.Text.StringBuilder

        With Business.AppSettings.Company
            If ShowCompanyName = True Then
                Me.BusinessCompanyName.Value = .CompanyName
            End If

            If Not String.IsNullOrWhiteSpace(.Street) Then
                sb.AppendLine(.Street)
            End If

            sb.AppendFormat("{0} {1} {2}", .City, .State, .Zip)
            Me.BusinessCompanyAddress.Value = sb.ToString


            Dim sbPhoneLine As New System.Text.StringBuilder
            sbPhoneLine.AppendFormat("Phone: {0}  Fax: {1}", CleanFormatPhoneNumber(.Phone), CleanFormatPhoneNumber(.Fax))

            If Not String.IsNullOrWhiteSpace(.CompanyEmail) Then
                sbPhoneLine.Append(String.Format("   [{0}]", .CompanyEmail))
            End If

            If Not String.IsNullOrWhiteSpace(.CompanyWebSite) Then
                sbPhoneLine.Append(String.Format("   [{0}]", .CompanyWebSite))

                '-- Add the company url to the logo
                Me.xrCompanyLogoPictureBox.NavigateUrl = .CompanyWebSite
            End If

            Me.BusinessCompanyPhoneAndFax.Value = sbPhoneLine.ToString
        End With
    End Sub


Using this method, you can have your DevExpress Master Report with the Header showing the same info like company name and address as well as the report or transaction type, in my case here, a Customer Receipt and a Transactions Report shown in the attached images.

For you and others, be aware that reporting concepts can get deep and sometimes it is almost impossible to explain a concept without dedicating a lot of time to show and explain how a concept was used and sometimes there is not such free time to explaining all. I am sure it took you quite some time to come up with your "DXStrataflixExampleTutorial.docx" document and still things may not be completely clear for some users here.

I hope my concept explain here can help you enhance your classes, but there is much more in there that it is not possible to explain in a forum thread.

Enjoy and have fun with it!!!!