Click here to Skip to main content
15,886,137 members
Articles / Desktop Programming / Windows Forms

ZipTrack

Rate me:
Please Sign up or sign in to vote.
4.86/5 (28 votes)
2 Dec 2009CPOL5 min read 59K   781   78  
A comprehensive way to manage all of your downloaded zip files.
'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:2.0.50727.3603
'
'     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 ZipTrack.Managers
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Reflection
Imports System.Text

'*************************************************************
' Class Name:  Website
' Purpose:  Class to encapsulate business rules and logic
' Description: 
'***************************************************************
Namespace Business
    
    Public Class Website
        Inherits Models.Website
        
        Private m_ArchiveProxy As System.Collections.Generic.List(Of Archive) = Nothing
        
        Public Sub New()
            MyBase.New
            Me.InitializeClass
            m_ArchiveProxy = New System.Collections.Generic.List(Of Archive)
        End Sub
        
        Public Sub New(ByVal WebsiteID As Integer, ByVal Name As String, ByVal Password As String, ByVal UserName As String, ByVal WebsiteUrl As String)
            MyBase.New
            Me.WebsiteID = WebsiteID
            Me.Name = Name
            Me.Password = Password
            Me.UserName = UserName
            Me.WebsiteUrl = WebsiteUrl
            m_ArchiveProxy = New System.Collections.Generic.List(Of Archive)
        End Sub
        
        Public Sub New(ByVal row As Schema.WebsiteRow)
            MyBase.New
            Me.WebsiteID = row.WebsiteID
            Me.Name = row.Name
            Me.Password = row.Password
            Me.UserName = row.UserName
            Me.WebsiteUrl = row.WebsiteUrl
            m_ArchiveProxy = New System.Collections.Generic.List(Of Archive)
        End Sub
        
        Public ReadOnly Property Archives() As System.Collections.Generic.List(Of Archive)
            Get
                m_ArchiveProxy = ArchiveManager.GetArchivesByWebsiteID(Me.WebsiteID)
                Return Me.m_ArchiveProxy
            End Get
        End Property
        
        #Region "InitializeClass"
        Private Sub InitializeClass()
        End Sub
        #End Region
        
        #Region "OrderArchivesBy"
        Public Function OrderArchivesBy(ByVal ColumnName As String, ByVal ASC As String) As System.Collections.Generic.List(Of Archive)
            Dim sql As String = ""
            sql = ((((("[WebsiteID]=" + Me.WebsiteID.ToString)  _
                        + " ORDER BY ")  _
                        + ColumnName)  _
                        + " ")  _
                        + ASC)
            m_ArchiveProxy = ArchiveManager.GetArchivesWhere(sql)
            Return Me.m_ArchiveProxy
        End Function
        #End Region
        
        #Region "RemoveArchive"
        Public Sub RemoveArchive(ByVal o As Business.Archive)
            ArchiveManager.Delete(o.ArchiveID)
        End Sub
        #End Region
        
        #Region "RemoveAllArchives"
        Public Sub RemoveAllArchives()
            m_ArchiveProxy.ForEach(AddressOf RemoveArchive)
        End Sub
        #End Region
        
        #Region "UpdateArchive"
        Public Sub UpdateArchive(ByVal o As Business.Archive)
            ArchiveManager.Update(o)
        End Sub
        #End Region
        
        #Region "UpdateAllArchives"
        Public Sub UpdateAllArchives()
            m_ArchiveProxy.ForEach(AddressOf UpdateArchive)
        End Sub
        #End Region
        
        #Region "ToString"
        Overrides Function ToString() As String
            Try 
                Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder
                sb.Append((("WebsiteID=" + WebsiteID.ToString)  _
                                + "::"))
                sb.Append((("Name=" + Name.ToString)  _
                                + "::"))
                sb.Append((("Password=" + Password.ToString)  _
                                + "::"))
                sb.Append((("UserName=" + UserName.ToString)  _
                                + "::"))
                sb.Append((("WebsiteUrl=" + WebsiteUrl.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 Code Project Open License (CPOL)


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