private void AppendDocuments() { OpenFileDialog openFileDialog = new OpenFileDialog { Title = "Select a picture", Filter = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png" }; ; if (openFileDialog.ShowDialog() == true) { try { OrderItemReport oir = new OrderItemReport() { //Comment = "Kommentar kksksksksk", //Id = 59, OrderItemId = SelectedDetailed.OrderItemId, ReportDate = new DateTime(), Appendix = new List <OrderItemReportAppendix>() { new OrderItemReportAppendix() { //Id = 10, //OrderItemReportId = 50, Picture = ImageConverter.ImageToByteArray(new BitmapImage(new Uri(openFileDialog.FileName, UriKind.Absolute))) } } }; SelectedDetailed.OrderItemReports.Add(oir); Dp.AddOrderItemReport(oir); //if(Dp.AddOrderItemReport(oir)) // MessageBox.Show("Update erfolgreich!", "Info", MessageBoxButton.OK, MessageBoxImage.Information); //else // MessageBox.Show("Update fehlgeschlagen", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); if (Dp.UpdateOrderItemData(SelectedDetailed)) { MessageBox.Show("Update erfolgreich!", "Info", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Update fehlgeschlagen", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception e) { MessageBox.Show("Laden des Bildes fehlgeschlagen!\n" + e.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void ApplyChanges() { if (Status.Equals(AllStatuses[3])) { if (MessageBox.Show("Wollen Sie den Auftrag wirklich ablehnen?", "Auftrag ablehnen?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No) { return; } } //OS.AddittionalCost = AddittionalCost; SelectedDetailed.AddittionalCost = AddittionalCost; SelectedDetailed.Finalprice = Finalprice; SelectedDetailed.IsAllInclusive = IsAllInclusive; //SelectedDetailed.IsConfirmed = IsConfirmed; //SelectedDetailed.IsFinished = IsFinished; SelectedDetailed.IsConfirmed = GetConfirmStatus(Status); SelectedDetailed.IsFinished = GetFinishedStatus(Status); SelectedDetailed.PreferedDate = PreferedDate; SelectedDetailed.ServiceProviderComment = ServiceProviderComment; if (IsConfirmed != null && IsConfirmed != "x" && PreferedDate < DateTime.Now) { msg.Send <GenericMessage <string> >(new GenericMessage <string>("past")); } else if (IsConfirmed != null && IsConfirmed != "x" && PreferedDate > DateTime.Now) { msg.Send <GenericMessage <string> >(new GenericMessage <string>("future")); } else { msg.Send <GenericMessage <string> >(new GenericMessage <string>("denied")); } if (Dp.UpdateOrderItemData(SelectedDetailed)) { MessageBox.Show("Update erfolgreich!", "Info", MessageBoxButton.OK, MessageBoxImage.Information); RaisePropertyChanged(nameof(PreferedDate)); //so that the PreferedDate in the DetailView gets actually updated once it's sent to the DB } else { MessageBox.Show("Update fehlgeschlagen", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void ApplyChanges() { if (Status.Equals(AllStatuses[3])) { if (MessageBox.Show("Wollen Sie den Auftrag wirklich ablehnen?", "Auftrag ablehnen?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No) { return; } } SelectedDetailed.AddittionalCost = AddittionalCost; SelectedDetailed.Finalprice = Finalprice; SelectedDetailed.IsAllInclusive = IsAllInclusive; SelectedDetailed.IsConfirmed = GetConfirmStatus(Status); SelectedDetailed.IsFinished = GetFinishedStatus(Status); //SelectedDetailed.PreferedDate = PreferedDate; SelectedDetailed.PreferedDate = SelectedDetailed.PreferedDate + TimeSpan.ParseExact(preferedDateTime, "g", CultureInfo.CurrentCulture); SelectedDetailed.ServiceProviderComment = ServiceProviderComment; if (IsConfirmed != null && IsConfirmed != "x" && SelectedDetailed.PreferedDate < DateTime.Now) msg.Send(new GenericMessage<string>("past")); else if (IsConfirmed != null && IsConfirmed != "x" && SelectedDetailed.PreferedDate > DateTime.Now) msg.Send(new GenericMessage<string>("future")); else msg.Send(new GenericMessage<string>("denied")); if (Dp.UpdateOrderItemData(SelectedDetailed)) { MessageBox.Show("Update erfolgreich!", "Info", MessageBoxButton.OK, MessageBoxImage.Information); RaisePropertyChanged(nameof(PreferedDate)); //so that the PreferedDate in the DetailView gets actually updated once it's sent to the DB msg.Send(new GenericMessage<string>("update")); //Damit die Auswertung der Firmendaten mitbekommt, dass es eine Ă„nderung gibt. } else MessageBox.Show("Update fehlgeschlagen", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); }