' <fileinfo name="OrderSubtotalsRow_Base.vb">
'       <copyright>
'           All rights reserved.
'       </copyright>
'       <remarks>
'           Do not change this source code manually. Changes to this file may 
'           cause incorrect behavior and will be lost if the code is regenerated.
'       </remarks>
'       <generator rewritefile="True" infourl="http://www.SharpPower.com">RapTier</generator>
' </fileinfo>

Option Strict Off
Option Explicit On

Imports System

''' <summary>
''' The base class for <see cref="OrderSubtotalsRow"/> that 
''' represents a record in the <c>Order Subtotals</c> view.
''' </summary>
''' <remarks>
''' Do not change this source code manually. Update the <see cref="OrderSubtotalsRow"/>
''' class if you need to add or change some functionality.
''' </remarks>
Public MustInherit Class OrderSubtotalsRow_Base
    Private _orderID As Integer
    Private _subtotal As Decimal
    Private _subtotalNull As Boolean = True

    ''' <summary>
    ''' Initializes a new instance of the <see cref="OrderSubtotalsRow_Base"/> class.
    ''' </summary>
    Public Sub New()
        MyBase.New()
        ' EMPTY
    End Sub

        ''' <summary>
        ''' Gets or sets the <c>OrderID</c> column value.
        ''' </summary>
        ''' <value>The <c>OrderID</c> column value.</value>
    Public Property OrderID As Integer
        Get
            Return _orderID
        End Get
        Set
            _orderID = value
        End Set
    End Property

        ''' <summary>
        ''' Gets or sets the <c>Subtotal</c> column value.
        ''' This column is nullable.
        ''' </summary>
        ''' <value>The <c>Subtotal</c> column value.</value>
    Public Property Subtotal As Decimal
        Get
            If IsSubtotalNull Then
                Throw New InvalidOperationException("Cannot get value because it is DBNull.")
            End If
            Return _subtotal
        End Get
        Set
            _subtotalNull = false
            _subtotal = value
        End Set
    End Property

    ''' <summary>
    ''' Indicates whether the <see cref="Subtotal"/>
    ''' property value is null.
    ''' </summary>
    ''' <value>true if the property value is null, otherwise false.</value>
    Public Property IsSubtotalNull As Boolean
        Get
            Return _subtotalNull
        End Get
        Set
            _subtotalNull = value
        End Set
    End Property

    ''' <summary>
    ''' Returns the string representation of this instance.
    ''' </summary>
    ''' <returns>The string representation of this instance.</returns>
    Public Overrides Function ToString() As String
        Dim dynStr As System.Text.StringBuilder = New System.Text.StringBuilder(Me.GetType().Name)
        dynStr.Append(":")
        dynStr.Append("  OrderID=")
        dynStr.Append(Me.OrderID)
        dynStr.Append("  Subtotal=")
        If IsSubtotalNull Then
            dynStr.Append("<NULL>")
        Else
            dynStr.Append(Me.Subtotal)
        End If
        Return dynStr.ToString()
    End Function
End Class