private void schedulerStorage1_AppointmentsInserted(object sender, PersistentObjectsEventArgs e) { foreach (DevExpress.XtraScheduler.Appointment a in (DevExpress.XtraScheduler.AppointmentBaseCollection)(e.Objects)) { Scheduler.Appointment db_a = new Scheduler.Appointment(); db_a.IdPaciente = Convert.ToInt32(a.CustomFields["IdPaciente"]); //db_a.IdProfecional = (int)a.CustomFields[""]; db_a.Label = a.LabelId; db_a.ResourceId = (int)a.ResourceId; db_a.Status = a.StatusId; db_a.Subject = a.Subject; db_a.Description = a.Description; db_a.Start = a.Start; db_a.End = a.End; db_a.Duration = Convert.ToDecimal(a.Duration.TotalHours); db_a.Location = a.Location; db_a.Range = (int)a.RecurrenceInfo.Range; db_a.Month = a.RecurrenceInfo.Month; db_a.Periodicity = a.RecurrenceInfo.Periodicity; using (DataClasses1DataContext dc = new DataClasses1DataContext()) { //dc.Appointments.InsertOnSubmit(db_a); } } }
static void FillAppointmentsStorage(AppointmentCollection c) { DevExpress.XtraScheduler.Appointment wAppointment; using (DataClasses1DataContext dc = new DataClasses1DataContext()) { foreach (Appointment a in dc.Appointments) { wAppointment = new DevExpress.XtraScheduler.Appointment (a.Start.Value,a.End.Value); wAppointment.Subject = a.Subject; wAppointment.StatusId = a.Status.Value; c.Add(wAppointment); } } }
static void FillResourcesStorage(ResourceCollection c) { Resource r; using (DataClasses1DataContext dc = new DataClasses1DataContext()) { foreach (Profecional a in dc.Profecionals) { r = new Resource(a.IdProfecional, String.Concat(a.Persona.Nombre, ", ", a.Persona.Apellido)); c.Add(r); } } }