Click here to Skip to main content
15,887,270 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 84K   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:  CostType
' Purpose:  Class to encapsulate business rules and logic
' Description: 
'***************************************************************
Namespace Business
    
    Public Class CostType
        Inherits Models.CostType
        
        Private m_ExpenseProxy As System.Collections.Generic.List(Of Expense) = Nothing
        
        Public Sub New()
            MyBase.New
            Me.InitializeClass
            m_ExpenseProxy = New System.Collections.Generic.List(Of Expense)
        End Sub
        
        Public Sub New(ByVal CostTypeID As Integer, ByVal Name As String)
            MyBase.New
            Me.CostTypeID = CostTypeID
            Me.Name = Name
            m_ExpenseProxy = New System.Collections.Generic.List(Of Expense)
        End Sub
        
        Public Sub New(ByVal row As Schema.CostTypeRow)
            MyBase.New
            Me.CostTypeID = row.CostTypeID
            Me.Name = row.Name
            m_ExpenseProxy = New System.Collections.Generic.List(Of Expense)
        End Sub
        
        Public ReadOnly Property Expenses() As System.Collections.Generic.List(Of Expense)
            Get
                m_ExpenseProxy = ExpenseManager.GetExpensesByCostTypeID(Me.CostTypeID)
                Return Me.m_ExpenseProxy
            End Get
        End Property
        
        #Region "InitializeClass"
        Private Sub InitializeClass()
        End Sub
        #End Region
        
        #Region "OrderExpensesBy"
        Public Function OrderExpensesBy(ByVal ColumnName As String, ByVal ASC As String) As System.Collections.Generic.List(Of Expense)
            Dim sql As String = ""
            sql = ((((("[CostTypeID]=" + Me.CostTypeID.ToString)  _
                        + " ORDER BY ")  _
                        + ColumnName)  _
                        + " ")  _
                        + ASC)
            m_ExpenseProxy = ExpenseManager.GetExpensesWhere(sql)
            Return Me.m_ExpenseProxy
        End Function
        #End Region
        
        #Region "RemoveExpense"
        Public Sub RemoveExpense(ByVal o As Business.Expense)
            ExpenseManager.Delete(o.ExpenseID)
        End Sub
        #End Region
        
        #Region "RemoveAllExpenses"
        Public Sub RemoveAllExpenses()
            m_ExpenseProxy.ForEach(AddressOf RemoveExpense)
        End Sub
        #End Region
        
        #Region "UpdateExpense"
        Public Sub UpdateExpense(ByVal o As Business.Expense)
            ExpenseManager.Update(o)
        End Sub
        #End Region
        
        #Region "UpdateAllExpenses"
        Public Sub UpdateAllExpenses()
            m_ExpenseProxy.ForEach(AddressOf UpdateExpense)
        End Sub
        #End Region
        
        #Region "ToString"
        Overrides Function ToString() As String
            Try 
                Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder
                sb.Append((("CostTypeID=" + CostTypeID.ToString)  _
                                + "::"))
                sb.Append((("Name=" + Name.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