Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic meetings at same time or part of the same time (Read 3168 times)
ricardo
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 12
Joined: Mar 5th, 2013
meetings at same time or part of the same time
Mar 26th, 2013 at 11:38am
Print Post  
is it possible to avoid the creation of "collisions appointments" ? is there any attribute for it? or I have to search one by one?
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: meetings at same time or part of the same time
Reply #1 - Mar 26th, 2013 at 12:25pm
Print Post  
Hi,

You need to handle the ItemCreating (and ItemModifying if you need to prevent collisions through item modifications as well) event and cancel the item creation (or modification) if the target time interval is already occupied. Here is some sample code for both event handlers:

Code
Select All
private void calendar_ItemModifying(object sender, ItemModifyConfirmEventArgs e)
{
	var items = calendar.Schedule.GetAllItems(e.Item.StartTime, e.Item.EndTime.AddTicks(-1));
	if (items.Contains(e.Item))
		items.Remove(e.Item);

	e.Confirm = items.Count == 0;
}

private void calendar_ItemCreating(object sender, ItemConfirmEventArgs e)
{
	var items = calendar.Schedule.GetAllItems(e.Item.StartTime, e.Item.EndTime.AddTicks(-1));
	if (items.Contains(e.Item))
		items.Remove(e.Item);

	e.Confirm = items.Count == 0;
} 


I hope this helps.

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