protected void ASPxScheduler1_AppointmentsInserted(object sender, DevExpress.XtraScheduler.PersistentObjectsEventArgs e) { Appointment apt = (Appointment)e.Objects[0]; ASPxSchedulerStorage storage = (ASPxSchedulerStorage)sender; storage.SetAppointmentId(apt, lastInsertedAppointmentId); }
public static void SetupMappings(ASPxScheduler control) { ASPxSchedulerStorage storage = control.Storage; ASPxAppointmentMappingInfo mappings = storage.Appointments.Mappings; storage.BeginUpdate(); try { mappings.AppointmentId = "Id"; mappings.Start = "StartTime"; mappings.End = "EndTime"; mappings.Subject = "Subject"; mappings.AllDay = "AllDay"; mappings.Description = "Description"; mappings.Label = "Label"; mappings.Location = "Location"; mappings.RecurrenceInfo = "RecurrenceInfo"; mappings.ReminderInfo = "ReminderInfo"; mappings.ResourceId = "OwnerId"; mappings.Status = "Status"; mappings.Type = "EventType"; } finally { storage.EndUpdate(); } }
static AgendaAppointment CreateAgendaAppointment(ASPxSchedulerStorage storage, Appointment sourceAppointment, DateTime startDate, string startTime, string endTime) { AgendaAppointment agendaAppointment = new AgendaAppointment(); agendaAppointment.Id = sourceAppointment.Id; agendaAppointment.AgendaDate = startDate; agendaAppointment.AgendaDescription = sourceAppointment.Description; agendaAppointment.AgendaSubject = sourceAppointment.Subject; if (startTime == "" && endTime == "") { agendaAppointment.AgendaDuration = "All Day"; } else if (startTime == "" && endTime != "") { agendaAppointment.AgendaDuration = "Till: " + endTime; } else if (startTime != "" && endTime == "") { agendaAppointment.AgendaDuration = "From: " + startTime; } else { agendaAppointment.AgendaDuration = String.Format("{0} - {1}", startTime, endTime); } agendaAppointment.ResourceId = sourceAppointment.ResourceId; agendaAppointment.AgendaLocation = sourceAppointment.Location; agendaAppointment.AgendaStatus = storage.Appointments.Statuses.GetById((int)sourceAppointment.StatusKey);; agendaAppointment.AgendaLabel = storage.Appointments.Labels.GetById((int)sourceAppointment.LabelKey).Color; agendaAppointment.SourceAppointment = sourceAppointment; return(agendaAppointment); }
private static void SetupDefaultMappingsSiteMode(ASPxScheduler control) { ASPxSchedulerStorage storage = control.Storage; storage.BeginUpdate(); try { ASPxResourceMappingInfo resourceMappings = storage.Resources.Mappings; resourceMappings.ResourceId = "Id"; resourceMappings.Caption = "Caption"; ASPxAppointmentMappingInfo appointmentMappings = storage.Appointments.Mappings; appointmentMappings.AppointmentId = "Id"; appointmentMappings.Start = "StartTime"; appointmentMappings.End = "EndTime"; appointmentMappings.Subject = "Subject"; appointmentMappings.AllDay = "AllDay"; appointmentMappings.Description = "Description"; appointmentMappings.Label = "Label"; appointmentMappings.Location = "Location"; appointmentMappings.RecurrenceInfo = "RecurrenceInfo"; appointmentMappings.ReminderInfo = "ReminderInfo"; appointmentMappings.ResourceId = "OwnerId"; appointmentMappings.Status = "Status"; appointmentMappings.Type = "EventType"; } finally { storage.EndUpdate(); } }
protected void ControlOnAppointmentInserting(object sender, PersistentObjectCancelEventArgs e) { ASPxSchedulerStorage storage = (ASPxSchedulerStorage)sender; Appointment apt = (Appointment)e.Object; storage.SetAppointmentId(apt, "a" + apt.GetHashCode()); }
public static void SetupMappings(ASPxScheduler control) { ASPxSchedulerStorage storage = control.Storage; ASPxAppointmentMappingInfo mappings = storage.Appointments.Mappings; storage.BeginUpdate(); try { mappings.AppointmentId = "Id"; mappings.Start = "StartTime"; mappings.End = "EndTime"; mappings.Subject = "Subject"; mappings.AllDay = "AllDay"; mappings.Description = "Description"; mappings.Label = "Label"; mappings.Location = "Location"; mappings.RecurrenceInfo = "RecurrenceInfo"; mappings.ReminderInfo = "ReminderInfo"; mappings.ResourceId = "OwnerId"; mappings.Status = "Status"; mappings.Type = "EventType"; #region #custommappings storage.Appointments.CustomFieldMappings.Add (new ASPxAppointmentCustomFieldMapping("Field1", "Amount")); storage.Appointments.CustomFieldMappings.Add (new ASPxAppointmentCustomFieldMapping("Field2", "Memo")); #endregion #custommappings } finally { storage.EndUpdate(); } }
void SetAppointmentId(object sender, PersistentObjectCancelEventArgs e) { ASPxSchedulerStorage storage = (ASPxSchedulerStorage)sender; Appointment apt = (Appointment)e.Object; storage.SetAppointmentId(apt, apt.GetHashCode()); }
public static void AddLabels(ASPxSchedulerStorage storage) { AppointmentLabelCollection lc = storage.Appointments.Labels; lc.Clear(); lc.Add(Color.LightGreen, "Vacation", "&Vacation"); lc.Add(Color.Lavender, "Time Off", "Time &Off"); lc.Add(Color.AntiqueWhite, "Business", "&Business"); }
void control_AppointmentsInserted(object sender, PersistentObjectsEventArgs e) { ASPxSchedulerStorage storage = (ASPxSchedulerStorage)sender; System.Diagnostics.Debug.Assert(e.Objects.Count == 1); Appointment apt = (Appointment)e.Objects[0]; storage.SetAppointmentId(apt, this.lastInsertedId); }
void ControlOnAppointmentsInserted(object sender, PersistentObjectsEventArgs e) { for (int i = 0; i < e.Objects.Count; i++) { Appointment apt = (Appointment)e.Objects[i]; ASPxSchedulerStorage storage = (ASPxSchedulerStorage)sender; storage.SetAppointmentId(apt, lastInsertedAppointmentId); } }
protected void ASPxScheduler1_AppointmentsInserted(object sender, PersistentObjectsEventArgs e) { int count = e.Objects.Count; //System.Diagnostics.Debug.Assert(count == 1); Appointment apt = (Appointment)e.Objects[0]; ASPxSchedulerStorage storage = (ASPxSchedulerStorage)sender; storage.SetAppointmentId(apt, lastInsertedAppointmentId); }
void ControlOnAppointmentsInserted(object sender, PersistentObjectsEventArgs e) { // Autoincremented primary key case int count = e.Objects.Count; System.Diagnostics.Debug.Assert(count == 1); Appointment apt = (Appointment)e.Objects[0]; ASPxSchedulerStorage storage = (ASPxSchedulerStorage)sender; storage.SetAppointmentId(apt, lastInsertedAppointmentId); }
void control_AppointmentsInserted(object sender, PersistentObjectsEventArgs e) { ASPxSchedulerStorage storage = (ASPxSchedulerStorage)sender; int count = e.Objects.Count; for (int i = 0; i < count; i++) { Appointment apt = (Appointment)e.Objects[i]; storage.SetAppointmentId(apt, this.lastInsertedIdList[i]); } this.lastInsertedIdList.Clear(); }
void SetAppointmentsId(object sender, PersistentObjectsEventArgs e) { AppointmentBaseCollection appointments = (AppointmentBaseCollection)e.Objects; ASPxSchedulerStorage storage = (ASPxSchedulerStorage)sender; int count = appointments.Count; System.Diagnostics.Debug.Assert(count == insertedAppointmentsId.Count); for (int i = 0; i < count; i++) { Appointment apt = appointments[i]; storage.SetAppointmentId(apt, insertedAppointmentsId[i]); } insertedAppointmentsId.Clear(); }
public static void FillResources(ASPxSchedulerStorage storage) { ResourceCollection resources = storage.Resources.Items; storage.BeginUpdate(); try { for (int i = 1; i <= Users.Length; i++) { resources.Add(storage.CreateResource(Usernames[i - 1], Users[i - 1])); } } finally { storage.EndUpdate(); } }
public static object GenerateAgendaAppointmentCollection(ASPxSchedulerStorage storage, object resourceId) { List <Appointment> sourceAppointments = null; if (Convert.ToInt32(resourceId) == -1) { sourceAppointments = storage.GetAppointments(SelectedInterval).ToList <Appointment>(); } else { sourceAppointments = storage.GetAppointments(SelectedInterval).Where <Appointment>(apt => apt.ResourceId == resourceId || apt.ResourceIds.Contains(resourceId)).ToList <Appointment>(); } AgendaAppointmentCollection agendaAppointments = new AgendaAppointmentCollection(); foreach (Appointment appointment in sourceAppointments) { TimeInterval currentDayInterval = new TimeInterval(appointment.Start.Date, appointment.Start.Date.AddDays(1)); string startTime = ""; string endTime = ""; if (currentDayInterval.Contains(appointment.End)) { startTime = currentDayInterval.Start == appointment.Start ? "" : appointment.Start.TimeOfDay.ToString(@"hh\:mm"); endTime = currentDayInterval.End == appointment.End ? "" : appointment.End.TimeOfDay.ToString(@"hh\:mm"); agendaAppointments.Add(CreateAgendaAppointment(storage, appointment, currentDayInterval.Start, startTime, endTime)); } else { startTime = currentDayInterval.Start == appointment.Start ? "" : appointment.Start.TimeOfDay.ToString(@"hh\:mm"); agendaAppointments.Add(CreateAgendaAppointment(storage, appointment, currentDayInterval.Start, startTime, "")); while (true) { currentDayInterval = new TimeInterval(currentDayInterval.End, currentDayInterval.End.AddDays(1)); if (currentDayInterval.Contains(appointment.End)) { endTime = currentDayInterval.End == appointment.End ? "" : appointment.End.TimeOfDay.ToString(@"hh\:mm"); agendaAppointments.Add(CreateAgendaAppointment(storage, appointment, currentDayInterval.Start, "", endTime)); break; } else { agendaAppointments.Add(CreateAgendaAppointment(storage, appointment, currentDayInterval.Start, "", "")); } } } } return(agendaAppointments); }
public static void FillResources(ASPxSchedulerStorage storage, int count) { ResourceCollection resources = storage.Resources.Items; storage.BeginUpdate(); try { int cnt = Math.Min(count, Users.Length); for (int i = 1; i <= cnt; i++) { resources.Add(new Resource(Usernames[i - 1], Users[i - 1])); } } finally { storage.EndUpdate(); } }
protected void ASPxScheduler1_AppointmentsInserted(object sender, DevExpress.XtraScheduler.PersistentObjectsEventArgs e) { int count = e.Objects.Count; System.Diagnostics.Debug.Assert(count == lastInsertedIds.Count); ASPxSchedulerStorage storage = (ASPxSchedulerStorage)sender; for (int i = 0; i < count; i++) { Appointment apt = (Appointment)e.Objects[i]; int appointmentId = lastInsertedIds[i]; storage.SetAppointmentId(apt, appointmentId); } lastInsertedIds.Clear(); }
public static object GenerateResourcesCollection(ASPxSchedulerStorage storage) { AgendaResourceCollection collection = new AgendaResourceCollection(); for (int i = 0; i < storage.Resources.Count; i++) { Resource currentResource = storage.Resources[i]; collection.Add(new AgendaResource() { Id = currentResource.Id, AgendaResourceName = currentResource.Caption, AgendaResourceImageUrl = currentResource.CustomFields[0] == null ? string.Empty : currentResource.CustomFields[0].ToString() }); } return(collection); }
public static void FillResources(ASPxSchedulerStorage storage, int count) { ResourceCollection resources = storage.Resources.Items; storage.BeginUpdate(); try { int cnt = Math.Min(count, Users.Length); for (int i = 1; i <= cnt; i++) { string resID = Usernames[i - 1]; string resName = Users[i - 1]; resources.Add(storage.CreateResource(resID, resName)); } } finally { storage.EndUpdate(); } }
public static void FillResources(ASPxSchedulerStorage storage, List<Employee> Users) { ResourceCollection resources = storage.Resources.Items; storage.BeginUpdate(); try { foreach (var employee in Users) { Resource resource = storage.CreateResource(employee.id); resource.Caption = employee.name; resources.Add(resource); } } finally { storage.EndUpdate(); } }
public static void AddStatuses(ASPxSchedulerStorage storage) { AppointmentStatusCollection sc = storage.Appointments.Statuses; sc.Add(Color.Red, "Not Approved", "Not Approved"); }