private void printAdapter_ValidateAppointments(object sender, AppointmentsValidationEventArgs e) { int count = e.Appointments.Count; AppointmentBaseCollection result = new AppointmentBaseCollection(); for (int i = 0; i < count; i++) { Appointment apt = e.Appointments[i]; if (apt.IsRecurring) { result.Add(apt); } } e.Appointments.Clear(); e.Appointments.AddRange(result); }
void SchedulerAdapter_ValidateAppointments(object sender, AppointmentsValidationEventArgs e) { int count = e.Appointments.Count; AppointmentBaseCollection result = new AppointmentBaseCollection(); for (int i = 0; i < count; i++) { Appointment apt = e.Appointments[i]; // Add recurring appointments to the resulting collection if (apt.IsRecurring) { result.Add(apt); } } e.Appointments.Clear(); e.Appointments.AddRange(result); }
public static AppointmentBaseCollection GenerateAppointmentsPerDay(AppointmentBaseCollection sourceCollection) { AppointmentBaseCollection aptsPerDaysCollection = new AppointmentBaseCollection(); foreach (Appointment item in sourceCollection) { if (item.SameDay) { aptsPerDaysCollection.Add(item); } else { aptsPerDaysCollection.AddRange(DivideApointments(item)); } } return(aptsPerDaysCollection); }
static void FillConflictedAppointmentsCollection(AppointmentBaseCollection conflicts, TimeInterval interval, AppointmentBaseCollection collection, Appointment currApt) { for (int i = 0; i < collection.Count; i++) { Appointment apt = collection[i]; if (new TimeInterval(apt.Start, apt.End).IntersectsWith(interval) & !(apt.Start == interval.End || apt.End == interval.Start)) { if (apt.ResourceId == currApt.ResourceId) { conflicts.Add(apt); } } if (apt.Type == AppointmentType.Pattern) { FillConflictedAppointmentsCollection(conflicts, interval, apt.GetExceptions(), currApt); } } }
void OnSchedulerControlPrepareDragData(object sender, PrepareDragDataEventArgs e) { object data = e.DataObject.GetData(DataFormats.Serializable); AppointmentBaseCollection appointments = new AppointmentBaseCollection(); foreach (AppointmentExchangeData item in (IList)data) { var apt = this.schedulerStorage.CreateAppointment(AppointmentType.Normal); apt.Subject = item.Subject; apt.Description = item.Description; apt.Start = item.Start; apt.Duration = item.Duration; apt.LabelKey = item.LabelKey; apt.StatusKey = item.StatusKey; appointments.Add(apt); } SchedulerDragData schedulerDragData = new SchedulerDragData(appointments); e.DragData = schedulerDragData; }
static AppointmentBaseCollection DivideApointments(Appointment sourceApt) { DayIntervalCollection daysCollection = new DayIntervalCollection(); daysCollection.Add(new TimeInterval(sourceApt.Start, sourceApt.End)); AppointmentBaseCollection dividedApts = new AppointmentBaseCollection(); foreach (TimeInterval day in daysCollection) { Appointment dailyApt = sourceApt.Copy(); dailyApt.Start = day.Start.Date; dailyApt.End = day.End.Date; dailyApt.AllDay = true; dividedApts.Add(dailyApt); } AdjustStart(dividedApts, sourceApt); AdjustEnd(dividedApts, sourceApt); return(dividedApts); }
SchedulerDragData GetDragData(GridView view) { int[] selection = view.GetSelectedRows(); if (selection == null) return null; AppointmentBaseCollection appointments = new AppointmentBaseCollection(); int count = selection.Length; for (int i = 0; i < count; i++) { int rowIndex = selection[i]; Appointment apt = schedulerStorage1.CreateAppointment(AppointmentType.Normal); apt.Subject = "Programación de Visita Cliente " + (string)view.GetRowCellValue(rowIndex, "NombreCliente"); apt.LabelId = (int)Entidades.Enums.Enums.VisitaEstadoVista.Pendiente; // (int)view.GetRowCellValue(rowIndex, "Severity"); apt.StatusId = 0; // (int)view.GetRowCellValue(rowIndex, "Priority"); apt.Duration = new TimeSpan(0, 1, 0, 0); // TimeSpan.FromHours((int)view.GetRowCellValue(rowIndex, "Duration")); apt.Description = "Visita Cliente " + (string)view.GetRowCellValue(rowIndex, "NombreCliente"); IdClienteDraw = (Int64)view.GetRowCellValue(rowIndex, "Id"); appointments.Add(apt); } return new SchedulerDragData(appointments, 0); }
SchedulerDragData GetDragData(GridView view) { int[] selection = view.GetSelectedRows(); if (selection == null) { return(null); } AppointmentBaseCollection appointments = new AppointmentBaseCollection(); int count = selection.Length; for (int i = 0; i < count; i++) { int rowIndex = selection[i]; MyTask myTask = view.GetRow(rowIndex) as MyTask; //imposto una variabile a livello //di modulo per il richiamo alle successive azioni postdragdrop if (Properties.Settings.Default.Main_RenewActivityAfterDragDrop || Properties.Settings.Default.Main_MarkActivityCompletedafterDragDrop) { _draggedTask = myTask; } else { _draggedTask = null; } if (myTask == null) { break; } Appointment apt = schedulerStorage1.CreateAppointment(AppointmentType.Normal); apt.AllDay = false; if (schedulerControl1.ActiveViewType != SchedulerViewType.Day && schedulerControl1.ActiveViewType != SchedulerViewType.WorkWeek) { AppointmentDateValidator v = AppointmentUtils.GetProposedDate(apt.Start); apt.Start = v.StartDate; apt.End = v.EndDate; } else { apt.Duration = TimeSpan.FromHours(0.5); } apt.Subject = myTask.Subject; //apt.LabelId = (int)view.GetRowCellValue(rowIndex, "Severity"); //apt.StatusId = (int)view.GetRowCellValue(rowIndex, "Priority"); //WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource r = new ResourceHandler().GetAll()[0] as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource; ////apt.ResourceId = r.Id; //if (schedulerControl1.GroupType == SchedulerGroupType.None) // apt.SetValue(schedulerStorage1, "Resource", r); apt.SetValue(schedulerStorage1, "Label", new LabelHandler().GetAll()[0]); if (myTask.Customer != null) { apt.SetValue(schedulerStorage1, "Customer", myTask.Customer); Customer c = myTask.Customer; apt.Location = string.Format("{0} {1} {2}", c.Residenza.Via, c.Residenza.Cap, c.Residenza.Comune.Descrizione); if (string.IsNullOrEmpty(myTask.Description)) { apt.Description = c.OtherDataSummary; } } if (!string.IsNullOrEmpty(myTask.Description)) { apt.Description = myTask.Description; } appointments.Add(apt); } return(new SchedulerDragData(appointments, 0)); }
private void FillConflictedAppointmentsCollection(AppointmentBaseCollection conflicts, TimeInterval interval, AppointmentBaseCollection collection, Appointment currApt) { for (int i = 0; i < collection.Count; i++) { Appointment apt = collection[i]; if (new TimeInterval(apt.Start, apt.End).IntersectsWith(interval) & !(apt.Start == interval.End || apt.End == interval.Start)) { string local_usado = apt.CustomFields["Local"].ToString(); try { mia.local_a_usar = currApt.CustomFields["Local"].ToString(); } catch { } if ((apt != currApt) && (local_usado == mia.local_a_usar)) { conflicts.Add(apt); toolTipController1.ShowHint("Horario y Lugar Ocupado.", Form_squedul.MousePosition); } } if (apt.Type == AppointmentType.Pattern) { FillConflictedAppointmentsCollection(conflicts, interval, apt.GetExceptions(), currApt); } } }