Ejemplo n.º 1
0
        static void InsertAppointments(GorusmeTakip.Models.GorusmeTkpModellerim appointmentContext, GorusmeTakip.Models.GorusmeTkpModellerim resourceContext)
        {
            var appointments = appointmentContext.Appointments.ToList();
            var resources    = resourceContext.Resources;

            var newAppointments = DevExpress.Web.Mvc.SchedulerExtension.GetAppointmentsToInsert <GorusmeTakip.Models.Appointment>("Scheduler", appointments, resources,
                                                                                                                                  AppointmentStorage, ResourceStorage);

            foreach (var appointment in newAppointments)
            {
                appointmentContext.Appointments.Add(appointment);
            }
            appointmentContext.SaveChanges();
        }
Ejemplo n.º 2
0
        static void UpdateAppointments(GorusmeTakip.Models.GorusmeTkpModellerim appointmentContext, GorusmeTakip.Models.GorusmeTkpModellerim resourceContext)
        {
            var appointments = appointmentContext.Appointments.ToList();
            var resources    = resourceContext.Resources;

            var updAppointments = DevExpress.Web.Mvc.SchedulerExtension.GetAppointmentsToUpdate <GorusmeTakip.Models.Appointment>("Scheduler", appointments, resources,
                                                                                                                                  AppointmentStorage, ResourceStorage);

            foreach (var appointment in updAppointments)
            {
                var origAppointment = appointments.FirstOrDefault(a => a.UniqueID == appointment.UniqueID);
                appointmentContext.Entry(origAppointment).CurrentValues.SetValues(appointment);
            }
            appointmentContext.SaveChanges();
        }
Ejemplo n.º 3
0
        static void DeleteAppointments(GorusmeTakip.Models.GorusmeTkpModellerim appointmentContext, GorusmeTakip.Models.GorusmeTkpModellerim resourceContext)
        {
            var appointments = appointmentContext.Appointments.ToList();
            var resources    = resourceContext.Resources;

            var delAppointments = DevExpress.Web.Mvc.SchedulerExtension.GetAppointmentsToRemove <GorusmeTakip.Models.Appointment>("Scheduler", appointments, resources,
                                                                                                                                  AppointmentStorage, ResourceStorage);

            foreach (var appointment in delAppointments)
            {
                var delAppointment = appointments.FirstOrDefault(a => a.UniqueID == appointment.UniqueID);
                if (delAppointment != null)
                {
                    appointmentContext.Appointments.Remove(delAppointment);
                }
            }
            appointmentContext.SaveChanges();
        }
Ejemplo n.º 4
0
 public static void UpdateEditableDataObject(GorusmeTakip.Models.GorusmeTkpModellerim appointmentContext, GorusmeTakip.Models.GorusmeTkpModellerim resourceContext)
 {
     InsertAppointments(appointmentContext, resourceContext);
     UpdateAppointments(appointmentContext, resourceContext);
     DeleteAppointments(appointmentContext, resourceContext);
 }