Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Limit number of simultaneously appointments (Read 3857 times)
dvdberg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 1
Joined: Mar 29th, 2006
Limit number of simultaneously appointments
Mar 29th, 2006 at 9:49am
Print Post  
How can I easly limit the number of simultaneously appointments?

I want to create an automtic system to create appointments. If have no trouble creating the appointments. But is't when the user starts dragging, where I want to limit the number of concurrent appointments.




  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Limit number of simultaneously appointments
Reply #1 - Mar 29th, 2006 at 11:01am
Print Post  
The following method prevents users from dragging more than 3 appointments in a single day in a SingleMonth, DayRange or WeekRange views. The method represents a handler of the Calendar.ItemModifying event, which is fired whenever the user moves or resizes appointements. Setting the Confirm property of the supplied EventArgs object forbids the operation.

Code
Select All
private void calendar_ItemModifying(object sender, ItemModifyConfirmEventArgs e)
{
 DateTime from = e.NewStartTime.Date;
 DateTime to = from + new TimeSpan(TimeSpan.TicksPerDay - 1);

 while (to < e.NewEndTime.Date)
 {
  if (calendar.Schedule.GetAllItems(from, to).Count > 2)
  {
   e.Confirm = false;
   return;
  }

  from += TimeSpan.FromDays(1);
  to = from + new TimeSpan(TimeSpan.TicksPerDay - 1);
 }
} 



  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint