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); } } }