AmosFiveSix.com

Experience, Knowledge, Creativity

  • Increase font size
  • Default font size
  • Decrease font size

Store.vb

E-mail Print PDF

See my portfolio for information on the Document Builder project that used the Query Tree component.


Imports NACS.Utilities.StyleWriter  ' For access to StyleWriter
Imports NACS.Data.QueryTree         ' For access to IEntityInstance, Node and Arguments
Imports NACS.Helpers.Text           ' For acesss to AddressHelper

Namespace NACS.DocBuilder.Directory.Stores

    Public Class Store

        Implements IEntityInstance

        Private Shared m_dSurveyStartDate As New DateTime(2009, 10, 12)

        Private Shared m_iDirectoryYear As Integer = 2010

        Public ID As Nullable(Of Integer) = Nothing                             ' vwCompanies.ID

        Public Name As String = Nothing                                         ' vwCompanies.Name

        Public IsMember As Nullable(Of Boolean) = Nothing                     ' vwCompanies.Status = 2, 6, 3

        Public IsInstitutionLiableForDebts As Nullable(Of Boolean) = Nothing    ' Topic Code 66 - Liable for Debt

        Public NACSCorpID As String = Nothing                                 ' vwCompanies.NACSCorpID

        Public LeaseOperator As String = Nothing                                ' vwCompanies.ParentName

        Public ContactName As String = Nothing                                 ' MPC.Name fields...

        Public ContactTitle As String = Nothing                                 ' MPC.Title

        Public Address1 As String = Nothing                                     ' vwCompanies.AddressLine1

        Public Address2 As String = Nothing                                     ' vwCompanies.AddressLine2

        Public City As String = Nothing                                         ' vwCompanies.City

        Public State As String = Nothing                                        ' vwCompanies.State

        Public ZipCode As String = Nothing                                     ' vwCompanies.ZipCode

        Public Country As String = Nothing                                     ' vwCompanies.Country

        Public Phone As String = Nothing                                        ' vwCompanies.MainPhone...

        Public Fax As String = Nothing                                         ' vwCompanies.MainFax...

        Public Email As String = Nothing                                        ' vwCompanies.MainEmail

        Public WebSite As String = Nothing                                     ' vwCompanies.WebSite

        Public SAN As String = Nothing                                         ' vwNACSStoreDemo.SAN

        Public Hours As String = Nothing                                        ' vwNACSStoreDemo.StoreHours

        Public SalesPersonHours As String = Nothing                             ' vwNACSStoreDemo.RepHours

        Public Ownership As String = Nothing                                    ' vwCompanies.OwnType

        Public AlsoServes As String = Nothing                                 ' ...

        Public SurveyDate As Nullable(Of Date) = Nothing                        ' vwCompanies.SurveyDate

        Public IsUpToDate As Boolean = Nothing                                 ' ...

        Public Sub EnterRecord(ByVal oNode As Node, ByVal oArguments As Arguments) Implements IEntityInstance.EnterRecord

            Dim sNameStyle As String = IIf(Me.IsMember, Styles.Member, Nothing)

            Dim sPhoneStyle As String = CalcPhoneStyle(Me.Phone, Me.Fax, Styles.Value, Styles.ValueCompact)

            Dim sWebsiteStyle As String = CalcWebsiteStyle(Me.WebSite, Styles.Value, Styles.ValueCompact)

            Dim sContactLine As String = CalcContactLine(Me.ContactName, ContactTitle)

            With GetStyleWriter(oArguments)

                .BeginSection("Store")

                .BeginLine(Styles.Name)
                .Write(sNameStyle, Me.Name)
                If Me.IsInstitutionLiableForDebts.GetValueOrDefault(False) Then .WriteNonBreakingSpace() : .Write(Styles.LiableForDebts, ChrW(&H75))
                .EndLine()

                .WriteLabelValues(Styles.Details, Styles.Label, Styles.Value, Labels.ID, Me.ID.ToString, Labels.NACSCorpID, Me.NACSCorpID, " ")
                .WriteLabelValue(Styles.Details, Styles.Label, Styles.Value, Labels.LeaseOperator, Me.LeaseOperator)
                .WriteLine(Styles.Details, sContactLine)
                .WriteLine(Styles.Details, AddressHelper.CombineAddress(Me.Address1, Me.Address2, Me.City, Me.State, Me.ZipCode, Nothing))
                .WriteLabelValues(Styles.Details, Styles.Label, sPhoneStyle, Labels.Phone, Me.Phone, Labels.Fax, Me.Fax, " ")
                .WriteLabelValue(Styles.Details, Styles.Label, Styles.Value, Labels.Email, Me.Email)
                .WriteLabelValue(Styles.Details, Styles.Label, sWebsiteStyle, Labels.WebSite, Me.WebSite)
                .WriteLabelValue(Styles.Details, Styles.Label, Styles.Value, Labels.SAN, Me.SAN)
                .WriteLabelValue(Styles.Details, Styles.Label, Styles.Value, Labels.Hours, Me.Hours)
                .WriteLabelValue(Styles.Details, Styles.Label, Styles.Value, Labels.SalesPersonHours, Me.SalesPersonHours)
                .WriteLabelValue(Styles.Details, Styles.Label, Styles.Value, Labels.Ownership, Me.Ownership)

            End With

        End Sub

        Public Sub LeaveRecord(ByVal oNode As Node, ByVal oArguments As Arguments) Implements IEntityInstance.LeaveRecord

            With GetStyleWriter(oArguments)

                .WriteLabelValue(Styles.AlsoServes, Styles.Label, Styles.Value, Labels.AlsoServes, Me.AlsoServes)

                If Me.SurveyDate.GetValueOrDefault(Date.MinValue) < m_dSurveyStartDate Then

                    .WriteLine(Styles.NotUpToDate, String.Concat("Did not respond to update request " & m_iDirectoryYear.ToString()))

                End If

                If Not oNode.IsLast Then

                    .WriteBlankLine(Styles.Spacer)

                End If

                .EndSection()

            End With

        End Sub

        Private Class Styles

            Public Const Name As String = "StoreName"                     ' Paragraph
            Public Const Member As String = "StoreMember"                 ' Character
            Public Const LiableForDebts As String = "StoreLiableForDebts" ' Character
            Public Const Details As String = "StoreDetails"                 ' Paragraph
            Public Const Label As String = "StoreLabel"                     ' Character
            Public Const Value As String = "StoreValue"                     ' Character
            Public Const ValueCompact As String = "StoreValueCompact"     ' Character
            Public Const AlsoServes As String = "StoreAlsoServes"         ' Paragraph
            Public Const NotUpToDate As String = "StoreNotUpToDate"         ' Paragraph
            Public Const Spacer As String = "StoreSpacer"                 ' Paragraph

        End Class

        Private Class Labels

            Public Const ID As String = "NACS #"
            Public Const NACSCorpID As String = " NACSCORP #"
            Public Const LeaseOperator As String = "LEASE OPERATOR: "
            Public Const Phone As String = "PHONE: "
            Public Const Fax As String = "FAX: "
            Public Const Email As String = "E-MAIL: "
            Public Const WebSite As String = "WEB SITE: "
            Public Const SAN As String = "SAN: "
            Public Const Hours As String = "STORE HOURS: "
            Public Const SalesPersonHours As String = "SALESPERSON HOURS: "
            Public Const Ownership As String = "STORE OWNERSHIP: "
            Public Const AlsoServes As String = "ALSO SERVES: "

        End Class

    End Class

End Namespace