<commit_before><Serializable()> _
Public Class Project
  Inherits BusinessBase(Of Project)

#Region " Business Methods "

  Private mId As Guid = Guid.NewGuid
  Private mName As String = ""
  Private mStarted As New SmartDate
  Private mEnded As New SmartDate(False)
  Private mDescription As String = ""
  Private mTimestamp(7) As Byte

  Private mResources As ProjectResources = _
    ProjectResources.NewProjectResources()

  <System.ComponentModel.DataObjectField(True, True)> _
  Public ReadOnly Property Id() As Guid
    Get
      CanReadProperty(True)
      Return mId
    End Get
  End Property

  Public Property Name() As String
    Get
      CanReadProperty(True)
      Return mName
    End Get
    Set(ByVal Value As String)
      CanWriteProperty(True)
      If mName <> Value Then
        mName = Value
        PropertyHasChanged()
      End If
    End Set
  End Property

  Public Property Started() As String
    Get
      CanReadProperty(True)
      Return mStarted.Text
    End Get
    Set(ByVal Value As String)
      CanWriteProperty(True)
      If mStarted <> Value Then
        mStarted.Text = Value
        ValidationRules.CheckRules("Ended")
        PropertyHasChanged()
      End If
    End Set
  End Property

  Public Property Ended() As String
    Get
      CanReadProperty(True)
      Return mEnded.Text
    End Get
    Set(ByVal Value As String)
      CanWriteProperty(True)
      If mEnded <> Value Then
        mEnded.Text = Value
        ValidationRules.CheckRules("Started")
        PropertyHasChanged()
      End If
    End Set
  End Property

  Public Property Description() As String
    Get
      CanReadProperty(True)
      Return mDescription
    End Get
    Set(ByVal Value As String)
      CanWriteProperty(True)
      If mDescription <> Value Then
        mDescription = Value
        PropertyHasChanged()
      End If
    End Set
  End Property

  Public ReadOnly Property Resources() As ProjectResources
    Get
      Return mResources
    End Get
  End Property

  Public Overrides ReadOnly Property IsValid() As Boolean
    Get
      Return MyBase.IsValid AndAlso mResources.IsValid
    End Get
  End Property

  Public Overrides ReadOnly Property IsDirty() As Boolean
    Get
      Return MyBase.IsDirty OrElse mResources.IsDirty
    End Get
  End Property

  Protected Overrides Function GetIdValue() As Object
    Return mId
  End Function

#End Region

#Region " Validation Rules "

  Protected Overrides Sub AddBusinessRules()

    ValidationRules.AddRule( _
      AddressOf Validation.CommonRules.StringRequired, "Name")
    ValidationRules.AddRule( _
      AddressOf Validation.CommonRules.StringMaxLength, _
      New Validation.CommonRules.MaxLengthRuleArgs("Name", 50))

    ValidationRules.AddRule(AddressOf StartDateGTEndDate, "Started")
    ValidationRules.AddRule(AddressOf StartDateGTEndDate, "Ended")

  End Sub

  Private Function StartDateGTEndDate( _
    ByVal target As Object, ByVal e As Validation.RuleArgs) As Boolean
<commit_msg>Updates for Chapter 8.<commit_after><Serializable()> _
Public Class Project
  Inherits BusinessBase(Of Project)

#Region " Business Methods "

  Private mId As Guid = Guid.NewGuid
  Private mName As String = ""
  Private mStarted As New SmartDate
  Private mEnded As New SmartDate(False)
  Private mDescription As String = ""
  Private mTimestamp(7) As Byte

  Private mResources As ProjectResources = _
    ProjectResources.NewProjectResources()

  <System.ComponentModel.DataObjectField(True, True)> _
  Public ReadOnly Property Id() As Guid
    Get
      CanReadProperty(True)
      Return mId
    End Get
  End Property

  Public Property Name() As String
    Get
      CanReadProperty(True)
      Return mName
    End Get
    Set(ByVal Value As String)
      CanWriteProperty(True)
      If mName <> Value Then
        mName = Value
        PropertyHasChanged()
      End If
    End Set
  End Property

  Public Property Started() As String
    Get
      CanReadProperty(True)
      Return mStarted.Text
    End Get
    Set(ByVal Value As String)
      CanWriteProperty(True)
      If mStarted <> Value Then
        mStarted.Text = Value
        ValidationRules.CheckRules("Ended")
        PropertyHasChanged()
      End If
    End Set
  End Property

  Public Property Ended() As String
    Get
      CanReadProperty(True)
      Return mEnded.Text
    End Get
    Set(ByVal Value As String)
      CanWriteProperty(True)
      If mEnded <> Value Then
        mEnded.Text = Value
        ValidationRules.CheckRules("Started")
        PropertyHasChanged()
      End If
    End Set
  End Property

  Public Property Description() As String
    Get
      CanReadProperty(True)
      Return mDescription
    End Get
    Set(ByVal Value As String)
      CanWriteProperty(True)
      If mDescription <> Value Then
        mDescription = Value
        PropertyHasChanged()
      End If
    End Set
  End Property

  Public ReadOnly Property Resources() As ProjectResources
    Get
      Return mResources
    End Get
  End Property

  Public Overrides ReadOnly Property IsValid() As Boolean
    Get
      Return MyBase.IsValid AndAlso mResources.IsValid
    End Get
  End Property

  Public Overrides ReadOnly Property IsDirty() As Boolean
    Get
      Return MyBase.IsDirty OrElse mResources.IsDirty
    End Get
  End Property

  Protected Overrides Function GetIdValue() As Object
    Return mId
  End Function

#End Region

#Region " Validation Rules "

  Protected Overrides Sub AddBusinessRules()

    ValidationRules.AddRule( _
      AddressOf Validation.CommonRules.StringRequired, "Name")
    ValidationRules.AddRule( _
      AddressOf Validation.CommonRules.StringMaxLength, _
      New Validation.CommonRules.MaxLengthRuleArgs("Name", 50))

    ValidationRules.AddRule(AddressOf StartDateGTEndDate, "Started")
    ValidationRules.AddRule(AddressOf StartDateGTEndDate, "Ended")

  End Sub

  Private Function StartDateGTEndDate( _
    ByVal target As Object, _
    ByVal e As Validation.RuleArgs) As Boolean

{'fraction_non_alphanumeric': 0.05336658354114713, 'fraction_numerical': 0.0011637572734829592, 'mean_word_length': 2.8712998712998714, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2269669', 'n_tokens_mistral': 1717, 'n_tokens_neox': 1645, 'n_words': 545}