private void AssociatedObject_AppointmentEdited(object sender, AppointmentEditedEventArgs e) { if (EditedAppointmentCommand != null && EditedAppointmentCommand.CanExecute(e.Appointment)) { EditedAppointmentCommand.Execute(e.Appointment); } }
public void Edit(AppointmentEditedEventArgs e) { var appointment = (Appointment)(e.Appointment); using (var db = new AppointmentContext()) { var findAppInDB = db.AppointmentModels.FirstOrDefault(applic => applic.Id == appointment.UniqueId); findAppInDB.StartTime = appointment.Start; findAppInDB.EndTime = appointment.End; findAppInDB.Subject = appointment.Subject; findAppInDB.Body = appointment.Body; db.SaveChanges(); } }
public IEnumerable<IResult> SchedulerClosedDaysEdited(object sender, AppointmentEditedEventArgs e) { AppClosedDay savingAppointment = ((AppClosedDay)e.Appointment); if (e.Appointment.IsNotNull()) { //SaveBusinessClosedDay this.SchedulerIsBusy = true; var reqSave = new SaveBusinessClosedDayRequest(savingAppointment); yield return reqSave; if (reqSave.Error != null) { //this.SchedulerDialogViewModel.Cancel(); yield return HandleExceptionResult.Display(reqSave.Error); this.SchedulerIsBusy = false; yield break; } this.SchedulerClosedDaysEditingId = Guid.Empty; this.SchedulerIsBusy = false; yield break; } }
public IEnumerable<IResult> SchedulerAppointmentEdited(object sender, AppointmentEditedEventArgs e) { AppAppointment savingAppointment = ((AppAppointment)e.Appointment); //Debug.WriteLine("Edited:"); //Debug.WriteLine(savingAppointment.UniqueId.ToString()); if (e.Appointment.IsNotNull()) { //Save Appointment this.SchedulerIsBusy = true; var reqSave = new SaveAppointmentRequest(savingAppointment); yield return reqSave; if (reqSave.Error != null) { //this.SchedulerDialogViewModel.Cancel(); yield return HandleExceptionResult.Display(reqSave.Error); this.SchedulerIsBusy = false; yield break; } this.SchedulerEditingId = Guid.Empty; this.SchedulerIsBusy = false; } }
private static void OnAppointmentEdited(object sender, AppointmentEditedEventArgs e) { scheduleView = sender as RadScheduleView; var editedApp = e.Appointment as Appointment; var resourcers = editedApp.Resources; var timeMarker = editedApp.TimeMarker; var currnetTimeMarkerResouce = scheduleView.ResourceTypesSource.Cast<ResourceType>() .Select(a => a.Resources).Where(a => a.ResourceType == "TimeMarkers").FirstOrDefault(); if (!editedApp.Resources.Any(a => a.ResourceType == currnetTimeMarkerResouce.ResourceType) && IsAppointmentChangedThroughDialog) { if (timeMarker != null) { var newResource = currnetTimeMarkerResouce.Where(a => a.DisplayName == timeMarker.TimeMarkerName).FirstOrDefault(); EditAppointment(editedApp, null, newResource); } } else { if (IsAppointmentChangedThroughDialog) { var currentResource = editedApp.Resources.Select(a => a).Where(a => a.ResourceType == "TimeMarkers").FirstOrDefault(); if (timeMarker != null) { var newResource = currnetTimeMarkerResouce.Where(a => a.DisplayName == timeMarker.TimeMarkerName).FirstOrDefault(); if (currentResource != newResource) { EditAppointment(editedApp, currentResource, newResource); } } else { EditAppointment(editedApp, currentResource, null); } if (editedApp.RecurrenceRule != null) { if (editedApp.RecurrenceRule.Exceptions.Count > 0) { foreach (var excApp in editedApp.RecurrenceRule.Exceptions) { var app = excApp.Appointment as Appointment; var currentExcResource = app.Resources.Select(a => a).Where(a => a.ResourceType == "TimeMarkers").FirstOrDefault(); if (app.TimeMarker != null) { var newExcResource = currnetTimeMarkerResouce.Where(a => a.DisplayName == app.TimeMarker.TimeMarkerName).FirstOrDefault(); if(currentExcResource != null) { if (app.TimeMarker.TimeMarkerName != currentExcResource.DisplayName) { EditAppointment(app, currentExcResource, newExcResource); UpdateMasterAppointment(editedApp); } } else { EditAppointment(app, null, newExcResource); UpdateMasterAppointment(editedApp); } } else { EditAppointment(app, currentExcResource, null); UpdateMasterAppointment(editedApp); } } } } } else { var markers = new ObservableCollection<TimeMarker>(scheduleView.TimeMarkersSource.Cast<TimeMarker>().ToList()); var currResourcesNames = editedApp.Resources.Select(b => b.ResourceName); var newMarker = markers.Where(a => currResourcesNames.Contains(a.TimeMarkerName)).FirstOrDefault(); if (editedApp.TimeMarker != newMarker) { editedApp.TimeMarker = newMarker; } if (editedApp.RecurrenceRule != null) { if (editedApp.RecurrenceRule.Exceptions.Count > 0) { foreach (var excApp in editedApp.RecurrenceRule.Exceptions) { var exception = excApp.Appointment as Appointment; var currExcResourcesNames = exception.Resources.Select(b => b.ResourceName); var newExcMarker = markers.Where(a => currExcResourcesNames.Contains(a.TimeMarkerName)).FirstOrDefault(); if (exception.TimeMarker != newExcMarker) { exception.TimeMarker = newExcMarker; } } } } } } if (IsAppointmentChangedThroughDialog) { IsAppointmentChangedThroughDialog = false; } }
private void MainSchedule_AppointmentEdited(object sender, AppointmentEditedEventArgs e) { ((sender as RadScheduleView).DataContext as RandomGeneratorViewModel).UpdateMinimap(); }
/// <summary> /// 编辑Appointment /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void PaymentScheduleView_OnAppointmentEdited(object sender, AppointmentEditedEventArgs e) { if (SelectedEnginePaymentSchedule == null) { MessageAlert("提示", "付款计划不能为空"); return; } var scheduleView = sender as RadScheduleView; if (scheduleView != null) { var appointment = e.Appointment as PaymentAppointment; if (appointment != null) { var paymentScheduleLine = SelectedEnginePaymentSchedule.PaymentScheduleLines.FirstOrDefault( p => p.PaymentScheduleLineId == int.Parse(appointment.UniqueId)); if (paymentScheduleLine != null) { AppointmentConvertHelper.ConvertToPaymentScheduleLine(appointment, paymentScheduleLine); } } } }
private static void OnAppointmentEdited(object sender, AppointmentEditedEventArgs e) { scheduleView = sender as RadScheduleView; var editedApp = e.Appointment as Appointment; var resourcers = editedApp.Resources; var timeMarker = editedApp.TimeMarker; var currnetTimeMarkerResouce = scheduleView.ResourceTypesSource.Cast <ResourceType>() .Select(a => a.Resources).Where(a => a.ResourceType == "TimeMarkers").FirstOrDefault(); if (!editedApp.Resources.Any(a => a.ResourceType == currnetTimeMarkerResouce.ResourceType) && IsAppointmentChangedThroughDialog) { if (timeMarker != null) { var newResource = currnetTimeMarkerResouce.Where(a => a.DisplayName == timeMarker.TimeMarkerName).FirstOrDefault(); EditAppointment(editedApp, null, newResource); } } else { if (IsAppointmentChangedThroughDialog) { var currentResource = editedApp.Resources.Select(a => a).Where(a => a.ResourceType == "TimeMarkers").FirstOrDefault(); if (timeMarker != null) { var newResource = currnetTimeMarkerResouce.Where(a => a.DisplayName == timeMarker.TimeMarkerName).FirstOrDefault(); if (currentResource != newResource) { EditAppointment(editedApp, currentResource, newResource); } } else { EditAppointment(editedApp, currentResource, null); } if (editedApp.RecurrenceRule != null) { if (editedApp.RecurrenceRule.Exceptions.Count > 0) { foreach (var excApp in editedApp.RecurrenceRule.Exceptions) { var app = excApp.Appointment as Appointment; var currentExcResource = app.Resources.Select(a => a).Where(a => a.ResourceType == "TimeMarkers").FirstOrDefault(); if (app.TimeMarker != null) { var newExcResource = currnetTimeMarkerResouce.Where(a => a.DisplayName == app.TimeMarker.TimeMarkerName).FirstOrDefault(); if (currentExcResource != null) { if (app.TimeMarker.TimeMarkerName != currentExcResource.DisplayName) { EditAppointment(app, currentExcResource, newExcResource); UpdateMasterAppointment(editedApp); } } else { EditAppointment(app, null, newExcResource); UpdateMasterAppointment(editedApp); } } else { EditAppointment(app, currentExcResource, null); UpdateMasterAppointment(editedApp); } } } } } else { var markers = new ObservableCollection <TimeMarker>(scheduleView.TimeMarkersSource.Cast <TimeMarker>().ToList()); var currResourcesNames = editedApp.Resources.Select(b => b.ResourceName); var newMarker = markers.Where(a => currResourcesNames.Contains(a.TimeMarkerName)).FirstOrDefault(); if (editedApp.TimeMarker != newMarker) { editedApp.TimeMarker = newMarker; } if (editedApp.RecurrenceRule != null) { if (editedApp.RecurrenceRule.Exceptions.Count > 0) { foreach (var excApp in editedApp.RecurrenceRule.Exceptions) { var exception = excApp.Appointment as Appointment; var currExcResourcesNames = exception.Resources.Select(b => b.ResourceName); var newExcMarker = markers.Where(a => currExcResourcesNames.Contains(a.TimeMarkerName)).FirstOrDefault(); if (exception.TimeMarker != newExcMarker) { exception.TimeMarker = newExcMarker; } } } } } } if (IsAppointmentChangedThroughDialog) { IsAppointmentChangedThroughDialog = false; } }
private void AppointmentEditedCommandExecute(AppointmentEditedEventArgs appointmentEditedEventArgs) { RadWindow.Confirm(new DialogParameters { Header = "Изменение заказа", Content = "Вы действительно хотите изменить бронь?", OkButtonContent = "Да", CancelButtonContent = "Нет", Closed = (s, e) => { if (e.DialogResult == null || !(bool) e.DialogResult) { UpdateOrders(); return; } UpdateOrder(appointmentEditedEventArgs.Appointment); } }); }
void Scheduler_AppointmentEdited(object sender, AppointmentEditedEventArgs e) { var editApp = e.Appointment as Appointment; SqlAppointment sqlAppointmentToEdit = domainContext.SqlAppointments.Single(a => a.Id.ToString().Equals(editApp.UniqueId)); sqlAppointmentToEdit.Start = editApp.Start; sqlAppointmentToEdit.End = editApp.End; sqlAppointmentToEdit.Subject = editApp.Subject; sqlAppointmentToEdit.Body = editApp.Body; sqlAppointmentToEdit.Location = editApp.Location; sqlAppointmentToEdit.IsAllDayEvent = editApp.IsAllDayEvent; sqlAppointmentToEdit.Url = editApp.Url; sqlAppointmentToEdit.Importance = editApp.Importance.ToString(); sqlAppointmentToEdit.TimeMarker = editApp.TimeMarker.ToString(); // set the RecurrencePattern and reset the exceptions if (editApp.IsRecurring()) { sqlAppointmentToEdit.RecurrencePattern = RecurrencePatternHelper.RecurrencePatternToString(editApp.RecurrenceRule.Pattern); if (editApp.RecurrenceRule.Exceptions.Count() == 0) { foreach (var exception in sqlAppointmentToEdit.SqlAppointments1) { this.domainContext.SqlAppointments.Remove(exception); } } } else { // first delete all cascading exception appointments foreach (var exception in sqlAppointmentToEdit.SqlAppointments1) { this.domainContext.SqlAppointments.Remove(exception); } sqlAppointmentToEdit.RecurrencePattern = null; } // Add new resources foreach (Telerik.Windows.Controls.Resource resource in editApp.Resources) { if (sqlAppointmentToEdit.AppointmentResources.Count(ar => ar.Resource.Name == resource.ResourceName) == 0) { AppointmentResource appResource = new AppointmentResource(); appResource.Id = -1; appResource.SqlAppointments = sqlAppointmentToEdit; appResource.Resource = this.domainContext.Resources.Single(r => r.Name == resource.ResourceName); sqlAppointmentToEdit.AppointmentResources.Add(appResource); if (appResource.Resource.ResourceTypes.Name == "Team") editApp.Category = CategoryHelper.MakeCategory(appResource.Resource.Color); } } // Remove old resources foreach (AppointmentResource appointmentResource in sqlAppointmentToEdit.AppointmentResources) { if (editApp.Resources.Count(r => r.ResourceName == appointmentResource.Resource.Name) == 0) { this.domainContext.AppointmentResources.Remove(appointmentResource); } } domainContext.SubmitChanges(); }