Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0WhatWhat's wrong with my Scheduler Class??
Previous
 
Next
New Post
12/24/2006 10:06 PM
 

Hi,

 

I needed to run some email-reminder task so I created a class to perform this task.

It simply does a DB query and sends an email for every returned record.

I tried following the instructions in the book + found some code samples, so I attached my class at the end.

My full class name is: Igiza.UnnTasks.SendInvitationReminders

Then I built my project using aspnet_compiler to get a DLL, copied this DLL (called Asp_Subcode_UnnTasks) into the bin directory of my website and then I created a Scheduler entry:

Full class name and assembley: Igiza.UnnTasks.SendInvitationReminders, App_SubCode_UnnTasks

Schedule Enabled: Yes

Time Lapse: 1 minute

Retry Frequency: 1 minute

The rest is default.

 

If I attach a debugger I see that my constructor is getting called but objScheduleHistoryItem has Success=false, and my DoWork() is never called (don't know if it's related).

What can be the reason for that and how can I make this simple scheduler work?

 

Many thanks

 

Ofer

==================

using System;using System.Data;using System.Collections.Generic;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using DotNetNuke;using DotNetNuke.Services;using DotNetNuke.Services.Scheduling;using DotNetNuke.Services.Exceptions;using DotNetNuke.Common.Lists;using DotNetNuke.Services.Localization;using DotNetNuke.Services.Mail;using Igiza.Modules.UnnInvite;using Igiza.Common;namespace Igiza.UnnTasks/// <summary>/// Summary description for SendInvitationReminders/// </summary>public class SendInvitationReminders : DotNetNuke.Services.Scheduling.SchedulerClient{/// <summary>
/// Constructor
/// </summary>
/// <param name="objScheduleHistoryItem"></param>public SendInvitationReminders(ScheduleHistoryItem objScheduleHistoryItem)
{
  base.SchedulerEventGUID = "";
 
base.aProcessMethod = "";
 
base.Status = "";
 
base.ScheduleHistoryItem = new ScheduleHistoryItem();
 
this.ScheduleHistoryItem = objScheduleHistoryItem;
}
public override void DoWork()
{
 
try
 
{
   
this.Progressing(); // Optional
   
ListController listCtl = new ListController();
   
ListEntryInfo leInfo = listCtl.GetListEntryInfo("unn_GlobalParams", "ScheduledSendReminderEmailDays");
   
int days = 0;
   
int invites = 0;
   
if (leInfo != null)
   {
      days =
Convert.ToInt32(leInfo.Text);
    }
    if (days > 0)
   {
//
// ok to send reminders..
//
UnnInviteController inviteCtl = new UnnInviteController();
List<UnnInviteInfo> inviteCol = inviteCtl.GetInvitations(days);
foreach (UnnInviteInfo info in inviteCol)
{
//
// loop thru the invitation list collection
//
string emailSubject = Localization.GetString("EMAIL_USER_REMINDER_SUBJECT.Text", UnnUtils.UnnSystemEmailsFile);
//
// Now send the email to the new user
//
Mail.SendMail(/*info.SenderEmail*/ "ofer@igiza.com", info.EmailAddress, "", emailSubject, info.InvitingUserMessage, "", "html", "", "", "", "");//
// Update the record that am enail was sent
//
inviteCtl.UpdateReminders(info.Token);
//
// increase the reminders count
//
invites++;this.ScheduleHistoryItem.Succeeded = true; // Requiredthis.ScheduleHistoryItem.AddLogNote(string.Format("SendInvitationReminders: Sent {0} invitations", invites));catch (Exception exc)this.ScheduleHistoryItem.Succeeded = false; // Requiredthis.ScheduleHistoryItem.AddLogNote("EXCEPTION: " + exc.ToString()); // Optional// notification that we have erroredthis.Errored(ref exc);// log the exceptionExceptions.LogException(exc); // Optional}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

{

 

 

 

 

 

 

 

 

 

 

}

}

 

 

}

 

{

 

 

 

 

 

 

 

}

}

}

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0WhatWhat's wrong with my Scheduler Class??


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out