This is a migrated thread and some comments may be shown as answers.

[Solved] can this be done using scheduler

1 Answer 168 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Zeeshan
Top achievements
Rank 1
Zeeshan asked on 19 Oct 2007, 05:59 AM
I was checking out the scheduler but i am not sure if it supports all the needs a scheduler would have ? lets see what telerik have to say about a common scenario which i have
i have list huge list of vendors that is growing constantly. so esentially i need to eblast those vendors using a rad editor template. so basically i want to take a 3 step approach.
1. User creates a search criteria which will filter the vendors that they want to ebast like find me vendors who belong to USA. Save the criteria in the database.
2. Create A template that they would send to the criteria created above. and save the template using rad editor to the datbase.
3. using hte scheduler. schedule reoccurring eblast using two resources one would be the template and second would be the search criteria they want to eblast. Ok this looks fine and dandy. so i have everything i need being saved to the database. which includes the schedule, template and the criteria.

But the question is how do i find the schedule is hit. like eblast vendors every sunday at 5:00 pm every week. I want to be able to saysomething
Appoeint a  = new Appointment();
a.CanProcess()
well CanProcess depends on couple of factors.
First is that appointment valid means today is saturday and appointment is scheduled on sunday so therefore this appointment is really not valid.
Consider valid appointments to be identified as valid as long as they lie less then half an hour of the current date.
Second the appointment is really valid cuz it has not been processed.

I am not sure but i think some of this could be provided out of the box. like is this appointment between half an hour of the current date. With scheudler supporting complicated schedules. it could turn out to be hard to find out if some appointment is less then half an hour of current time.
appointment.HasHappenedIN(half an hour) or
appointment.LastHappenedDate + 30 min = DateTime.Now
do something.

i dont know may be this seems like business scenario then a control scenario but i think as far as dates are concerned regarding appointments. something should come out fo the base class.

Lets see what telerik has to say

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 23 Oct 2007, 08:39 AM
Hi Zeeshan,

Yes, this is possible with the DateTime methods and RadScheduler's server API. Here is a simple example:

protected void Button1_Click(object sender, EventArgs e)  
    {  
        Appointment a = new Appointment();  
        a.ID = "test1";  
        DateTime dtStart = new DateTime(2007, 10, 23, 9, 30, 0);     
        DateTime dtEnd = new DateTime(2007, 10, 23, 11, 00, 0);  
        a.Start = dtStart;  
        a.End = dtEnd;  
        a.Subject = "test appointment";  
          
        //The code below will insert the appointment if the DateTime.Now is 2007/10/11 11:35  
        if ( DateTime.Compare(a.End, DateTime.Now.AddMinutes(-30)) < 0)  
        {            
            RadScheduler1.InsertAppointment(a);  
        }  
        else 
        {  
            Response.Write("Appointement is invalid");  
        }  
    } 

This code will insert an appointment if its end DateTime is 30 minutes or more before the current System's DateTime. I hope this helps.



Greetings,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
Zeeshan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or