public static void RemoveAppointment(DBAppointment appt) { SchedulingDataClassesDataContext db = new SchedulingDataClassesDataContext(); DBAppointment query = (DBAppointment)(from carSchedule in db.DBAppointments where carSchedule.UniqueID == appt.UniqueID select carSchedule).SingleOrDefault(); db.DBAppointments.DeleteOnSubmit(query); db.SubmitChanges(); }
private void schedulerStorage1_AppointmentDeleting(object sender, PersistentObjectCancelEventArgs e) { Appointment apt = (Appointment)e.Object; DBAppointment dbApt = (DBAppointment)apt.GetSourceObject(schedulerStorage1); context.DBAppointments.DeleteOnSubmit(dbApt); context.SubmitChanges(); }
private void schedulerStorage1_AppointmentsInserted(object sender, PersistentObjectsEventArgs e) { foreach (Appointment apt in e.Objects) { DBAppointment dbApt = (DBAppointment)apt.GetSourceObject(schedulerStorage1); context.DBAppointments.InsertOnSubmit(dbApt); context.SubmitChanges(); } }
public static void InsertAppointment(DBAppointment appt) { if (appt == null) { return; } SchedulingDataClassesDataContext db = new SchedulingDataClassesDataContext(); appt.UniqueID = appt.GetHashCode(); db.DBAppointments.InsertOnSubmit(appt); db.SubmitChanges(); }
static void UpdateAppointment() { DBAppointment insertedAppt = SchedulerExtension.GetAppointmentToInsert <DBAppointment>(SchedulerSettingsHelper.CommonSchedulerSettings, SchedulerDataHelper.GetAppointments(), SchedulerDataHelper.GetResources()); SchedulerDataHelper.InsertAppointment(insertedAppt); DBAppointment[] updatedAppt = SchedulerExtension.GetAppointmentsToUpdate <DBAppointment>(SchedulerSettingsHelper.CommonSchedulerSettings, SchedulerDataHelper.GetAppointments(), SchedulerDataHelper.GetResources()); foreach (var appt in updatedAppt) { SchedulerDataHelper.UpdateAppointment(appt); } DBAppointment[] removedAppt = SchedulerExtension.GetAppointmentsToRemove <DBAppointment>(SchedulerSettingsHelper.CommonSchedulerSettings, SchedulerDataHelper.GetAppointments(), SchedulerDataHelper.GetResources()); foreach (var appt in removedAppt) { SchedulerDataHelper.RemoveAppointment(appt); } }
public static void UpdateAppointment(DBAppointment appt) { if (appt == null) { return; } SchedulingDataClassesDataContext db = new SchedulingDataClassesDataContext(); DBAppointment query = (DBAppointment)(from carSchedule in db.DBAppointments where carSchedule.UniqueID == appt.UniqueID select carSchedule).SingleOrDefault(); query.UniqueID = appt.UniqueID; query.StartDate = appt.StartDate; query.EndDate = appt.EndDate; query.AllDay = appt.AllDay; query.Subject = appt.Subject; query.Description = appt.Description; query.Location = appt.Location; query.RecurrenceInfo = appt.RecurrenceInfo; query.ReminderInfo = appt.ReminderInfo; query.Status = appt.Status; query.Type = appt.Type; query.Label = appt.Label; query.ResourceID = appt.ResourceID; db.SubmitChanges(); }