Click here to Skip to main content
15,896,207 members
Articles / Web Development / IIS

Scheduled Tasks Web Service

Rate me:
Please Sign up or sign in to vote.
4.00/5 (9 votes)
23 Nov 2007CPOL6 min read 127.6K   2.5K   65  
A web service that acts as a scheduler for tasks.
Partial Class ScheduleTaskDataset

    Partial Class TaskRow

        ''' <summary>
        ''' Validate the current row
        ''' </summary>
        ''' <returns>Errors found</returns>
        Public Function Validate() As String
            Dim errorString As String = ""

            'Required Fields
            If Me.IsFriendlyNameNull Then
                errorString &= "Task Name,"
            End If
            If Me.IsAssemblyNameNull Then
                errorString &= " Assembly Name,"
            End If
            If Me.IsPerformTaskFromNull AndAlso Not Me.IsPerformTaskToNull Then
                errorString &= " Perform From"
            End If
            If Not Me.IsPerformTaskFromNull AndAlso Me.IsPerformTaskToNull Then
                errorString &= " Perform To"
            End If
            If errorString.Length > 0 Then
                errorString &= vbCrLf & "Cannot be empty"
            End If

            'Check for valid hours
            If Not Me.IsPerformTaskFromNull AndAlso Not Me.IsPerformTaskToNull AndAlso Me.PerformTaskFrom >= Me.PerformTaskTo Then
                errorString &= vbCrLf & "Perform Task From must be lower than Perform Task To"
            End If
            'Check for valid dates
            If Not Me.IsEndTimeNull AndAlso Me.EndTime <= Me.StartTime Then
                errorString &= vbCrLf & "End Date/Time must be higher than Start Date/Time"
            End If
            'return errors found
            Return errorString
        End Function

    End Class
End Class

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
Web Developer
Mexico Mexico
I am Pedro Ramirez from mexico, work for www.sciodev.com, the company is located in Mexico, we do outsourcing and nearshore development, we are focused on SaaS nearshore development, I started with VB.Net, but now I am ambidextrous using VB.Net or C#.

Comments and Discussions