From b5989dfd72cc319dd0848500e70d89edab0d3cac Mon Sep 17 00:00:00 2001 From: staccatomamba Date: Mon, 28 Aug 2017 16:41:19 +0200 Subject: [PATCH] push test --- BeWo/BeWo.csproj | 5 +- BeWo/Core/BeWoUtils.cs | 237 +++++++--- BeWo/Scheduler/ISchedulerViewModel.cs | 2 +- BeWo/Scheduler/View/NewSchedulerView.xaml | 10 +- BeWo/Scheduler/View/NewSchedulerView.xaml.cs | 26 +- BeWo/Scheduler/View/RequestAnswerView.xaml.cs | 1 - .../View/SchedulerAppointmentEditForm.xaml.cs | 21 +- .../ViewModel/NewSchedulerViewModel.cs | 53 ++- .../ViewModel/SchedulerAppointmentListVM.cs | 113 +++-- .../ViewModel/SchedulerAppointmentVM.cs | 120 ++++- BeWo/ServiceProxy/Generated.cs | 10 + BeWo/View/BargeldkassenView.xaml.cs | 4 +- .../Detail/Report/ServicesReportView.xaml | 197 ++++---- .../Detail/Report/ServicesReportView.xaml.cs | 102 ++-- BeWo/View/Detail/ServiceRecordView2.xaml.cs | 3 +- Data/Access/SearchDAO.cs | 4 +- ..._15_02_2017.txt => Changes_2017_02_15.txt} | 0 Model/Changes_2017_08_09.txt | 2 +- ...DailyAppointmentReportKalender.Designer.cs | 435 +++++++++--------- Report/Properties/licenses.licx | 2 +- Report/ReportObjects/KalenderRO.cs | 4 +- .../ResourceServiceImp.cs | 3 +- 22 files changed, 825 insertions(+), 529 deletions(-) rename Model/{Changes_15_02_2017.txt => Changes_2017_02_15.txt} (100%) diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index f5eeb5320..eb152e13b 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -105,6 +105,7 @@ + @@ -1348,7 +1349,7 @@ MSBuild:Compile Designer - + MSBuild:Compile Designer MSBuild:Compile @@ -1763,7 +1764,7 @@ PercentageDisplay.xaml - + SchulbegleitenderDienst.xaml diff --git a/BeWo/Core/BeWoUtils.cs b/BeWo/Core/BeWoUtils.cs index 450a01ae2..4dcd6c97a 100644 --- a/BeWo/Core/BeWoUtils.cs +++ b/BeWo/Core/BeWoUtils.cs @@ -5,14 +5,12 @@ using System.ComponentModel; using System.Drawing; using System.IO; using System.Linq; -using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Forms; -using System.Windows.Forms.VisualStyles; using System.Windows.Input; using System.Windows.Media.Imaging; using BS.Shared; @@ -46,6 +44,8 @@ using MessageBox = System.Windows.MessageBox; using Panel = System.Windows.Controls.Panel; using System.Windows.Media; using DevExpress.Xpf.Bars; +using DevExpress.Xpf.DocumentViewer; +using DevExpress.Xpf.Printing.PreviewControl.Bars; namespace BeWo.Core { @@ -113,7 +113,7 @@ namespace BeWo.Core } catch (Exception) { - var msg = System.Text.Encoding.ASCII.GetString(ms.ToArray()); + var msg = Encoding.ASCII.GetString(ms.ToArray()); MessageBox.Show("Beim Öffnen der Druckvorschau ist leider ein Fehler aufgetreten!\n\n" + msg, "Fehler", MessageBoxButton.OK, MessageBoxImage.Exclamation); } @@ -128,7 +128,10 @@ namespace BeWo.Core BeWoWindow window = null; var dp = documentPreview; - if (dp == null) + + //DocumentPreviewControl dp = null + + if (dp == null) { dp = new DocumentPreview(); window = new BeWoWindow {GroupBoxContent = dp, Owner = BeWoApp.CurrentBeWo.MainWindow}; @@ -138,23 +141,23 @@ namespace BeWo.Core // ReportPreviewModelLandscapeBugWorkaround statt des XtraReportPreviewModels wegen des Landscape-Bugs dp.Model = new ReportPreviewModelLandscapeBugWorkaround(report); ThemeManager.SetTheme(dp, Theme.Office2007Black); - - dp.BarManager.Loaded += delegate - { - dp.BarManager.Items["documentMap"].IsVisible = false; - dp.BarManager.Items["open"].IsVisible = false; - dp.BarManager.Items["email"].IsVisible = false; - dp.BarManager.Items["watermark"].IsVisible = false; - dp.BarManager.Items["pageSetup"].IsVisible = false; - dp.BarManager.Items["scaling"].IsVisible = false; - dp.BarManager.Items["save"].IsVisible = false; - dp.BarManager.Items["printDirect"].IsVisible = false; - dp.BarManager.Items["exportText"].IsVisible = false; - dp.BarManager.Items["exportCSV"].IsVisible = false; - dp.BarManager.Items["exportMHT"].IsVisible = false; - dp.BarManager.Items["exportXPS"].IsVisible = false; - var item = dp.BarManager.Items["exportRTF"]; - }; + + //dp.BarManager.Loaded += delegate + //{ + // dp.BarManager.Items["documentMap"].IsVisible = false; + // dp.BarManager.Items["open"].IsVisible = false; + // dp.BarManager.Items["email"].IsVisible = false; + // dp.BarManager.Items["watermark"].IsVisible = false; + // dp.BarManager.Items["pageSetup"].IsVisible = false; + // dp.BarManager.Items["scaling"].IsVisible = false; + // dp.BarManager.Items["save"].IsVisible = false; + // dp.BarManager.Items["printDirect"].IsVisible = false; + // dp.BarManager.Items["exportText"].IsVisible = false; + // dp.BarManager.Items["exportCSV"].IsVisible = false; + // dp.BarManager.Items["exportMHT"].IsVisible = false; + // dp.BarManager.Items["exportXPS"].IsVisible = false; + // var item = dp.BarManager.Items["exportRTF"]; + //}; if (window != null) { window.rootGroupBox.Header = String.IsNullOrEmpty(title) ? "Druckvorschau" : title; @@ -168,7 +171,120 @@ namespace BeWo.Core })); } - public static void StartGetReportStreamAsync(Func func, String param, Action callback) + + + + public static void NavigateToReportUriWithDocumentPreviewControl(string navigateUriString, string title, DocumentPreviewControl dp) + { + BeWoApp.MainControl.StartWaiting(); + + StartGetReportStreamAsync(GetReportStreamForWPFControl, navigateUriString, ms => BeWoApp.MainControl.Dispatch(delegate + { + var report = new XtraReport(); + try + { + report.PrintingSystem.LoadDocument(ms); + } + catch(Exception) + { + var msg = Encoding.ASCII.GetString(ms.ToArray()); + + MessageBox.Show("Beim Öffnen der Druckvorschau ist leider ein Fehler aufgetreten!\n\n" + msg, "Fehler", MessageBoxButton.OK, MessageBoxImage.Exclamation); + } + + ms.Close(); + ms.Dispose(); + + report.DefaultPrinterSettingsUsing.UseLandscape = BeWoApp.AppSettings.PrinterSettingsUseLandscape; + report.DefaultPrinterSettingsUsing.UseMargins = BeWoApp.AppSettings.PrinterSettingsUseMargins; + report.DefaultPrinterSettingsUsing.UsePaperKind = BeWoApp.AppSettings.PrinterSettingsUsePaperKind; + + BeWoWindow window = null; + dp = null; + + if(dp == null) + { + dp = new DocumentPreviewControl(); + window = new BeWoWindow { GroupBoxContent = dp, Owner = BeWoApp.CurrentBeWo.MainWindow }; + ThemeManager.SetTheme(window, Theme.Office2010Black); + } + + // ReportPreviewModelLandscapeBugWorkaround statt des XtraReportPreviewModels wegen des Landscape-Bugs + //dp.Model = new ReportPreviewModelLandscapeBugWorkaround(report); + + + dp.CommandBarStyle = CommandBarStyle.Bars; + + dp.Loaded += CustomizeReportPreviewToolBar; + + ThemeManager.SetTheme(dp, Theme.Office2007Black); + + dp.Visibility = Visibility.Visible; + + report.CreateDocument(); + + dp.DocumentSource = report; + + if(window != null) + { + window.rootGroupBox.Header = String.IsNullOrEmpty(title) ? "Druckvorschau" : title; + window.Title = "Druckvorschau"; + window.Show(); + } + + BeWoApp.MainControl.EndWaiting(); + })); + } + + + private static void CustomizeReportPreviewToolBar(object s, RoutedEventArgs e) + { + var cont = LayoutHelper.FindElementByType(s as FrameworkElement, typeof(BarContainerControl)) as BarContainerControl; + var toolbar = cont.Bars.First() as ToolBarControl; + + foreach(var item in toolbar.Items) + { + if(item.GetType() == typeof(OpenDocumentBarItem) || + item.GetType() == typeof(DocumentMapBarCheckItem) || + item.GetType() == typeof(WatermarkBarItem) || + item.GetType() == typeof(ScaleBarItem) || + item.GetType() == typeof(PrintDirectBarItem) || + item.GetType() == typeof(PageSetupBarItem) || + item.GetType() == typeof(SaveBarItem) || + item.GetType() == typeof(SendSplitItem) || + item.GetType() == typeof(ParametersBarCheckItem) || + item.GetType() == typeof(ThumbnailsBarCheckItem) || + item.GetType() == typeof(EditingFieldsBarCheckItem)) + { + item.SetPropertyValue("IsVisible", false); + } + + if(item.GetType() == typeof(ExportSplitItem)) + { + var exportSplitItem = item as ExportSplitItem; + var popupMenu = (PopupMenu) exportSplitItem.PopupControl; + foreach(var link in popupMenu.Items) + { + var bbi = (BarButtonItem) link; + + switch(bbi.BarItemName) + { + case "bExportMht": + bbi.IsVisible = false; + break; + case "bExportCsv": + bbi.IsVisible = false; + break; + case "bExportTxt": + bbi.IsVisible = false; + break; + } + } + } + } + } + + public static void StartGetReportStreamAsync(Func func, string param, Action callback) { func.BeginInvoke(param, cb => @@ -1792,7 +1908,7 @@ namespace BeWo.Core /// Documentpreview für den Report /// Dictionary mit Variablen für das ReportObject /// Der Typ des Reports (z.B. KalenderMonatsformatReport) - public static void ShowReport(string title, DocumentPreview documentPreview, Dictionary variablen, ReportEnum reportType) + public static void ShowReport(string title, Dictionary variablen, ReportEnum reportType) { switch (reportType) { @@ -1803,8 +1919,8 @@ namespace BeWo.Core var serienTermine = (List)variablen["serienTermine"]; var mehrtaegigeTermine = (List)variablen["mehrtaegigeTermine"]; - ServiceFacade.DoReportServiceAsync(strom => strom.CreateKalenderReport(appointmentIds, employeeOid, serienTermine, selectedDays, mehrtaegigeTermine), - ms => BeWoApp.MainControl.Dispatch(() => ShowReportWindow(ms, documentPreview, title))); + ServiceFacade.DoReportServiceAsync(strom => strom.CreateKalenderReport(appointmentIds, employeeOid, serienTermine, selectedDays, mehrtaegigeTermine), ms => BeWoApp.MainControl.Dispatch(() => ShowReportWindow(ms, title))); + break; case ReportEnum.KassenbuchReportEnum: var zeitraum = (DateTime) variablen["zeitraum"]; @@ -1813,11 +1929,8 @@ namespace BeWo.Core var endzeitraum = (DateTime)variablen["endzeitraum"]; var kasse = (BargeldkassenDC) variablen["bargeldkasse"]; - - ServiceFacade.DoReportServiceAsync(strom => strom.CreateKassenbuchReportImZeitraum(zeitraum,endzeitraum, kasse, objectOid, objectTid), ms => BeWoApp.MainControl.Dispatch(() => ShowReportWindow(ms, documentPreview, title))); - - + ServiceFacade.DoReportServiceAsync(strom => strom.CreateKassenbuchReportImZeitraum(zeitraum,endzeitraum, kasse, objectOid, objectTid), ms => BeWoApp.MainControl.Dispatch(() => ShowReportWindow(ms, title))); break; case ReportEnum.ZahlungsbelegEnum: @@ -1825,32 +1938,27 @@ namespace BeWo.Core var objectOid2 = Convert.ToInt64(variablen["objectoid"]); var objectTid2 = (TableID) Enum.Parse(typeof(TableID), variablen["objecttid"].ToString()); - ServiceFacade.DoReportServiceAsync(strom => strom.CreateKassenbelegReport(transaktion, objectOid2, objectTid2), ms => BeWoApp.MainControl.Dispatch(() => ShowReportWindow(ms, documentPreview, title))); + ServiceFacade.DoReportServiceAsync(strom => strom.CreateKassenbelegReport(transaktion, objectOid2, objectTid2), ms => BeWoApp.MainControl.Dispatch(() => ShowReportWindow(ms, title))); break; } } - public static void ShowReportWindow(MemoryStream ms, DocumentPreview documentPreview, String title) + public static void ShowReportWindow(MemoryStream ms, string title) { var report = new XtraReport(); + try { - var scrollablePageView = (IScrollInfo)LayoutHelper.FindElement(documentPreview, - p => p.GetType() == typeof(DevExpress.Xpf.Printing.Native.ScrollablePageView - )); - if (scrollablePageView != null) - scrollablePageView.PageUp(); report.PrintingSystem.LoadDocument(ms); - } catch (Exception) { - var msg = System.Text.Encoding.ASCII.GetString(ms.ToArray()); + var msg = Encoding.ASCII.GetString(ms.ToArray()); - MessageBox.Show("Beim Öffnen der Druckvorschau ist leider ein Fehler aufgetreten!\n\n" + msg, "Fehler", - MessageBoxButton.OK, MessageBoxImage.Exclamation); + MessageBox.Show("Beim Öffnen der Druckvorschau ist leider ein Fehler aufgetreten!\n\n" + msg, "Fehler", MessageBoxButton.OK, MessageBoxImage.Exclamation); } + ms.Close(); ms.Dispose(); @@ -1858,47 +1966,28 @@ namespace BeWo.Core report.DefaultPrinterSettingsUsing.UseMargins = BeWoApp.AppSettings.PrinterSettingsUseMargins; report.DefaultPrinterSettingsUsing.UsePaperKind = BeWoApp.AppSettings.PrinterSettingsUsePaperKind; - BeWoWindow window = null; + var dp = new DocumentPreviewControl(); + var window = new BeWoWindow { GroupBoxContent = dp, Owner = BeWoApp.CurrentBeWo.MainWindow }; + + ThemeManager.SetTheme(window, Theme.Office2010Black); + + dp.DocumentSource = report; + + dp.CommandBarStyle = CommandBarStyle.Bars; + + dp.Loaded += CustomizeReportPreviewToolBar; - DocumentPreview dp = documentPreview; - if (dp == null) - { - dp = new DocumentPreview(); - window = new BeWoWindow { GroupBoxContent = dp, Owner = BeWoApp.CurrentBeWo.MainWindow }; - ThemeManager.SetTheme(window, Theme.Office2010Black); - } - dp.Model = new ReportPreviewModelLandscapeBugWorkaround(report); ThemeManager.SetTheme(dp, Theme.Office2007Black); - dp.BarManager.Loaded += delegate - { - dp.BarManager.Items["documentMap"].IsVisible = false; - dp.BarManager.Items["open"].IsVisible = false; - dp.BarManager.Items["email"].IsVisible = false; - dp.BarManager.Items["watermark"].IsVisible = false; - dp.BarManager.Items["pageSetup"].IsVisible = false; - dp.BarManager.Items["scaling"].IsVisible = false; - dp.BarManager.Items["save"].IsVisible = false; - dp.BarManager.Items["printDirect"].IsVisible = false; - dp.BarManager.Items["exportText"].IsVisible = false; - dp.BarManager.Items["exportCSV"].IsVisible = false; - dp.BarManager.Items["exportMHT"].IsVisible = false; - dp.BarManager.Items["exportXPS"].IsVisible = false; - var item = dp.BarManager.Items["exportRTF"]; - }; - if (window != null) - { - window.rootGroupBox.Header = String.IsNullOrEmpty(title) ? "Druckvorschau" : title; - window.Title = "Druckvorschau"; - window.Show(); - } + window.rootGroupBox.Header = String.IsNullOrEmpty(title) ? "Druckvorschau" : title; + window.Title = "Druckvorschau"; + window.Show(); dp.Visibility = Visibility.Visible; BeWoApp.MainControl.EndWaiting(); } - public static PasswortSecurityStrength CheckPasswordSecurity(string paswd) { string zahlen = "0123456789"; @@ -1967,7 +2056,6 @@ namespace BeWo.Core } } - public static void ShowImageForm(ImageSource source) { @@ -2017,7 +2105,6 @@ namespace BeWo.Core public static void CreateZeiterfassung(DateTime start, DateTime end, List customer, List employees, String notice) { - if (customer.Count == 0) { @@ -2049,7 +2136,5 @@ namespace BeWo.Core } } - } - } diff --git a/BeWo/Scheduler/ISchedulerViewModel.cs b/BeWo/Scheduler/ISchedulerViewModel.cs index e10bc2194..de7395a12 100644 --- a/BeWo/Scheduler/ISchedulerViewModel.cs +++ b/BeWo/Scheduler/ISchedulerViewModel.cs @@ -37,7 +37,7 @@ namespace BeWo.Scheduler void InitNewAppointment(Appointment appointment); - bool HideAppointment(string filterCategory, object selectedObject, Appointment appointment, bool showPrivateAppointments); + bool HideAppointment(string filterCategory, object selectedObject, Appointment appointment, bool showPrivateAppointments, bool showAbsenceTimes); void InitChangedOccurrencyCustomFields(IEnumerable appList); } diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml b/BeWo/Scheduler/View/NewSchedulerView.xaml index 0b04f05f2..a1c104fe6 100644 --- a/BeWo/Scheduler/View/NewSchedulerView.xaml +++ b/BeWo/Scheduler/View/NewSchedulerView.xaml @@ -345,16 +345,16 @@ - - + + - - + + @@ -649,7 +649,7 @@ Unchecked="MitarbeiterfarbenEinAusCheckBox_OnChecked" IsChecked="{Binding Path=IsEmployeeBrushVisible, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type view:NewSchedulerView}}, Mode=TwoWay}" /> diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs index 77c9f9c10..939ca64f0 100644 --- a/BeWo/Scheduler/View/NewSchedulerView.xaml.cs +++ b/BeWo/Scheduler/View/NewSchedulerView.xaml.cs @@ -685,7 +685,9 @@ namespace BeWo.Scheduler.View SelectedResources = cb.IsChecked.Value ? new List(AllResources) : new List(); if (CheckBoxConverter != null && SelectedResources != null) - CheckBoxConverter.SelektierteRessourcen = SelectedResources; + { + CheckBoxConverter.SelektierteRessourcen = SelectedResources; + } Scheduler.ActiveView.LayoutChanged(); } @@ -911,7 +913,7 @@ namespace BeWo.Scheduler.View if (showOnlyPrivateApps) { - e.Cancel = ViewModel.ActiveAppointmentViewModel.HideAppointment("NurPrivate", null, ((Appointment) e.Object), true); + e.Cancel = ViewModel.ActiveAppointmentViewModel.HideAppointment("NurPrivate", null, (Appointment) e.Object, true, IsAbsenceTimeVisible); } var me = MitarbeiterEbenenCheckBox.IsChecked.HasValue && MitarbeiterEbenenCheckBox.IsChecked.Value; @@ -920,21 +922,21 @@ namespace BeWo.Scheduler.View if ((me || ke || re) && !SelectedItems.Any()) { - e.Cancel = ViewModel.ActiveAppointmentViewModel.HideAppointment("Ebenen", new List { me, re, ke }, ((Appointment)e.Object), showOnlyPrivateApps); + e.Cancel = ViewModel.ActiveAppointmentViewModel.HideAppointment("Ebenen", new List { me, re, ke }, (Appointment) e.Object, showOnlyPrivateApps, IsAbsenceTimeVisible); return; } var m = CheckBoxConverter.SelektierteMitarbeiter; var r = CheckBoxConverter.SelektierteRessourcen; var k = CheckBoxConverter.SelektierteKlienten; - ; + if ((m.Any() || r.Any() || k.Any()) && ZeigeNurMeineTermineCheckBox.IsChecked == false) { - e.Cancel = ViewModel.ActiveAppointmentViewModel.HideAppointment("NachAuswahl", new Dictionary { { "Mitarbeiter", m }, { "Ressourcen", r }, { "Klienten", k } }, ((Appointment)e.Object), showOnlyPrivateApps); + e.Cancel = ViewModel.ActiveAppointmentViewModel.HideAppointment("NachAuswahl", new Dictionary { { "Mitarbeiter", m }, { "Ressourcen", r }, { "Klienten", k } }, (Appointment) e.Object, showOnlyPrivateApps, IsAbsenceTimeVisible); return; } - e.Cancel = ViewModel.ActiveAppointmentViewModel.HideAppointment("NurEigene", new Dictionary { { "Mitarbeiter", m }, { "Ressourcen", r }, { "Klienten", k }, {"Teams", EmployeesTeams} }, ((Appointment)e.Object), showOnlyPrivateApps); + e.Cancel = ViewModel.ActiveAppointmentViewModel.HideAppointment("NurEigene", new Dictionary { { "Mitarbeiter", m }, { "Ressourcen", r }, { "Klienten", k }, {"Teams", EmployeesTeams} }, (Appointment) e.Object, showOnlyPrivateApps, IsAbsenceTimeVisible); } private void NewSchedulerStorage_AppointmentDeleting(object sender, PersistentObjectCancelEventArgs e) @@ -1061,10 +1063,15 @@ namespace BeWo.Scheduler.View private void AllowAppointmentAenderung(object sender, AppointmentOperationEventArgs e) { - var darfTerminDetailsSehen = true; var appointment = e.Appointment; + if ((bool) appointment.CustomFields["IsAbsenceTime"]) + { + e.Allow = false; + return; + } + var ersteller = (CompactEmployeeDC) appointment.CustomFields["Originator"]; var mitarbeiterliste = (List)appointment.CustomFields["EmployeeList"]; @@ -1567,7 +1574,7 @@ namespace BeWo.Scheduler.View datesList.AddRange(range.Select(x => x.Start)); } - var apps = Scheduler.ActiveView.GetAppointments().ToList(); + var apps = Scheduler.ActiveView.GetAppointments().Where(w => w.CustomFields["IsAbsenceTime"] == null || (bool) w.CustomFields["IsAbsenceTime"] == false).ToList(); var appointmentOidListe = apps.Where(w => (!w.IsOccurrence && !w.IsRecurring) || w.IsException).Select(app => Convert.ToInt64(((SchedulerAppointmentVM) app.GetSourceObject(Scheduler.GetCoreStorage())).Id)).Distinct().ToList(); var serienTerminOids = apps.Where(w => w.IsRecurring || w.IsOccurrence).Select(app => Convert.ToInt64(((SchedulerAppointmentVM)app.RecurrencePattern.GetSourceObject(Scheduler.GetCoreStorage())).Id)).Distinct().ToList(); var serienTermine = new List(); @@ -1734,7 +1741,7 @@ namespace BeWo.Scheduler.View {"mehrtaegigeTermine", neueTermine} }; - BeWoUtils.ShowReport("Kalender", null, variablenDictionary, ReportEnum.KalenderMonatsReportEnum); + BeWoUtils.ShowReport("Kalender", variablenDictionary, ReportEnum.KalenderMonatsReportEnum); } public void PreselectCustomer(long pCustomerOid) @@ -1832,6 +1839,7 @@ namespace BeWo.Scheduler.View { var cb = (CheckBox) sender; IsAbsenceTimeVisible = cb.IsChecked ?? true; + Scheduler.ActiveView.LayoutChanged(); } } diff --git a/BeWo/Scheduler/View/RequestAnswerView.xaml.cs b/BeWo/Scheduler/View/RequestAnswerView.xaml.cs index 65ad28011..c834fa14c 100644 --- a/BeWo/Scheduler/View/RequestAnswerView.xaml.cs +++ b/BeWo/Scheduler/View/RequestAnswerView.xaml.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; -using System.Diagnostics; using System.Globalization; using System.Linq; using System.Windows; diff --git a/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml.cs b/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml.cs index 0f554a52f..2826d1ded 100644 --- a/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml.cs +++ b/BeWo/Scheduler/View/SchedulerAppointmentEditForm.xaml.cs @@ -101,8 +101,7 @@ namespace BeWo.Scheduler.View } } - public SchedulerAppointmentEditForm(SchedulerAppointmentListVM vm, SchedulerControl schedulerControl, Appointment appointment, - IEnumerable employees, IEnumerable customers, Dictionary> categoriesToResources) + public SchedulerAppointmentEditForm(SchedulerAppointmentListVM vm, SchedulerControl schedulerControl, Appointment appointment, IEnumerable employees, IEnumerable customers, Dictionary> categoriesToResources) : base(schedulerControl, appointment) { ViewModel = vm; @@ -145,13 +144,19 @@ namespace BeWo.Scheduler.View private void InitRights() { if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnlegen)) + { MitarbeiterPopUpOeffnenBtn.Visibility = Visibility.Collapsed; + } if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderKliententermineAnlegen)) + { KlientenPopUpOeffnenBtn.Visibility = Visibility.Collapsed; + } if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderRessourcentermineAnlegen)) + { RessourcenPopUpOeffnenBtn.Visibility = Visibility.Collapsed; + } var m = SelectedEmployees; var k = SelectedCustomers; @@ -162,15 +167,25 @@ namespace BeWo.Scheduler.View if (!NewSchedulerAppointmentFormController.Originator.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)) { if (m.Count > 0 && !BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAendern)) + { allowedToChange = false; + } + if (k.Count > 0 && !BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderKliententermineAendern)) + { allowedToChange = false; + } + if (r.Count > 0 && !BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderRessourcentermineAendern)) + { allowedToChange = false; + } } - if (allowedToChange) + if (allowedToChange) + { return; + } OKButton.Visibility = Visibility.Hidden; DeleteButton.Visibility = Visibility.Hidden; diff --git a/BeWo/Scheduler/ViewModel/NewSchedulerViewModel.cs b/BeWo/Scheduler/ViewModel/NewSchedulerViewModel.cs index cd191f93d..eb0ee0d1b 100644 --- a/BeWo/Scheduler/ViewModel/NewSchedulerViewModel.cs +++ b/BeWo/Scheduler/ViewModel/NewSchedulerViewModel.cs @@ -9,7 +9,7 @@ using BeWo.ServiceProxy; using BS.Shared; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; -using DevExpress.XtraPrinting.Native; +using DevExpress.DataProcessing; using DevExpress.XtraScheduler; namespace BeWo.Scheduler.ViewModel @@ -41,39 +41,40 @@ namespace BeWo.Scheduler.ViewModel } } - public void UpdateAppointmentViewModel(DateTime intervalStart, DateTime intervalEnd) + private List allEmployees = new List(); + + public void UpdateAppointmentViewModel(DateTime pIntervalStart, DateTime pIntervalEnd) { - if (!BeWoApp.LoggedOnEmployee.EmployeeOid.HasValue) + if(!BeWoApp.LoggedOnEmployee.EmployeeOid.HasValue) { return; } - - var allEmps = new List(); - var appointments = new List(); var allCust = new List(); var abwesenheiten = new List(); - allEmps = Cache.GetInstance().GetAllActiveEmployeesCompactSync(); + allEmployees = Cache.GetInstance().GetAllActiveEmployeesCompactSync(); - if (!BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen)) + if(!BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen)) { - ServiceFacade.DoEmployeeServiceSync(es => allEmps = new List { es.LoadCompactEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value) }); + ServiceFacade.DoEmployeeServiceSync(es => allEmployees = new List { es.LoadCompactEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value) }); } ServiceFacade.DoResourceServiceSync(s => mAllCats2ResInDic = s.GetAllCategories2ResourcesInDictionary()); - var start = intervalStart - NewSchedulerView.FetchPadding; - var end = intervalEnd + NewSchedulerView.FetchPadding; + var start = pIntervalStart - NewSchedulerView.FetchPadding; + var end = pIntervalEnd + NewSchedulerView.FetchPadding; ServiceFacade.DoResourceServiceSync(rs => appointments = rs.GetAllActiveAppointmentsForEmployeeInInterval2(start, end, BeWoApp.LoggedOnEmployee.EmployeeOid.Value, BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen))); - //ServiceFacade.DoResourceServiceSync(rs => abwesenheiten = rs.); + + ServiceFacade.DoResourceServiceSync(rs => abwesenheiten = rs.GetAllActiveAbsenceTimesInInterval(start, end, BeWoApp.LoggedOnEmployee.EmployeeOid.Value, BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen))); + allCust = Cache.GetInstance().GetAllActiveCustomersCompactSync(); - if (BeWoApp.LoggedOnUser.HasRight(UserRightType.Customer_ViewMyCustomers) && !BeWoApp.LoggedOnUser.HasRight(UserRightType.CustomerView_View)) + if(BeWoApp.LoggedOnUser.HasRight(UserRightType.Customer_ViewMyCustomers) && !BeWoApp.LoggedOnUser.HasRight(UserRightType.CustomerView_View)) { allCust = allCust.Where(c => BeWoApp.LoggedOnEmployee.RelatedCustomers.Any(a => a.Customer.Equals(c))).ToList(); } @@ -83,13 +84,13 @@ namespace BeWo.Scheduler.ViewModel BeWoApp.LoggedOnUser.HasRight(UserRightType.KalenderMitarbeitertermineAnsehen)) && (!w.EmployeeList.TrueForAll(e2a => e2a.ParticipationAnswer == ParticipationAnswer.Absage) || (w.EmployeeList == null || w.EmployeeList.Count == 0))); //###cb testen :w.EmployeeList.IsEmpty geht nicht mehr + var vm = new SchedulerAppointmentListVM(prefilteredAppointments.ToList(), allCust, allEmployees, mAllCats2ResInDic); + vm.VMList.AddRange(ConvertAbsenceTimesToAppointments(abwesenheiten, end)); - var vm = new SchedulerAppointmentListVM(prefilteredAppointments.ToList(), allCust, allEmps, mAllCats2ResInDic); - - ActiveAppointmentViewModel = vm; + ActiveAppointmentViewModel = vm; SchedulerSettings = GetActiveSettings(); - SchedulerSettings.StartDate = intervalStart; + SchedulerSettings.StartDate = pIntervalStart; } public AbstractAppointmentEditForm GetEditAppointmentForm(DevExpress.Xpf.Scheduler.SchedulerControl control, Appointment appointment) @@ -99,8 +100,10 @@ namespace BeWo.Scheduler.ViewModel internal void InitNewAppointment(Appointment appointment) { - if(ActiveAppointmentViewModel != null) - ActiveAppointmentViewModel.InitNewAppointment(appointment); + if(ActiveAppointmentViewModel != null) + { + ActiveAppointmentViewModel.InitNewAppointment(appointment); + } } public SchedulerSettings SchedulerSettings { get; set; } @@ -109,5 +112,17 @@ namespace BeWo.Scheduler.ViewModel { return ActiveAppointmentViewModel == null ? null : SchedulerSettings ?? ActiveAppointmentViewModel.GetDefaultSchedulerSettings(); } + + private IEnumerable ConvertAbsenceTimesToAppointments(IEnumerable pAbsenceTimes, DateTime pIntervalEnd) + { + var result = new List(); + + foreach(var abwesenheit in pAbsenceTimes) + { + result.Add(new SchedulerAppointmentVM(true, abwesenheit.Reason.Description, abwesenheit.Start.Value, abwesenheit.End ?? pIntervalEnd, allEmployees.FirstOrDefault(f => f.EmployeeOid == abwesenheit.EmployeeOid.Value))); + } + + return result; + } } } diff --git a/BeWo/Scheduler/ViewModel/SchedulerAppointmentListVM.cs b/BeWo/Scheduler/ViewModel/SchedulerAppointmentListVM.cs index 558e79dee..9430a7eba 100644 --- a/BeWo/Scheduler/ViewModel/SchedulerAppointmentListVM.cs +++ b/BeWo/Scheduler/ViewModel/SchedulerAppointmentListVM.cs @@ -26,11 +26,12 @@ namespace BeWo.Scheduler.ViewModel { public class SchedulerAppointmentListVM : AbstractDCListMapperVM, ISchedulerViewModel { - private const string CF_EMPLOYEELIST = "EmployeeList"; - private const string CF_CUSTOMERLIST = "CustomerList"; - private const string CF_RESOURCELIST = "ResourceList"; - private const string CF_ORIGINATOR = "Originator"; - private const string CF_ISPRIVATE = "IsPrivate"; + private const string CF_EMPLOYEELIST = "EmployeeList"; + private const string CF_CUSTOMERLIST = "CustomerList"; + private const string CF_RESOURCELIST = "ResourceList"; + private const string CF_ORIGINATOR = "Originator"; + private const string CF_ISPRIVATE = "IsPrivate"; + private const string CF_ISABSENCETIME = "IsAbsenceTime"; public bool ShouldLockOverlappingAppointmentCheck { get; set; } @@ -118,6 +119,7 @@ namespace BeWo.Scheduler.ViewModel item.CustomFields.Add(CF_RESOURCELIST, item.ResourceList); item.CustomFields.Add(CF_ORIGINATOR, item.Originator); item.CustomFields.Add(CF_ISPRIVATE, item.IsPrivate); + item.CustomFields.Add(CF_ISABSENCETIME, item.IsAbsenceTime); item.Id = item.DataContract.SchedulerAppointmentOid; @@ -127,7 +129,7 @@ namespace BeWo.Scheduler.ViewModel } item.Description = "Privater Termin"; - item.Subject = String.Format("Privat ({0})", item.Originator); + item.Subject = string.Format("Privat ({0})", item.Originator); } } @@ -288,33 +290,34 @@ namespace BeWo.Scheduler.ViewModel vm.Originator = app.CustomFields[CF_ORIGINATOR] as CompactEmployeeDC; vm.IsPrivate = app.CustomFields[CF_ISPRIVATE] != null && (bool) app.CustomFields[CF_ISPRIVATE]; - // Soll nicht mehr geschehen - //if (!vm.EmployeeList.Select(s => s.Employee).Contains(vm.Originator)) - // vm.EmployeeList.Add(new Employee2SchedulerAppointmentDC {Employee = vm.Originator, ParticipationAnswer = ParticipationAnswer.Zusage}); - - if (!vm.CustomFields.ContainsKey("EmployeeList")) + if (!vm.CustomFields.ContainsKey(CF_EMPLOYEELIST)) { - vm.CustomFields.Add("EmployeeList", vm.EmployeeList); + vm.CustomFields.Add(CF_EMPLOYEELIST, vm.EmployeeList); } - if (!vm.CustomFields.ContainsKey("CustomerList")) + if (!vm.CustomFields.ContainsKey(CF_CUSTOMERLIST)) { - vm.CustomFields.Add("CustomerList", vm.CustomerList); + vm.CustomFields.Add(CF_CUSTOMERLIST, vm.CustomerList); } - if (!vm.CustomFields.ContainsKey("ResourceList")) + if (!vm.CustomFields.ContainsKey(CF_RESOURCELIST)) { - vm.CustomFields.Add("ResourceList", vm.ResourceList); + vm.CustomFields.Add(CF_RESOURCELIST, vm.ResourceList); } - if (!vm.CustomFields.ContainsKey("Originator")) + if (!vm.CustomFields.ContainsKey(CF_ORIGINATOR)) { - vm.CustomFields.Add("Originator", vm.Originator); + vm.CustomFields.Add(CF_ORIGINATOR, vm.Originator); } - if (!vm.CustomFields.ContainsKey("IsPrivate")) + if (!vm.CustomFields.ContainsKey(CF_ISPRIVATE)) { - vm.CustomFields.Add("IsPrivate", vm.IsPrivate); + vm.CustomFields.Add(CF_ISPRIVATE, vm.IsPrivate); + } + + if(!vm.CustomFields.ContainsKey(CF_ISABSENCETIME)) + { + vm.CustomFields.Add(CF_ISABSENCETIME, vm.IsAbsenceTime); } if (vm.CommitToDataContract() != null && vm.CommitToDataContract().SchedulerAppointmentOid.HasValue && vm.EmployeeList != null && vm.EmployeeList.Count > 0) @@ -350,11 +353,12 @@ namespace BeWo.Scheduler.ViewModel { if (app.Type.Equals(AppointmentType.ChangedOccurrence)) { - app.CustomFields["EmployeeList"] = changedOccurencyCustomFields[id][index]["EmployeeList"]; - app.CustomFields["CustomerList"] = changedOccurencyCustomFields[id][index]["CustomerList"]; - app.CustomFields["ResourceList"] = changedOccurencyCustomFields[id][index]["ResourceList"]; - app.CustomFields["Originator"] = changedOccurencyCustomFields[id][index]["Originator"]; - app.CustomFields["IsPrivate"] = changedOccurencyCustomFields[id][index]["IsPrivate"]; + app.CustomFields[CF_EMPLOYEELIST] = changedOccurencyCustomFields[id][index][CF_EMPLOYEELIST]; + app.CustomFields[CF_CUSTOMERLIST] = changedOccurencyCustomFields[id][index][CF_CUSTOMERLIST]; + app.CustomFields[CF_RESOURCELIST] = changedOccurencyCustomFields[id][index][CF_RESOURCELIST]; + app.CustomFields[CF_ORIGINATOR] = changedOccurencyCustomFields[id][index][CF_ORIGINATOR]; + app.CustomFields[CF_ISPRIVATE] = changedOccurencyCustomFields[id][index][CF_ISPRIVATE]; + app.CustomFields[CF_ISABSENCETIME] = changedOccurencyCustomFields[id][index][CF_ISABSENCETIME]; } } } @@ -416,48 +420,62 @@ namespace BeWo.Scheduler.ViewModel public void AddCustomFieldsMapping(SchedulerStorage schedulerStorage) { - var employeeMapping = new SchedulerCustomFieldMapping(CF_EMPLOYEELIST, CF_EMPLOYEELIST); - var customerMapping = new SchedulerCustomFieldMapping(CF_CUSTOMERLIST, CF_CUSTOMERLIST); - var resourceMapping = new SchedulerCustomFieldMapping(CF_RESOURCELIST, CF_RESOURCELIST); - var originatorMapping = new SchedulerCustomFieldMapping(CF_ORIGINATOR, CF_ORIGINATOR); - var isPrivateMapping = new SchedulerCustomFieldMapping(CF_ISPRIVATE, CF_ISPRIVATE); + var employeeMapping = new SchedulerCustomFieldMapping(CF_EMPLOYEELIST, CF_EMPLOYEELIST); + var customerMapping = new SchedulerCustomFieldMapping(CF_CUSTOMERLIST, CF_CUSTOMERLIST); + var resourceMapping = new SchedulerCustomFieldMapping(CF_RESOURCELIST, CF_RESOURCELIST); + var originatorMapping = new SchedulerCustomFieldMapping(CF_ORIGINATOR, CF_ORIGINATOR); + var isPrivateMapping = new SchedulerCustomFieldMapping(CF_ISPRIVATE, CF_ISPRIVATE); + var isAbsenceTimeMapping = new SchedulerCustomFieldMapping(CF_ISABSENCETIME, CF_ISABSENCETIME); schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(employeeMapping); schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(customerMapping); schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(resourceMapping); schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(originatorMapping); schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(isPrivateMapping); + schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(isAbsenceTimeMapping); } public void InitNewAppointment(Appointment appointment) { - appointment.CustomFields[CF_CUSTOMERLIST] = new List(); - appointment.CustomFields[CF_EMPLOYEELIST] = new List(); - appointment.CustomFields[CF_RESOURCELIST] = new List(); + appointment.CustomFields[CF_CUSTOMERLIST] = new List(); + appointment.CustomFields[CF_EMPLOYEELIST] = new List(); + appointment.CustomFields[CF_RESOURCELIST] = new List(); ServiceFacade.DoEmployeeServiceSync(s => appointment.CustomFields[CF_ORIGINATOR] = s.LoadCompactEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value)); - appointment.CustomFields[CF_ISPRIVATE] = false; - appointment.StatusId = 0; + appointment.CustomFields[CF_ISPRIVATE] = false; + appointment.CustomFields[CF_ISABSENCETIME] = false; + appointment.StatusId = 0; } - public bool HideAppointment(string filterCategory, object selectedObject, Appointment appointment, bool showPrivateAppointments) + public bool HideAppointment(string filterCategory, object selectedObject, Appointment appointment, bool showPrivateAppointments, bool showAbsenceTimes) { var wirdAngezeigt = true; // -> wird standardmäßig angezeigt - bool isPrivate = false; - if (appointment.CustomFields["IsPrivate"] != null) + var isPrivate = false; + if (appointment.CustomFields[CF_ISPRIVATE] != null) { - isPrivate = Convert.ToBoolean(appointment.CustomFields["IsPrivate"]); + isPrivate = Convert.ToBoolean(appointment.CustomFields[CF_ISPRIVATE]); } - if (showPrivateAppointments && !isPrivate) + var isAbsenceTime = false; + if(appointment.CustomFields[CF_ISABSENCETIME] != null) + { + isAbsenceTime = Convert.ToBoolean(appointment.CustomFields[CF_ISABSENCETIME]); + } + + if(isAbsenceTime && !showPrivateAppointments && !showAbsenceTimes) + { + return !showAbsenceTimes; + } + + if(showPrivateAppointments && !isPrivate) { return true; } - var ersteller = (CompactEmployeeDC)appointment.CustomFields["Originator"]; - var employeeList = (List)appointment.CustomFields["EmployeeList"]; - var customerList = (List)appointment.CustomFields["CustomerList"]; - var resourceList = (List)appointment.CustomFields["ResourceList"]; + var ersteller = (CompactEmployeeDC)appointment.CustomFields[CF_ORIGINATOR]; + var employeeList = (List)appointment.CustomFields[CF_EMPLOYEELIST]; + var customerList = (List)appointment.CustomFields[CF_CUSTOMERLIST]; + var resourceList = (List)appointment.CustomFields[CF_RESOURCELIST]; if (isPrivate) { @@ -482,8 +500,6 @@ namespace BeWo.Scheduler.ViewModel var mitarbeiter = (List)dictionary["Mitarbeiter"]; var klienten = (List)dictionary["Klienten"]; - - var cfe = employeeList != null ? employeeList.Select(s => s.Employee).ToList() : new List(); var cfr = resourceList ?? new List(); var cfc = customerList ?? new List(); @@ -498,7 +514,7 @@ namespace BeWo.Scheduler.ViewModel break; case "Ebenen": var liste = (List)selectedObject; // mkr - var appEList = employeeList.Where(w => !w.Employee.Equals(appointment.CustomFields["Originator"])).ToList(); + var appEList = employeeList.Where(w => !w.Employee.Equals(appointment.CustomFields[CF_ORIGINATOR])).ToList(); // Ersteller und Rechte beachten @@ -528,7 +544,7 @@ namespace BeWo.Scheduler.ViewModel break; } - return !wirdAngezeigt; + return !wirdAngezeigt; } public void InitChangedOccurrencyCustomFields(IEnumerable appList) @@ -555,6 +571,7 @@ namespace BeWo.Scheduler.ViewModel customFieldCollection[CF_RESOURCELIST] = termin.ResourceList; customFieldCollection[CF_ORIGINATOR] = termin.Originator; customFieldCollection[CF_ISPRIVATE] = termin.IsPrivate; + customFieldCollection[CF_ISABSENCETIME] = false; //###Lyndon testen!!! //var id = app.RecurrenceInfo.Id; diff --git a/BeWo/Scheduler/ViewModel/SchedulerAppointmentVM.cs b/BeWo/Scheduler/ViewModel/SchedulerAppointmentVM.cs index fe2b213de..7e3e87fad 100644 --- a/BeWo/Scheduler/ViewModel/SchedulerAppointmentVM.cs +++ b/BeWo/Scheduler/ViewModel/SchedulerAppointmentVM.cs @@ -44,7 +44,6 @@ namespace BeWo.Scheduler.ViewModel private List _CustomerList; private List _ResourceList; private CompactEmployeeDC _Originator; - private bool _IsAbsenceTime; public object Id { get; set; } public int LabelId { get; set; } @@ -89,6 +88,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_End, value)) { _End = value; + + if (IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.EndDate, value), PropertyName_End); FirePropertyChanged(PropertyName_End); } @@ -102,6 +107,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_Start, value)) { _Start = value; + + if(IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.StartDate, value), PropertyName_Start); FirePropertyChanged(PropertyName_Start); } @@ -115,6 +126,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_AllDay, value)) { _AllDay = value; + + if(IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.AllDay, value), PropertyName_AllDay); FirePropertyChanged(PropertyName_AllDay); } @@ -128,6 +145,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_Subject, value)) { _Subject = value; + + if(IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.Subject, value), PropertyName_Subject); FirePropertyChanged(PropertyName_Subject); } @@ -141,6 +164,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_Location, value)) { _Location = value; + + if(IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.Location, value), PropertyName_Location); FirePropertyChanged(PropertyName_Location); } @@ -154,6 +183,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_Status, value)) { _Status = value; + + if(IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.Status, value), PropertyName_Status); FirePropertyChanged(PropertyName_Status); } @@ -167,6 +202,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_RecurrenceInfo, value)) { _RecurrenceInfo = value; + + if(IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.RecurrenceInfo, value), PropertyName_RecurrenceInfo); FirePropertyChanged(PropertyName_RecurrenceInfo); } @@ -180,6 +221,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_Description, value)) { _Description = value; + + if(IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.Description, value), PropertyName_Description); FirePropertyChanged(PropertyName_Description); } @@ -193,6 +240,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_EmployeeList, value)) { _EmployeeList = value; + + if(IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.EmployeeList, value), PropertyName_EmployeeList); FirePropertyChanged(PropertyName_EmployeeList); } @@ -206,6 +259,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_CustomerList, value)) { _CustomerList = value; + + if(IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.CustomerList, value), PropertyName_CustomerList); FirePropertyChanged(PropertyName_CustomerList); } @@ -219,6 +278,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_ResourceList, value)) { _ResourceList = value; + + if(IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.ResourceList, value), PropertyName_ResourceList); FirePropertyChanged(PropertyName_ResourceList); } @@ -232,6 +297,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_IsPrivate, value)) { _IsPrivate = value; + + if(IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.IsPrivate,value), PropertyName_IsPrivate); FirePropertyChanged(PropertyName_IsPrivate); } @@ -245,6 +316,12 @@ namespace BeWo.Scheduler.ViewModel if (AreDifferent(_Originator, value)) { _Originator = value; + + if(IsAbsenceTime) + { + return; + } + StoreDirtyInformation(AreDifferent(DataContract.Originator, value), PropertyName_Originator); FirePropertyChanged(PropertyName_Originator); } @@ -261,22 +338,33 @@ namespace BeWo.Scheduler.ViewModel set { } } - public virtual bool IsAbsenceTime - { - get { return _IsAbsenceTime; } - } + public virtual bool IsAbsenceTime { get; } public SchedulerAppointmentVM(SchedulerAppointmentDC pDC) : base(pDC, pDC.SchedulerAppointmentOid == null) {} + public SchedulerAppointmentVM(bool pAllDay, string pSubject, DateTime pStart, DateTime pEnd, CompactEmployeeDC pOriginator) + { + _AllDay = pAllDay; + _Subject = pSubject; + _Start = pStart; + _End = pEnd; + _Originator = pOriginator; + + IsAbsenceTime = true; + + UpdateCustomFields(); + } + public void UpdateCustomFields() { CustomFields = new Dictionary { - {"EmployeeList", EmployeeList}, - {"CustomerList", CustomerList}, - {"ResourceList", ResourceList}, - {"Originator", Originator}, - {"IsPrivate", IsPrivate} + {"EmployeeList", EmployeeList}, + {"CustomerList", CustomerList}, + {"ResourceList", ResourceList}, + {"Originator", Originator}, + {"IsPrivate", IsPrivate}, + {PropertyName_IsAbsenceTime, IsAbsenceTime} }; } @@ -394,5 +482,17 @@ namespace BeWo.Scheduler.ViewModel ? GetType().Name.GetHashCode() ^ DataContract.SchedulerAppointmentOid.Value.GetHashCode() : base.GetHashCode(); } + + public override bool IsDirty + { + get { return IsAbsenceTime ? false : base.IsDirty; } + } + + public new bool IsNew + { + get { return IsAbsenceTime ? false : base.IsNew; } + + set { base.IsNew = value; } + } } } diff --git a/BeWo/ServiceProxy/Generated.cs b/BeWo/ServiceProxy/Generated.cs index 2c5d12b5f..a591b22ea 100644 --- a/BeWo/ServiceProxy/Generated.cs +++ b/BeWo/ServiceProxy/Generated.cs @@ -3748,6 +3748,11 @@ namespace BeWo.ServiceProxy [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IResourceService/GetAllActiveAppointmentsForEmployeeInInterval" + "2BeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] System.Collections.Generic.List GetAllActiveAppointmentsForEmployeeInInterval2(System.DateTime start, System.DateTime end, long pEmployeeOid, bool pHasRightToSeeAllEmployeeAppointments); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IResourceService/GetAllActiveAbsenceTimesInInterval", ReplyAction="http://tempuri.org/IResourceService/GetAllActiveAbsenceTimesInIntervalResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IResourceService/GetAllActiveAbsenceTimesInIntervalBeWoFaultFa" + + "ult", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + System.Collections.Generic.List GetAllActiveAbsenceTimesInInterval(System.DateTime pStart, System.DateTime pEnd, long pEmployeeOid, bool pHasRightToSeeAllEmployeeAppointments); } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] @@ -3983,6 +3988,11 @@ namespace BeWo.ServiceProxy { return base.Channel.GetAllActiveAppointmentsForEmployeeInInterval2(start, end, pEmployeeOid, pHasRightToSeeAllEmployeeAppointments); } + + public System.Collections.Generic.List GetAllActiveAbsenceTimesInInterval(System.DateTime pStart, System.DateTime pEnd, long pEmployeeOid, bool pHasRightToSeeAllEmployeeAppointments) + { + return base.Channel.GetAllActiveAbsenceTimesInInterval(pStart, pEnd, pEmployeeOid, pHasRightToSeeAllEmployeeAppointments); + } } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] diff --git a/BeWo/View/BargeldkassenView.xaml.cs b/BeWo/View/BargeldkassenView.xaml.cs index e51c0dadd..3bd659f1b 100644 --- a/BeWo/View/BargeldkassenView.xaml.cs +++ b/BeWo/View/BargeldkassenView.xaml.cs @@ -270,7 +270,7 @@ namespace BeWo.View //var zeitraum = new DateTime(jahr, monat, 1); - BeWoUtils.ShowReport("Kassenbuch", null, new Dictionary { { "bargeldkasse", kasse }, { "zeitraum", startzeitraum.DateTime }, { "endzeitraum", endzeitraum.DateTime }, { "objectoid", kasse.ObjectOid }, { "objecttid", kasse.ObjectTid } }, ReportEnum.KassenbuchReportEnum); + BeWoUtils.ShowReport("Kassenbuch", new Dictionary { { "bargeldkasse", kasse }, { "zeitraum", startzeitraum.DateTime }, { "endzeitraum", endzeitraum.DateTime }, { "objectoid", kasse.ObjectOid }, { "objecttid", kasse.ObjectTid } }, ReportEnum.KassenbuchReportEnum); } private void ButtonBargeldtransaktionDeleteClick(object sender, RoutedEventArgs e) @@ -303,7 +303,7 @@ namespace BeWo.View var transaktion = control.GetCurrentValue().CommitToDataContract(); - BeWoUtils.ShowReport("Zahlungsbeleg", null, new Dictionary {{"transaktion", transaktion}, {"objectoid", kasse.ObjectOid}, {"objecttid", kasse.ObjectTid}}, ReportEnum.ZahlungsbelegEnum); + BeWoUtils.ShowReport("Zahlungsbeleg", new Dictionary {{"transaktion", transaktion}, {"objectoid", kasse.ObjectOid}, {"objecttid", kasse.ObjectTid}}, ReportEnum.ZahlungsbelegEnum); } private void ButtonAddBargeldkasseClick(object sender, RoutedEventArgs e) diff --git a/BeWo/View/Detail/Report/ServicesReportView.xaml b/BeWo/View/Detail/Report/ServicesReportView.xaml index c5a48b30f..f47bc0663 100644 --- a/BeWo/View/Detail/Report/ServicesReportView.xaml +++ b/BeWo/View/Detail/Report/ServicesReportView.xaml @@ -7,110 +7,131 @@ xmlns:dxp="http://schemas.devexpress.com/winfx/2008/xaml/printing" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" + xmlns:dxpbars="http://schemas.devexpress.com/winfx/2008/xaml/printing/bars" + xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True"> - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + +