private static void DeleteAppointments(SchedulerDataObject dataObject) { var currentTenant = caCurrent.CurrentTenant(); var currentUser = caCurrent.CurrentUser(); var appointmentServices = DependencyResolver.Current.GetService <IAppointmentsService>(); var orderServices = DependencyResolver.Current.GetService <IOrderService>(); var delAppointments = SchedulerExtension.GetAppointmentsToRemove <Appointments>("Scheduler", dataObject.FetchAppointments, dataObject.Resources, AppointmentStorage, ResourceStorage); foreach (var appointment in delAppointments) { // set IsCanceled flag for appointment if (appointment != null) { appointmentServices.DeleteAppointment(appointment); } //get order against appointment Order SchOrder = orderServices.GetOrderById(appointment.OrderId ?? 0); // set order status for rescheduling if (SchOrder != null) { orderServices.UpdateOrderStatus(SchOrder.OrderID, (int)OrderStatusEnum.ReAllocationRequired, currentUser.UserId); } //cancel notification queues appointmentServices.CancelNotificationQueuesforAppointment(appointment.AppointmentId); } }
static void InsertAppointments(SchedulerDataObject dataObject) { var AppointmentContext = DependencyResolver.Current.GetService <IApplicationContext>(); var newAppointments = DevExpress.Web.Mvc.SchedulerExtension.GetAppointmentsToInsert <Ganedata.Core.Entities.Domain.ResourceRequests>("Scheduler", dataObject.FetchAppointments, dataObject.Resources, AppointmentStorage, ResourceStorage); foreach (var appointment in newAppointments) { AppointmentContext.ResourceHolidays.Add(appointment); var empService = DependencyResolver.Current.GetService <IEmployeeServices>(); empService.AddResourceHolidayRequest(new ResourceRequestsViewModel() { StartDate = appointment.StartDate, AllDay = appointment.AllDay, EndDate = appointment.EndDate, EventType = appointment.EventType, HolidayReason = appointment.HolidayReason, Location = appointment.Location, Label = appointment.Label, RequestType = (ResourceRequestTypesEnum)appointment.EventType, ResourceName = appointment.Resources.Name }, caCurrent.CurrentTenant().TenantId, caCurrent.CurrentUser().UserId); } AppointmentContext.SaveChanges(); }
static void UpdateAppointments(SchedulerDataObject dataObject) { var AppointmentContext = DependencyResolver.Current.GetService <IApplicationContext>(); var updAppointments = DevExpress.Web.Mvc.SchedulerExtension.GetAppointmentsToUpdate <Ganedata.Core.Entities.Domain.ResourceRequests>("Scheduler", dataObject.FetchAppointments, dataObject.Resources, AppointmentStorage, ResourceStorage); foreach (var appointment in updAppointments) { var origAppointment = AppointmentContext.ResourceHolidays.FirstOrDefault(a => a.Id == appointment.Id); AppointmentContext.Entry(origAppointment).CurrentValues.SetValues(appointment); var empService = DependencyResolver.Current.GetService <IEmployeeServices>(); //TODO: Have to establish 1-1 relationship between Actual Appointments Model. Check with Shoaib empService.UpdateResourceHolidayRequest(new ResourceRequestsViewModel() { StartDate = appointment.StartDate, AllDay = appointment.AllDay, EndDate = appointment.EndDate, EventType = appointment.EventType, HolidayReason = appointment.HolidayReason, Location = appointment.Location, Label = appointment.Label, RequestType = appointment.RequestType, ResourceId = appointment.ResourceId, }, caCurrent.CurrentUser().UserId); } AppointmentContext.SaveChanges(); }
private static void UpdateAppointments(SchedulerDataObject dataObject) { var currentTenant = caCurrent.CurrentTenant(); var appointmentServices = DependencyResolver.Current.GetService <IAppointmentsService>(); var updAppointments = SchedulerExtension.GetAppointmentsToUpdate <Appointments>("Scheduler", dataObject.FetchAppointments, dataObject.Resources, AppointmentStorage, ResourceStorage); foreach (var appointment in updAppointments) { var origAppointment = appointmentServices.GetAllActiveAppointments(currentTenant.TenantId).FirstOrDefault(a => a.AppointmentId == appointment.AppointmentId); if (!appointment.ResourceIDs.Contains("<ResourceIds>")) { int ResId = Convert.ToInt32(appointment.ResourceIDs); origAppointment.ResourceId = ResId; origAppointment.ResourceIDs = $"<ResourceIds>\r\n<ResourceId Type = \"System.Int32\" Value = \"{ResId}\" />\r\n</ResourceIds>"; } else { origAppointment.ResourceIDs = appointment.ResourceIDs; } appointmentServices.UpdateAppointment(appointment); } }
static void UpdateAppointments(SchedulerDataObject dataObject) { var context = DependencyResolver.Current.GetService <IApplicationContext>(); var updAppointments = SchedulerExtension .GetAppointmentsToUpdate <Ganedata.Core.Entities.Domain.MarketRouteSchedule>("RouteScheduler", dataObject.FetchAppointments, dataObject.Resources, AppointmentStorage, ResourceStorage); foreach (var appointment in updAppointments) { var origAppointment = context.MarketRouteSchedules.FirstOrDefault(a => a.MarketRouteScheduleId == appointment.MarketRouteScheduleId); if (string.IsNullOrEmpty(appointment.WarehouseIDs) || !appointment.WarehouseIDs.Contains("<ResourceIds>")) { int ResId = Convert.ToInt32(appointment.WarehouseId); appointment.WarehouseIDs = $"<ResourceIds>\r\n<ResourceId Type = \"System.Int32\" Value = \"{ResId}\" />\r\n</ResourceIds>"; } context.Entry(origAppointment).CurrentValues.SetValues(appointment); } context.SaveChanges(); }
private static void InsertAppointments(SchedulerDataObject dataObject) { var currentTenant = caCurrent.CurrentTenant(); var appointmentServices = DependencyResolver.Current.GetService <IAppointmentsService>(); var newAppointments = SchedulerExtension.GetAppointmentsToInsert <Appointments>("Scheduler", dataObject.FetchAppointments, dataObject.Resources, AppointmentStorage, ResourceStorage); foreach (var appointment in newAppointments) { appointmentServices.CreateAppointment(appointment); } }
static void InsertAppointments(SchedulerDataObject dataObject) { var _marketRouteScheduleService = DependencyResolver.Current.GetService <MarketRouteScheduleService>(); var context = DependencyResolver.Current.GetService <IApplicationContext>(); var newAppointments = SchedulerExtension .GetAppointmentsToInsert <Ganedata.Core.Entities.Domain.MarketRouteSchedule>("RouteScheduler", dataObject.FetchAppointments, dataObject.Resources, AppointmentStorage, ResourceStorage); foreach (var appointment in newAppointments) { context.MarketRouteSchedules.Add(appointment); } context.SaveChanges(); }
static void DeleteAppointments(SchedulerDataObject dataObject) { var AppointmentContext = DependencyResolver.Current.GetService <IApplicationContext>(); var delAppointments = DevExpress.Web.Mvc.SchedulerExtension.GetAppointmentsToRemove <Ganedata.Core.Entities.Domain.ResourceRequests>("Scheduler", dataObject.FetchAppointments, dataObject.Resources, AppointmentStorage, ResourceStorage); foreach (var appointment in delAppointments) { var delAppointment = AppointmentContext.ResourceHolidays.FirstOrDefault(a => a.Id == appointment.Id); if (delAppointment != null) { delAppointment.IsDeleted = true; } AppointmentContext.Entry(delAppointment).State = EntityState.Modified; } AppointmentContext.SaveChanges(); }
static void DeleteAppointments(SchedulerDataObject dataObject) { var context = DependencyResolver.Current.GetService <IApplicationContext>(); var delAppointments = SchedulerExtension .GetAppointmentsToRemove <Ganedata.Core.Entities.Domain.MarketRouteSchedule>("RouteScheduler", dataObject.FetchAppointments, dataObject.Resources, AppointmentStorage, ResourceStorage); foreach (var appointment in delAppointments) { var delAppointment = context.MarketRouteSchedules.FirstOrDefault(a => a.MarketRouteScheduleId == appointment.MarketRouteScheduleId); if (delAppointment != null) { delAppointment.IsCanceled = true; } } context.SaveChanges(); }