Ejemplo n.º 1
0
        static void UpdateAppointments(rendevusistemi.Database.MyDbContext appointmentContext, rendevusistemi.Database.MyDbContext resourceContext)
        {
            var appointments = appointmentContext.Appointmenties.ToList();
            var resources    = resourceContext.Employes;

            var updAppointments = DevExpress.Web.Mvc.SchedulerExtension.GetAppointmentsToUpdate <rendevusistemi.Database.Data.Appointments>("Scheduler1", appointments, resources,
                                                                                                                                            AppointmentStorage, ResourceStorage);

            foreach (var appointment in updAppointments)
            {
                var origAppointment = appointments.FirstOrDefault(a => a.Id == appointment.Id);
                appointmentContext.Entry(origAppointment).CurrentValues.SetValues(appointment);
            }
            appointmentContext.SaveChanges();
        }
Ejemplo n.º 2
0
        static void DeleteAppointments(rendevusistemi.Database.MyDbContext appointmentContext, rendevusistemi.Database.MyDbContext resourceContext)
        {
            var appointments = appointmentContext.Appointmenties.ToList();
            var resources    = resourceContext.Employes;

            var delAppointments = DevExpress.Web.Mvc.SchedulerExtension.GetAppointmentsToRemove <rendevusistemi.Database.Data.Appointments>("Scheduler1", appointments, resources,
                                                                                                                                            AppointmentStorage, ResourceStorage);

            foreach (var appointment in delAppointments)
            {
                var delAppointment = appointments.FirstOrDefault(a => a.Id == appointment.Id);
                if (delAppointment != null)
                {
                    appointmentContext.Appointmenties.Remove(delAppointment);
                }
            }
            appointmentContext.SaveChanges();
        }
Ejemplo n.º 3
0
        static void InsertAppointments(rendevusistemi.Database.MyDbContext appointmentContext, rendevusistemi.Database.MyDbContext resourceContext)
        {
            var appointments = appointmentContext.Appointmenties.ToList();

            var resources = resourceContext.Employes.ToList();

            var newAppointments = DevExpress.Web.Mvc.SchedulerExtension.GetAppointmentsToInsert <rendevusistemi.Database.Data.Appointments>("Scheduler1", appointments, resources,
                                                                                                                                            AppointmentStorage, ResourceStorage);

            MyDbContext db = new MyDbContext();


            foreach (var appointment in newAppointments)
            {
                var    isim = db.Employes.Where(a => a.Id == appointment.EmployeId).FirstOrDefault();
                string aa   = string.Concat(isim.Fullname, " ", appointment.Description);
                appointment.Description = aa;
                appointmentContext.Appointmenties.Add(appointment);
            }
            appointmentContext.SaveChanges();
        }
Ejemplo n.º 4
0
 public static void UpdateEditableDataObject(rendevusistemi.Database.MyDbContext appointmentContext, rendevusistemi.Database.MyDbContext resourceContext)
 {
     InsertAppointments(appointmentContext, resourceContext);
     UpdateAppointments(appointmentContext, resourceContext);
     DeleteAppointments(appointmentContext, resourceContext);
 }