Click here to Skip to main content
15,896,606 members
Articles / Programming Languages / Visual Basic

TeamVision

Rate me:
Please Sign up or sign in to vote.
3.08/5 (11 votes)
16 Nov 2009CPL3 min read 84.6K   5.4K   69  
A simple project task management application. A managed approach to help keep on top of your projects.
'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:2.0.50727.3082
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports TeamVision.Managers
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Reflection
Imports System.Text

'*************************************************************
' Class Name:  PersonTask
' Purpose:  Class to encapsulate business rules and logic
' Description: 
'***************************************************************
Namespace Business
    
    Public Class PersonTask
        Inherits Models.PersonTask
        
        Private m_Person As Person
        
        Private m_Task As Task
        
        Public Sub New()
            MyBase.New
            Me.InitializeClass
        End Sub
        
        Public Sub New(ByVal PersonTaskID As Integer, ByVal Name As String, ByVal PersonID As Integer, ByVal TaskID As Integer)
            MyBase.New
            Me.PersonTaskID = PersonTaskID
            Me.Name = Name
            Me.PersonID = PersonID
            Me.TaskID = TaskID
        End Sub
        
        Public Sub New(ByVal row As Schema.PersonTaskRow)
            MyBase.New
            Me.PersonTaskID = row.PersonTaskID
            Me.Name = row.Name
            Me.PersonID = row.PersonID
            Me.TaskID = row.TaskID
        End Sub
        
        Public Property Person() As Person
            Get
                If (m_Person Is Nothing) Then
                    Me.LazyLoadPerson
                End If
                Return m_Person
            End Get
            Set
                m_Person = value
            End Set
        End Property
        
        Public Property Task() As Task
            Get
                If (m_Task Is Nothing) Then
                    Me.LazyLoadTask
                End If
                Return m_Task
            End Get
            Set
                m_Task = value
            End Set
        End Property
        
        #Region "InitializeClass"
        Private Sub InitializeClass()
        End Sub
        #End Region
        
        #Region "LazyLoadPerson"
        Private Sub LazyLoadPerson()
            If (PersonID > 0) Then
                m_Person = PersonManager.GetByPrimaryKey(Me.PersonID)
            End If
        End Sub
        #End Region
        
        #Region "LazyLoadTask"
        Private Sub LazyLoadTask()
            If (TaskID > 0) Then
                m_Task = TaskManager.GetByPrimaryKey(Me.TaskID)
            End If
        End Sub
        #End Region
        
        #Region "ToString"
        Overrides Function ToString() As String
            Try 
                Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder
                sb.Append((("PersonTaskID=" + PersonTaskID.ToString)  _
                                + "::"))
                sb.Append((("Name=" + Name.ToString)  _
                                + "::"))
                sb.Append((("PersonID=" + PersonID.ToString)  _
                                + "::"))
                sb.Append((("TaskID=" + TaskID.ToString)  _
                                + "::"))
                Return sb.ToString
            Catch ex As System.Exception
                Return ""
            End Try
        End Function
        #End Region
    End Class
End Namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Common Public License Version 1.0 (CPL)


Written By
Founder Arkitech EBC Corporation
United States United States
MS, BBA, software developer, consultant, and trainer. Specializing in building data-centric applications designed for business, university, community & faith based organizations. Started developing Excel VBA macros and never looked back. Freelance developer utilizing VB.Net, SQL Server, Microsoft Access, and ASP.Net.

Comments and Discussions