Hi every body !
I'm using DNN 4.5.3 and I'm trying to create a schedule that will automatically insert 10 sample record into a table( here is Category table)
My code is :
Imports Microsoft.VisualBasic
Namespace DotNetNuke.Modules.News
Public Class ScheduleSample
Inherits DotNetNuke.Services.Scheduling.SchedulerClient
Public Sub New(ByVal objScheduleHistoryItem As DotNetNuke.Services.Scheduling.ScheduleHistoryItem)
MyBase.new()
Me.ScheduleHistoryItem = objScheduleHistoryItem
End Sub
Private Sub InsertTenSampleRecord()
Dim objController As New NewsController
' Insert 10 sample records into table Category
Me.Status = "Inserting Item"
For i As Integer = 1 To 10
Dim objCategory As New CategoryInfo
objCategory.CategoryName = "schedule Category"
objController.AddCategory(objCategory)
Next
Me.Status = "Insert Item Successfully"
Me.ScheduleHistoryItem.Succeeded = True
End Sub
Public Overrides Sub DoWork()
Try
'notification that the event is progressing
Me.Progressing() 'OPTIONAL
InsertTenSampleRecord()
Me.ScheduleHistoryItem.Succeeded = True 'REQUIRED
Me.ScheduleHistoryItem.AddLogNote("Insert completed.")
Catch exc As Exception 'REQUIRED
Me.ScheduleHistoryItem.Succeeded = False 'REQUIRED
Me.ScheduleHistoryItem.AddLogNote("Insert failed." + exc.ToString) 'OPTIONAL
'notification that we have errored
Me.Errored(exc) 'REQUIRED
'log the exception
LogException(exc) 'OPTIONAL
End Try
End Sub
End Class
End Namespace
Then, I logged as host,
I added a new item to Schedule as:
Full Class Name and Assembly : DotNetNuke.Modules.AI.News.ScheduleSample, DOTNETNUKE
Schedule Enabled : ticked yes
Time Lapse: 1 minutes
Retry Frequency : 2 minutes
Retain Schedule History: 10
Run on Event: none
Catch Up Enabled: no
Object Dependencies: Category
But my class seems to be never called and no record is inserted
Do I have any bugs? or what have i done wrong?
Do i need to change the web.config file?
Please help me! Thank you very much!