From 165e59ae16a47faa6711f077356d8c0cd8270659 Mon Sep 17 00:00:00 2001 From: Marcel Hirschle Date: Tue, 9 Mar 2021 15:23:06 +0100 Subject: [PATCH] MH: Dienstplaner mit Funktionen erweitert --- BeWo/ServiceProxy/Generated.cs | 167 ++++++++------ BeWo/View/Controls/DPCtrlDay.cs | 20 ++ BeWo/View/Controls/DPCtrlDienstTooltip.xaml | 9 + .../View/Controls/DPCtrlDienstTooltip.xaml.cs | 1 + BeWo/View/Controls/DPCtrlEmployee.cs | 4 +- BeWo/View/Controls/DPCtrlMonth.cs | 8 +- BeWo/View/Detail/Report/DienstplanerView.xaml | 72 +++++-- .../Detail/Report/DienstplanerView.xaml.cs | 203 +++++++++++++++++- Data/Data.csproj | 2 + Data/Entities/Dienstvertretung.cs | 98 +++++++++ Data/Mappings/Dienstvertretung.hbm.xml | 24 +++ .../DienstvertretungDC_Dienstvertretung.cs | 49 +++++ Service/DCEntityMapper/MapperFactory.cs | 5 + .../Dienstplanung/DienstplanungsManager.cs | 111 +++++++++- Service/Plugins/PluginLoader.cs | 2 +- Service/Service.csproj | 1 + .../ServiceContracts/IOperationsService.cs | 17 ++ .../OperationsServiceImp.cs | 48 ++++- Shared/BeWoEntityEnums.cs | 3 +- Shared/DataContracts/DienstInfoDC.cs | 8 +- Shared/DataContracts/DienstZeileDC.cs | 14 +- Shared/DataContracts/DienstvertretungDC.cs | 53 +++++ Shared/DataContracts/EmployeeDC.cs | 6 + Shared/Shared.csproj | 1 + 24 files changed, 825 insertions(+), 101 deletions(-) create mode 100644 Data/Entities/Dienstvertretung.cs create mode 100644 Data/Mappings/Dienstvertretung.hbm.xml create mode 100644 Service/DCEntityMapper/DienstvertretungDC_Dienstvertretung.cs create mode 100644 Shared/DataContracts/DienstvertretungDC.cs diff --git a/BeWo/ServiceProxy/Generated.cs b/BeWo/ServiceProxy/Generated.cs index ce89e2af0..84d8e7c34 100644 --- a/BeWo/ServiceProxy/Generated.cs +++ b/BeWo/ServiceProxy/Generated.cs @@ -1571,6 +1571,28 @@ namespace BeWo.ServiceProxy [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Employee2SchedulerAppointmentDC))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary>))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List>))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary>))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary>))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.HomeViewPanelType))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Auszahlungsintervall))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Zahlungstyp))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.VertretungsStatus))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.SchulbegleitenderZugehoerigkeitsTyp))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.MessageType))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.StatementType))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.ServiceRecordValidationResult))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.UiElementType))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.FlexibleReportFilterDC))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.FlexibleReportResultDC))] @@ -1587,12 +1609,13 @@ namespace BeWo.ServiceProxy [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.ReportTypes))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.DienstInfoDC))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.DienstEintragDC))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.ConfirmationReceiptSignatureDC))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.DienstBlockDC))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.DienstEintragDC))] + [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.DienstvertretungDC))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.AbsenceOverviewFilterDC))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.VorlagentabelleDC))] @@ -1675,28 +1698,6 @@ namespace BeWo.ServiceProxy [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.FLSAnalysisDataDetailDC))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.ServiceRecordFLSOverviewDC))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.HomeViewPanelType))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Auszahlungsintervall))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.Zahlungstyp))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.VertretungsStatus))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.SchulbegleitenderZugehoerigkeitsTyp))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.MessageType))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.StatementType))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.ServiceRecordValidationResult))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.UiElementType))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List>))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary>))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary>))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Reports.AuslastungAnalysisRootDC))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.List))] [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BS.Shared.DataContracts.Reports.AuslastungAnalysisEmployeeDC))] @@ -4819,6 +4820,28 @@ namespace BeWo.ServiceProxy public interface IOperationsService { + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetColorForStatus", ReplyAction="http://tempuri.org/IOperationsService/GetColorForStatusResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetColorForStatusBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + string GetColorForStatus(bool status); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetColorForServiceRecordView2", ReplyAction="http://tempuri.org/IOperationsService/GetColorForServiceRecordView2Response")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetColorForServiceRecordView2BeWoFaultFault" + + "", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + string GetColorForServiceRecordView2(); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetAdditionalEmployeeInformationForSchedule" + + "r", ReplyAction="http://tempuri.org/IOperationsService/GetAdditionalEmployeeInformationForSchedule" + + "rResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetAdditionalEmployeeInformationForSchedule" + + "rBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + System.Collections.Generic.Dictionary GetAdditionalEmployeeInformationForScheduler(long empOid); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetXAMLInformationStringForEmployee", ReplyAction="http://tempuri.org/IOperationsService/GetXAMLInformationStringForEmployeeResponse" + + "")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetXAMLInformationStringForEmployeeBeWoFaul" + + "tFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + string GetXAMLInformationStringForEmployee(long empOid); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetXAMLInformationStringForCustomer", ReplyAction="http://tempuri.org/IOperationsService/GetXAMLInformationStringForCustomerResponse" + "")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetXAMLInformationStringForCustomerBeWoFaul" + @@ -4891,6 +4914,14 @@ namespace BeWo.ServiceProxy [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetAllDiensteBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] System.Collections.Generic.List GetAllDienste(); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetBemerkungForDienstEintrag", ReplyAction="http://tempuri.org/IOperationsService/GetBemerkungForDienstEintragResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetBemerkungForDienstEintragBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + string GetBemerkungForDienstEintrag(long empId, long wohnId, int zeile, System.DateTime date); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetDienstEintrag", ReplyAction="http://tempuri.org/IOperationsService/GetDienstEintragResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetDienstEintragBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.Shared.DataContracts.DienstEintragDC GetDienstEintrag(long empId, long wohnId, int zeile, System.DateTime date); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/InsertNewDienst", ReplyAction="http://tempuri.org/IOperationsService/InsertNewDienstResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/InsertNewDienstBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] void InsertNewDienst(System.Collections.Generic.List dienst); @@ -4967,10 +4998,18 @@ namespace BeWo.ServiceProxy [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetDienstEintraegeBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] System.Collections.Generic.List GetDienstEintraege(long wOid, int year, int month); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetDienstvertretungen", ReplyAction="http://tempuri.org/IOperationsService/GetDienstvertretungenResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetDienstvertretungenBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + System.Collections.Generic.List GetDienstvertretungen(long wOid, int year, int month); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/InsertNewDienstEintrag", ReplyAction="http://tempuri.org/IOperationsService/InsertNewDienstEintragResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/InsertNewDienstEintragBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] void InsertNewDienstEintrag(BS.Shared.DataContracts.DienstEintragDC dienstEintrag); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/InsertNewDienstvertretung", ReplyAction="http://tempuri.org/IOperationsService/InsertNewDienstvertretungResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/InsertNewDienstvertretungBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + void InsertNewDienstvertretung(BS.Shared.DataContracts.DienstvertretungDC dienstvertretung); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/UpdateDienstEintrag", ReplyAction="http://tempuri.org/IOperationsService/UpdateDienstEintragResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/UpdateDienstEintragBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] void UpdateDienstEintrag(BS.Shared.DataContracts.DienstEintragDC dienstEintrag); @@ -5098,28 +5137,6 @@ namespace BeWo.ServiceProxy [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/RemoveAllDiensteForOneMonthBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] void RemoveAllDiensteForOneMonth(System.DateTime month); - [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetColorForStatus", ReplyAction="http://tempuri.org/IOperationsService/GetColorForStatusResponse")] - [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetColorForStatusBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] - string GetColorForStatus(bool status); - - [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetColorForServiceRecordView2", ReplyAction="http://tempuri.org/IOperationsService/GetColorForServiceRecordView2Response")] - [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetColorForServiceRecordView2BeWoFaultFault" + - "", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] - string GetColorForServiceRecordView2(); - - [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetAdditionalEmployeeInformationForSchedule" + - "r", ReplyAction="http://tempuri.org/IOperationsService/GetAdditionalEmployeeInformationForSchedule" + - "rResponse")] - [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetAdditionalEmployeeInformationForSchedule" + - "rBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] - System.Collections.Generic.Dictionary GetAdditionalEmployeeInformationForScheduler(long empOid); - - [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetXAMLInformationStringForEmployee", ReplyAction="http://tempuri.org/IOperationsService/GetXAMLInformationStringForEmployeeResponse" + - "")] - [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetXAMLInformationStringForEmployeeBeWoFaul" + - "tFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] - string GetXAMLInformationStringForEmployee(long empOid); - [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/UpdateIsChatActiveCustomerAPPCodeDC", ReplyAction="http://tempuri.org/IOperationsService/UpdateIsChatActiveCustomerAPPCodeDCResponse" + "")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/UpdateIsChatActiveCustomerAPPCodeDCBeWoFaul" + @@ -6020,6 +6037,26 @@ namespace BeWo.ServiceProxy { } + public string GetColorForStatus(bool status) + { + return base.Channel.GetColorForStatus(status); + } + + public string GetColorForServiceRecordView2() + { + return base.Channel.GetColorForServiceRecordView2(); + } + + public System.Collections.Generic.Dictionary GetAdditionalEmployeeInformationForScheduler(long empOid) + { + return base.Channel.GetAdditionalEmployeeInformationForScheduler(empOid); + } + + public string GetXAMLInformationStringForEmployee(long empOid) + { + return base.Channel.GetXAMLInformationStringForEmployee(empOid); + } + public string GetXAMLInformationStringForCustomer(long customerOid) { return base.Channel.GetXAMLInformationStringForCustomer(customerOid); @@ -6100,6 +6137,16 @@ namespace BeWo.ServiceProxy return base.Channel.GetAllDienste(); } + public string GetBemerkungForDienstEintrag(long empId, long wohnId, int zeile, System.DateTime date) + { + return base.Channel.GetBemerkungForDienstEintrag(empId, wohnId, zeile, date); + } + + public BS.Shared.DataContracts.DienstEintragDC GetDienstEintrag(long empId, long wohnId, int zeile, System.DateTime date) + { + return base.Channel.GetDienstEintrag(empId, wohnId, zeile, date); + } + public void InsertNewDienst(System.Collections.Generic.List dienst) { base.Channel.InsertNewDienst(dienst); @@ -6180,11 +6227,21 @@ namespace BeWo.ServiceProxy return base.Channel.GetDienstEintraege(wOid, year, month); } + public System.Collections.Generic.List GetDienstvertretungen(long wOid, int year, int month) + { + return base.Channel.GetDienstvertretungen(wOid, year, month); + } + public void InsertNewDienstEintrag(BS.Shared.DataContracts.DienstEintragDC dienstEintrag) { base.Channel.InsertNewDienstEintrag(dienstEintrag); } + public void InsertNewDienstvertretung(BS.Shared.DataContracts.DienstvertretungDC dienstvertretung) + { + base.Channel.InsertNewDienstvertretung(dienstvertretung); + } + public void UpdateDienstEintrag(BS.Shared.DataContracts.DienstEintragDC dienstEintrag) { base.Channel.UpdateDienstEintrag(dienstEintrag); @@ -6325,26 +6382,6 @@ namespace BeWo.ServiceProxy base.Channel.RemoveAllDiensteForOneMonth(month); } - public string GetColorForStatus(bool status) - { - return base.Channel.GetColorForStatus(status); - } - - public string GetColorForServiceRecordView2() - { - return base.Channel.GetColorForServiceRecordView2(); - } - - public System.Collections.Generic.Dictionary GetAdditionalEmployeeInformationForScheduler(long empOid) - { - return base.Channel.GetAdditionalEmployeeInformationForScheduler(empOid); - } - - public string GetXAMLInformationStringForEmployee(long empOid) - { - return base.Channel.GetXAMLInformationStringForEmployee(empOid); - } - public void UpdateIsChatActiveCustomerAPPCodeDC(long customerOid, int activeType) { base.Channel.UpdateIsChatActiveCustomerAPPCodeDC(customerOid, activeType); diff --git a/BeWo/View/Controls/DPCtrlDay.cs b/BeWo/View/Controls/DPCtrlDay.cs index 4fdd36a7c..4587cad4d 100644 --- a/BeWo/View/Controls/DPCtrlDay.cs +++ b/BeWo/View/Controls/DPCtrlDay.cs @@ -101,6 +101,8 @@ namespace BeWo.View.Controls public DPCtrlDay() { InitializeComponent(); + //MouseLeftButtonDown += DienstplanerControl_LeftMouseDown; + //MouseRightButtonDown += DienstplanerControl_RightMouseDown; MouseDown += DienstplanerControl_MouseDown; } @@ -123,6 +125,24 @@ namespace BeWo.View.Controls set { SetValue(DPCtrlDayInformationProperty, value); } } + /*private void DienstplanerControl_LeftMouseDown(object sender, MouseButtonEventArgs e) + { + DienstplanerView entryView = null; + + DependencyObject parent = VisualTreeHelper.GetParent(this); + + while (parent != null && entryView == null) + { + entryView = parent as DienstplanerView; + var fe = parent as FrameworkElement; + parent = fe != null ? VisualTreeHelper.GetParent(fe) : null; + } + + if (entryView != null) + { + entryView.DienstplanerControl_LeftMouseDown(sender, e); + } + }*/ private void DienstplanerControl_MouseDown(object sender, MouseButtonEventArgs e) { DienstplanerView entryView = null; diff --git a/BeWo/View/Controls/DPCtrlDienstTooltip.xaml b/BeWo/View/Controls/DPCtrlDienstTooltip.xaml index 3a698ce85..8f1e8698d 100644 --- a/BeWo/View/Controls/DPCtrlDienstTooltip.xaml +++ b/BeWo/View/Controls/DPCtrlDienstTooltip.xaml @@ -11,11 +11,14 @@ + + + @@ -23,5 +26,11 @@ + + + + \ No newline at end of file diff --git a/BeWo/View/Controls/DPCtrlDienstTooltip.xaml.cs b/BeWo/View/Controls/DPCtrlDienstTooltip.xaml.cs index e36eb5df5..d49766b06 100644 --- a/BeWo/View/Controls/DPCtrlDienstTooltip.xaml.cs +++ b/BeWo/View/Controls/DPCtrlDienstTooltip.xaml.cs @@ -24,6 +24,7 @@ namespace BeWo.View.Controls TxtEnde.Text = dienst.Ende.ToString("HH:mm"); TxtPausendauer.Text = dienst.Pause.ToString(); TxtStart.Text = dienst.Start.ToString("HH:mm"); + //TxtBemerkung.Text = dienst.Notice; } } } \ No newline at end of file diff --git a/BeWo/View/Controls/DPCtrlEmployee.cs b/BeWo/View/Controls/DPCtrlEmployee.cs index 53312cde5..36d07000f 100644 --- a/BeWo/View/Controls/DPCtrlEmployee.cs +++ b/BeWo/View/Controls/DPCtrlEmployee.cs @@ -107,14 +107,14 @@ namespace BeWo.View.Controls sb.Append('('); if (contract.EntryDate.HasValue) - sb.Append(contract.EntryDate.Value.ToString("dd.MM")); + sb.Append(contract.EntryDate.Value.ToString("dd.MM.yy")); else sb.Append("k.A."); sb.Append('-'); if (contract.ContractEndDate.HasValue) - sb.Append(contract.ContractEndDate.Value.ToString("dd.MM")); + sb.Append(contract.ContractEndDate.Value.ToString("dd.MM.yy")); else sb.Append("unbefr."); diff --git a/BeWo/View/Controls/DPCtrlMonth.cs b/BeWo/View/Controls/DPCtrlMonth.cs index 4e5c5fbdb..37ca36e39 100644 --- a/BeWo/View/Controls/DPCtrlMonth.cs +++ b/BeWo/View/Controls/DPCtrlMonth.cs @@ -26,7 +26,7 @@ namespace BeWo.View.Controls { dc.RemoveAll(x => x == null); - c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1); + c.BorderBlack.BorderThickness = new Thickness(1, 0, 1, 1); double res = 0.0; if (dc.Count != 0) @@ -39,13 +39,13 @@ namespace BeWo.View.Controls } else { - c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1); + c.BorderBlack.BorderThickness = new Thickness(1, 0, 1, 1); c.Text = ""; } } else { - c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1); + c.BorderBlack.BorderThickness = new Thickness(1, 0, 1, 1); c.Text = ""; } @@ -58,7 +58,7 @@ namespace BeWo.View.Controls { InitializeComponent(); - BorderBlack.BorderThickness = new Thickness(0, 0, 1, 0); + BorderBlack.BorderThickness = new Thickness(1, 0, 1, 0); txt.TextAlignment = TextAlignment.Left; txt.HorizontalAlignment = HorizontalAlignment.Left; diff --git a/BeWo/View/Detail/Report/DienstplanerView.xaml b/BeWo/View/Detail/Report/DienstplanerView.xaml index 414f68b13..862afd48a 100644 --- a/BeWo/View/Detail/Report/DienstplanerView.xaml +++ b/BeWo/View/Detail/Report/DienstplanerView.xaml @@ -68,7 +68,34 @@ + + + + + + \ No newline at end of file diff --git a/BeWo/View/Detail/Report/DienstplanerView.xaml.cs b/BeWo/View/Detail/Report/DienstplanerView.xaml.cs index 63b18bf48..064f27de6 100644 --- a/BeWo/View/Detail/Report/DienstplanerView.xaml.cs +++ b/BeWo/View/Detail/Report/DienstplanerView.xaml.cs @@ -377,7 +377,8 @@ namespace BeWo.View.Detail.Report { if (!_IsControlClick) { - _PopupPicker.IsOpen = false; + //_PopupPicker.IsOpen = false; + popUp_RightClick.IsOpen = false; } _IsControlClick = false; @@ -391,7 +392,7 @@ namespace BeWo.View.Detail.Report // Button Click private void BtnAnzeigen_Click(object sender, RoutedEventArgs e) { - _PopupPicker.IsOpen = false; + //_PopupPicker.IsOpen = false; if (_WohnheimPicker.SelectedItem == null) return; @@ -400,12 +401,80 @@ namespace BeWo.View.Detail.Report AuswahlWohnheim = _WohnheimPicker.SelectedItem as CompactWohnheimDC; InitGridControl(); + button_neuerMitarbeiter.Visibility = Visibility.Visible; + _BtnRemoveAllDiensteForMonth.Visibility = Visibility.Visible; + } + + private void button_neuerMitarbeiter_Click(object sender, RoutedEventArgs e) + { + popUp_neuerMitarbeiterFuerWohnheim.IsOpen = true; + + var alleMitarbeiter = ServiceFacade.DoEmployeeServiceSync(s => s.GetAllActiveEmployees()); + List mitarbeiterMitVertrag = new List(); + + foreach (var emp in alleMitarbeiter) + { + if (CheckForContracts(emp)) + mitarbeiterMitVertrag.Add(emp); + } + + + foreach (var entry in _DienstDCListe) + { + for (int i = mitarbeiterMitVertrag.Count - 1; i >= 0; i--) + { + var currentEmp = mitarbeiterMitVertrag[i]; + if (entry.Employee.EmployeeOid == currentEmp.EmployeeOid) + { + mitarbeiterMitVertrag.Remove(mitarbeiterMitVertrag[i]); + break; + } + } + } + + combobox_mitarbeiter.ItemsSource = mitarbeiterMitVertrag.OrderBy(m => m.LastName); + } + + private bool CheckForContracts(EmployeeDC emp) + { + var start = _AuswahlMonat; + var end = _AuswahlMonat.AddMonths(1).AddTicks(-1); + var contracts = emp.Contracts.Where(x => (!x.EntryDate.HasValue || x.EntryDate.Value <= end) && + (!x.ContractEndDate.HasValue || x.ContractEndDate.Value >= start)) + .OrderBy(x => x.EntryDate) + .ToList(); + + return contracts.Any() ? true : false; + } + + private void button_add_employee_Click(object sender, RoutedEventArgs e) + { + if (combobox_mitarbeiter.SelectedItem == null) + return; + + var emp = combobox_mitarbeiter.SelectedItem as EmployeeDC; + + DienstBlockDC newDC = new DienstBlockDC() + { + Contracts = emp.Contracts, + DienstDictArray = new Dictionary[3], + Employee = emp, + Wohnheim = _AuswahlWohnheim + }; + + _DienstEintragListe.AddRange(Init(newDC, _AlleDienste, RefreshGrid, _AuswahlMonat)); + RefreshGrid(); + + popUp_neuerMitarbeiterFuerWohnheim.IsOpen = false; } // Grid Click - public void DienstplanerControl_MouseDown(object sender, MouseEventArgs e) + /*public void DienstplanerControl_LeftMouseDown(object sender, MouseEventArgs e) { _PopupPicker.IsOpen = false; + popUp_RightClick.IsOpen = false; + textbox_bemerkung.Text = ""; + _AuswahlDienstZeileDC = _GridControl.GetRow(_GridControl.View.GetRowHandleByMouseEventArgs(e)) as DienstZeileDC; @@ -418,10 +487,117 @@ namespace BeWo.View.Detail.Report _IsControlClick = true; _PopupPicker.IsOpen = true; + }*/ + + public void DienstplanerControl_MouseDown(object sender, MouseEventArgs e) + { + _IsControlClick = true; + //_PopupPicker.IsOpen = false; + popUp_RightClick.IsOpen = false; + textbox_bemerkung.Text = ""; + + + _AuswahlDienstZeileDC = _GridControl.GetRow(_GridControl.View.GetRowHandleByMouseEventArgs(e)) as DienstZeileDC; + + if (_AuswahlDienstZeileDC.DienstDict == null) + return; + + _AuswahlTag = int.Parse(_GridControl.View.GetColumnByMouseEventArgs(e).FieldName); + + var eintrag = ServiceFacade.DoOperationsServiceSync(s => s.GetDienstEintrag(_AuswahlDienstZeileDC.Employee.EmployeeOid.Value, + _AuswahlWohnheim.WohnheimOid, _AuswahlDienstZeileDC.Zeile, Pointer)); + + + popUp_RightClick.IsOpen = true; + combobox_dienste.ItemsSource = _AlleDienste; + + if (eintrag == null) + { + groupbox_popUp_RightClick.Header = "Neuen Dienst hinzufügen"; + combobox_dienste.SelectedIndex = 0; + } + else + { + groupbox_popUp_RightClick.Header = "Dienst bearbeiten"; + foreach (var info in _AlleDienste) + { + if(eintrag.DienstOid == info.Oid) + { + combobox_dienste.SelectedItem = info; + break; + } + } + } + + textbox_bemerkung.Text = eintrag != null ? eintrag.Notice : ""; + } + private void button_save_Click(object sender, RoutedEventArgs e) + { + if ((long)((DienstInfoDC)combobox_dienste.SelectedItem).Oid == -1) + { + System.Windows.MessageBox.Show("Wählen Sie einen Dienst aus.", "BeWo Planer", MessageBoxButton.OK, MessageBoxImage.Information); + return; + } + var eintrag = ServiceFacade.DoOperationsServiceSync(s => s.GetDienstEintrag(_AuswahlDienstZeileDC.Employee.EmployeeOid.Value, + _AuswahlWohnheim.WohnheimOid, _AuswahlDienstZeileDC.Zeile, Pointer)); + + if (eintrag != null) + { + var oldDienst = TryGetDienst(_AuswahlDienstZeileDC, _AuswahlTag); //abc + ServiceFacade.DoOperationsServiceSync(x => x.DeleteDienstEintrag(_AuswahlDienstZeileDC.Employee.EmployeeOid.Value, AuswahlWohnheim.WohnheimOid, _AuswahlDienstZeileDC.Zeile, Pointer)); + _AuswahlDienstZeileDC.RemoveDienst(_AuswahlTag); + } + + //ServiceFacade.DoOperationsServiceSync(x => x.InsertNewDienstEintrag( + // new DienstEintragDC + // { + // Datum = Pointer, + // DienstOid = (long)((DienstInfoDC)combobox_dienste.SelectedItem).Oid, + // EmployeeOid = _AuswahlDienstZeileDC.Employee.EmployeeOid.Value, + // Oid = null, + // WohnheimOid = AuswahlWohnheim.WohnheimOid, + // Zeile = _AuswahlDienstZeileDC.Zeile, + // Notice = textbox_bemerkung.Text + // })); + + if (_AuswahlWohnheim.EmployeeOids.Contains(_AuswahlDienstZeileDC.Employee.EmployeeOid.Value)) + { + ServiceFacade.DoOperationsServiceSync(x => x.InsertNewDienstEintrag( + new DienstEintragDC + { + Datum = Pointer, + DienstOid = (long)((DienstInfoDC)combobox_dienste.SelectedItem).Oid, + EmployeeOid = _AuswahlDienstZeileDC.Employee.EmployeeOid.Value, + Oid = null, + WohnheimOid = AuswahlWohnheim.WohnheimOid, + Zeile = _AuswahlDienstZeileDC.Zeile, + Notice = textbox_bemerkung.Text + })); + } + else + { + ServiceFacade.DoOperationsServiceSync(x => x.InsertNewDienstvertretung( + new DienstvertretungDC + { + Datum = Pointer, + DienstOid = (long)((DienstInfoDC)combobox_dienste.SelectedItem).Oid, + EmployeeOid = _AuswahlDienstZeileDC.Employee.EmployeeOid.Value, + Oid = null, + WohnheimOid = AuswahlWohnheim.WohnheimOid, + Zeile = _AuswahlDienstZeileDC.Zeile, + Notice = textbox_bemerkung.Text + })); + } + + + _AuswahlDienstZeileDC.AddDienst(_AuswahlTag, combobox_dienste.SelectedItem as DienstInfoDC); + + textbox_bemerkung.Text = ""; + popUp_RightClick.IsOpen = false; } // Popup Click - private void Popup_MouseDown(object sender, MouseButtonEventArgs e) + /*private void Popup_MouseDown(object sender, MouseButtonEventArgs e) { var oldDienst = TryGetDienst(_AuswahlDienstZeileDC, _AuswahlTag); //abc var newDienst = (DienstInfoDC)((Grid)sender).Tag; @@ -438,6 +614,7 @@ namespace BeWo.View.Detail.Report new DienstEintragDC { Datum = Pointer, + Notice = "", DienstOid = newDienst.Oid.Value, EmployeeOid = _AuswahlDienstZeileDC.Employee.EmployeeOid.Value, Oid = null, @@ -478,7 +655,7 @@ namespace BeWo.View.Detail.Report //_AuswahlDienstZeileDC.UpdateDienst(_AuswahlTag, newDienst); } } - } + }*/ // Daten füllen @@ -573,13 +750,13 @@ namespace BeWo.View.Detail.Report return; case "MO": pos = int.Parse(e.Column.FieldName.Remove(e.Column.FieldName.Length - 1)); //31 im März - e.Value = selZeile.Zeile == 2 ? _DienstEintragListe.FindAll(x => x.Employee == selZeile.Employee).SelectMany(y => y.GetDienstWoche(pos)).ToList() : null; + e.Value = selZeile.Zeile == 2 ? _DienstEintragListe.FindAll(x => x.Employee == selZeile.Employee).SelectMany(y => y.GetDienstMonat()).ToList() : null; if (selZeile.Zeile == 0 && selZeile.StatusListe != null) { e.Value = new List(); - var week = new DPCtrlWeek(); - week.DienstInfoDCList = e.Value as List; + var month = new DPCtrlMonth(); + month.DienstInfoDCList = e.Value as List; } return; @@ -596,6 +773,9 @@ namespace BeWo.View.Detail.Report private void RefreshDienste() { _DienstDCListe = ServiceFacade.DoOperationsServiceSync(x => x.GetDienstEintraege(AuswahlWohnheim.WohnheimOid, AuswahlMonat.Year, AuswahlMonat.Month)); //Dem Wohnheim zugeordnete Mitarbeiter mit ihren Diensten + var vertretungen = ServiceFacade.DoOperationsServiceSync(x => x.GetDienstvertretungen(AuswahlWohnheim.WohnheimOid, AuswahlMonat.Year, AuswahlMonat.Month)); + _DienstDCListe.AddRange(vertretungen); + _DienstDCListe = _DienstDCListe.OrderBy(d => d.Employee.LastName).ToList(); _AlleDienste = ServiceFacade.DoOperationsServiceSync(x => x.GetAllDienste()); //Verschiedene Schichten zum Zuordnen an Mitarbeiter @@ -752,6 +932,13 @@ namespace BeWo.View.Detail.Report + + + + + + + #endregion /// diff --git a/Data/Data.csproj b/Data/Data.csproj index 6b5ec7a73..5219aedc1 100644 --- a/Data/Data.csproj +++ b/Data/Data.csproj @@ -145,6 +145,7 @@ + @@ -645,6 +646,7 @@ Designer + Designer diff --git a/Data/Entities/Dienstvertretung.cs b/Data/Entities/Dienstvertretung.cs new file mode 100644 index 000000000..b00253c13 --- /dev/null +++ b/Data/Entities/Dienstvertretung.cs @@ -0,0 +1,98 @@ +using BS.Shared; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWo.Data.Entities +{ + public class Dienstvertretung : BeWoEntityBase + { + private long _EmployeeOid; + private long _WohnheimOid; + private long _DienstOid; + private int _Zeile; + private DateTime _Datum; + + public Dienstvertretung() + { + _Tid = TableID.Dienstvertretung; + } + + public virtual long EmployeeOid + { + get + { + return _EmployeeOid; + } + set + { + if (AreDifferent(_EmployeeOid, value)) + { + _EmployeeOid = value; + } + } + } + + public virtual long WohnheimOid + { + get + { + return _WohnheimOid; + } + set + { + if (AreDifferent(_WohnheimOid, value)) + { + _WohnheimOid = value; + } + } + } + + public virtual long DienstOid + { + get + { + return _DienstOid; + } + set + { + if (AreDifferent(_DienstOid, value)) + { + _DienstOid = value; + } + } + } + + public virtual int Zeile + { + get + { + return _Zeile; + } + set + { + if (AreDifferent(_Zeile, value)) + { + _Zeile = value; + } + } + } + + public virtual DateTime Datum + { + get + { + return _Datum; + } + set + { + if (AreDifferent(_Datum, value)) + { + _Datum = value; + } + } + } + } +} diff --git a/Data/Mappings/Dienstvertretung.hbm.xml b/Data/Mappings/Dienstvertretung.hbm.xml new file mode 100644 index 000000000..2bd1d1203 --- /dev/null +++ b/Data/Mappings/Dienstvertretung.hbm.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Service/DCEntityMapper/DienstvertretungDC_Dienstvertretung.cs b/Service/DCEntityMapper/DienstvertretungDC_Dienstvertretung.cs new file mode 100644 index 000000000..e8fec388d --- /dev/null +++ b/Service/DCEntityMapper/DienstvertretungDC_Dienstvertretung.cs @@ -0,0 +1,49 @@ +using BeWo.Data.Entities; +using BS.Shared.DataContracts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWo.Service.DCEntityMapper +{ + public class DienstvertretungDC_Dienstvertretung : AbstractIDCEntityMapper + { + public override DienstvertretungDC MergeWithDC(Dienstvertretung bEntity, DienstvertretungDC bDataContract) + { + bDataContract.Oid = bEntity.Oid; + bDataContract.Notice = bEntity.Notice; + bDataContract.Version = bEntity.Version; + + bDataContract.Datum = bEntity.Datum; + bDataContract.DienstOid = bEntity.DienstOid; + bDataContract.EmployeeOid = bEntity.EmployeeOid; + bDataContract.WohnheimOid = bEntity.WohnheimOid; + bDataContract.Zeile = bEntity.Zeile; + + return bDataContract; + } + + public override Dienstvertretung MergeWithEntity(DienstvertretungDC bDataContract, Dienstvertretung bEntity) + { + this.ConcurrencyCheck(bDataContract.Version, bEntity); + + bEntity.Oid = bDataContract.Oid; + bEntity.Notice = bDataContract.Notice; + + bEntity.Datum = bDataContract.Datum; + bEntity.DienstOid = bDataContract.DienstOid; + bEntity.EmployeeOid = bDataContract.EmployeeOid; + bEntity.WohnheimOid = bDataContract.WohnheimOid; + bEntity.Zeile = bDataContract.Zeile; + + return bEntity; + } + + protected override bool AreDCAndEntityEqual(DienstvertretungDC bDC, Dienstvertretung bEntity) + { + return bDC.Oid != null && bDC.Oid == bEntity.Oid; + } + } +} diff --git a/Service/DCEntityMapper/MapperFactory.cs b/Service/DCEntityMapper/MapperFactory.cs index c6597c303..17f7802c7 100644 --- a/Service/DCEntityMapper/MapperFactory.cs +++ b/Service/DCEntityMapper/MapperFactory.cs @@ -264,6 +264,8 @@ namespace BeWo.Service.DCEntityMapper private static DienstEintragDC_DienstEintrag _DienstEintragDC_DienstEintrag; + private static DienstvertretungDC_Dienstvertretung _DienstvertretungDC_Dienstvertretung; + private static RatingDC_Rating _RatingDC_Rating; private static RatingTypeDC_RatingType _RatingTypeDC_RatingType; @@ -690,6 +692,9 @@ namespace BeWo.Service.DCEntityMapper public static DienstEintragDC_DienstEintrag DienstEintragDC_DienstEintrag => _DienstEintragDC_DienstEintrag ?? (_DienstEintragDC_DienstEintrag = new DienstEintragDC_DienstEintrag()); + public static DienstvertretungDC_Dienstvertretung DienstvertretungDC_Dienstvertretung => + _DienstvertretungDC_Dienstvertretung ?? (_DienstvertretungDC_Dienstvertretung = new DienstvertretungDC_Dienstvertretung()); + public static QuittierungsbelegsstatusDC_Quittierungsbelegsstatus QuittierungsbelegsstatusDC_Quittierungsbelegsstatus => _QuittierungsbelegsstatusDC_Quittierungsbelegsstatus ?? (_QuittierungsbelegsstatusDC_Quittierungsbelegsstatus = new QuittierungsbelegsstatusDC_Quittierungsbelegsstatus()); diff --git a/Service/Dienstplanung/DienstplanungsManager.cs b/Service/Dienstplanung/DienstplanungsManager.cs index 84580109e..06ce16526 100644 --- a/Service/Dienstplanung/DienstplanungsManager.cs +++ b/Service/Dienstplanung/DienstplanungsManager.cs @@ -94,7 +94,7 @@ namespace BeWo.Service.Dienstplanung for (int i = 0; i < zeile.DienstDictArray.Length; i++) { var empDienste = dienstEintraegeDC - .Where(x => x.EmployeeOid == emp.EmployeeOid && x.Zeile == i); //i + 1 wegen der Statuszeile, die jetzt die vorherige erste Zeile mach unten geschoben hat + .Where(x => x.EmployeeOid == emp.EmployeeOid && x.Zeile == i); zeile.DienstDictArray[i] = empDienste .ToDictionary(x => x.Datum.Day, x => x.DienstOid); @@ -106,10 +106,89 @@ namespace BeWo.Service.Dienstplanung return res; } + public static List GetDienstvertretungen(long wOid, int year, int month) + { + var res = new List(); + + var date = new DateTime(year, month, 1); + var date2 = date.AddMonths(1).AddTicks(-1); + + var dienstvertretung = DAOFactory.GenericDAO.GetAllActive().Where(x => + x.WohnheimOid == wOid && + x.Datum.Month == month && + x.Datum.Year == year); + + var dienstvertretungenDC = MapperFactory.DienstvertretungDC_Dienstvertretung.MapToNewDCs(dienstvertretung); + + var wh = DAOFactory.GenericDAO.GetByID(wOid); + var whDC = MapperFactory.CompactWohnheimDC_Wohnheim.MapToNewDC(wh); + + List empOids = new List(); + foreach (var vertretung in dienstvertretungenDC) + { + if (vertretung.WohnheimOid == wOid) + { + if (empOids.Count == 0) + empOids.Add(vertretung.EmployeeOid); + else + { + if (!empOids.Contains(vertretung.EmployeeOid)) + empOids.Add(vertretung.EmployeeOid); + } + } + } + + List empsDC = new List(); + foreach (var oid in empOids) + { + empsDC.Add(MapperFactory.EmployeeDC_Employee.MapToNewDC(DAOFactory.GenericDAO.GetByID(oid))); + } + + + //var emps = wh.Employee2WohnheimList.Select(x => x.Employee); + //var empsDC = MapperFactory.EmployeeDC_Employee.MapToNewDCs(emps).Distinct(); + + foreach (var emp in empsDC) + { + var contracts = emp.Contracts.Where(x => (!x.EntryDate.HasValue || x.EntryDate.Value <= date2) && + (!x.ContractEndDate.HasValue || x.ContractEndDate.Value >= date)) + .OrderBy(x => x.EntryDate) + .ToList(); + + if (!contracts.Any()) + continue; + + var zeile = new DienstBlockDC + { + Employee = emp, + Contracts = contracts, + Wohnheim = whDC, + DienstDictArray = new Dictionary[3] + }; + + for (int i = 0; i < zeile.DienstDictArray.Length; i++) + { + var empDienste = dienstvertretungenDC + .Where(x => x.EmployeeOid == emp.EmployeeOid && x.Zeile == i); + + zeile.DienstDictArray[i] = empDienste + .ToDictionary(x => x.Datum.Day, x => x.DienstOid); + } + + res.Add(zeile); + } + + + return res; + } public static void InsertNewDienstEintrag(DienstEintragDC dienstEintrag) { DAOFactory.GenericDAO.Insert(MapperFactory.DienstEintragDC_DienstEintrag.MapToNewEntity(dienstEintrag)); } + public static void InsertNewDienstvertretung(DienstvertretungDC dienstvertretung) + { + DAOFactory.GenericDAO.Insert(MapperFactory.DienstvertretungDC_Dienstvertretung.MapToNewEntity(dienstvertretung)); + } public static void DeleteDienstEintrag(long empId, long wohnId, int zeile, DateTime date) { var toDel = DAOFactory.GenericDAO.GetAll() @@ -141,6 +220,36 @@ namespace BeWo.Service.Dienstplanung } } + public static string GetBemerkungForDienstEintrag(long empId, long wohnId, int zeile, DateTime date) + { + var res = DAOFactory.GenericDAO.GetAll() + .FirstOrDefault(x => + x.EmployeeOid == empId && + x.WohnheimOid == wohnId && + x.Zeile == zeile && + x.Datum == date); + + if (res != null) + return res.Notice; + else + return ""; + } + public static DienstEintragDC GetDienstEintrag(long empId, long wohnId, int zeile, DateTime date) + { + var eintrag = DAOFactory.GenericDAO.GetAll() + .FirstOrDefault(x => + x.EmployeeOid == empId && + x.WohnheimOid == wohnId && + x.Zeile == zeile && + x.Datum == date); + + return (eintrag != null) ? MapperFactory.DienstEintragDC_DienstEintrag.MapToNewDC(eintrag) : null; + } + public static void UpdateDienstEintrag(DienstEintragDC dienstEintrag) + { + var entity = MapperFactory.DienstEintragDC_DienstEintrag.MapToNewEntity(dienstEintrag); + DAOFactory.GenericDAO.Update(entity); + } public static string GetColorForStatus(bool status) { return (status) ? "#FF228B22" : "#FFCD5C5C"; diff --git a/Service/Plugins/PluginLoader.cs b/Service/Plugins/PluginLoader.cs index cf4c40aaf..80e280af0 100644 --- a/Service/Plugins/PluginLoader.cs +++ b/Service/Plugins/PluginLoader.cs @@ -54,7 +54,7 @@ namespace BeWo.Service.Plugins //t = "5120047701"; // Trialog //t = "3629696651"; // Soziale Dienste Niederrhein //t = "9893557471"; // Caritas Frankfurt - t = "2918696314"; // Caritas Frankfurt 2 + //t = "2918696314"; // Caritas Frankfurt 2 //t = "6923790936"; // Integra e.V. //t = "2392153512"; // Christopherus Haus //t = "9495336024"; // VKM Aachen diff --git a/Service/Service.csproj b/Service/Service.csproj index 6a713062c..c76f14b88 100644 --- a/Service/Service.csproj +++ b/Service/Service.csproj @@ -167,6 +167,7 @@ + diff --git a/Service/ServiceContracts/IOperationsService.cs b/Service/ServiceContracts/IOperationsService.cs index 66e17fba0..637555b07 100644 --- a/Service/ServiceContracts/IOperationsService.cs +++ b/Service/ServiceContracts/IOperationsService.cs @@ -873,6 +873,15 @@ namespace BeWo.Service.ServiceContracts [OperationContract] List GetAllDienste(); + [FaultContract(typeof(BeWoFault))] + [OperationContract] + string GetBemerkungForDienstEintrag(long empId, long wohnId, int zeile, DateTime date); + + [FaultContract(typeof(BeWoFault))] + [OperationContract] + DienstEintragDC GetDienstEintrag(long empId, long wohnId, int zeile, DateTime date); + + [FaultContract(typeof(BeWoFault))] [OperationContract] void InsertNewDienst(List dienst); @@ -937,10 +946,18 @@ namespace BeWo.Service.ServiceContracts [OperationContract] List GetDienstEintraege(long wOid, int year, int month); + [FaultContract(typeof(BeWoFault))] + [OperationContract] + List GetDienstvertretungen(long wOid, int year, int month); + [FaultContract(typeof(BeWoFault))] [OperationContract] void InsertNewDienstEintrag(DienstEintragDC dienstEintrag); + [FaultContract(typeof(BeWoFault))] + [OperationContract] + void InsertNewDienstvertretung(DienstvertretungDC dienstvertretung); + [FaultContract(typeof(BeWoFault))] [OperationContract] void UpdateDienstEintrag(DienstEintragDC dienstEintrag); diff --git a/Service/ServiceImplementations/OperationsServiceImp.cs b/Service/ServiceImplementations/OperationsServiceImp.cs index 1b252a461..1e85ceab3 100644 --- a/Service/ServiceImplementations/OperationsServiceImp.cs +++ b/Service/ServiceImplementations/OperationsServiceImp.cs @@ -6056,6 +6056,17 @@ namespace BeWo.Service.ServiceImplementations throw Utils.CreateBeWoFaultException(e); } } + public List GetDienstvertretungen(long wOid, int year, int month) + { + try + { + return DienstplanungsManager.GetDienstvertretungen(wOid, year, month); + } + catch (Exception e) + { + throw Utils.CreateBeWoFaultException(e); + } + } public void InsertNewDienstEintrag(DienstEintragDC dienstEintrag) @@ -6070,11 +6081,23 @@ namespace BeWo.Service.ServiceImplementations } } + public void InsertNewDienstvertretung(DienstvertretungDC dienstvertretung) + { + try + { + DienstplanungsManager.InsertNewDienstvertretung(dienstvertretung); + } + catch (Exception e) + { + throw Utils.CreateBeWoFaultException(e); + } + } + public void UpdateDienstEintrag(DienstEintragDC dienstEintrag) { try { - throw new NotImplementedException(); + DienstplanungsManager.UpdateDienstEintrag(dienstEintrag); } catch (Exception e) { @@ -6104,7 +6127,28 @@ namespace BeWo.Service.ServiceImplementations throw Utils.CreateBeWoFaultException(ex); } } - + public string GetBemerkungForDienstEintrag(long empId, long wohnId, int zeile, DateTime date) + { + try + { + return DienstplanungsManager.GetBemerkungForDienstEintrag(empId, wohnId, zeile, date); + } + catch (Exception e) + { + throw Utils.CreateBeWoFaultException(e); + } + } + public DienstEintragDC GetDienstEintrag(long empId, long wohnId, int zeile, DateTime date) + { + try + { + return DienstplanungsManager.GetDienstEintrag(empId, wohnId, zeile, date); + } + catch (Exception e) + { + throw Utils.CreateBeWoFaultException(e); + } + } public virtual List ErstelleDefaultFeiertage(int year) { try diff --git a/Shared/BeWoEntityEnums.cs b/Shared/BeWoEntityEnums.cs index f68b21b5a..f6e6d743b 100644 --- a/Shared/BeWoEntityEnums.cs +++ b/Shared/BeWoEntityEnums.cs @@ -155,7 +155,8 @@ namespace BS.Shared ConfirmationReceiptSignature = 148, Quittierungsbelegsstatus = 149, Dokumentvorlage = 150, - Vorlagentabelle = 151 + Vorlagentabelle = 151, + Dienstvertretung = 152 } public enum SystemEntryID diff --git a/Shared/DataContracts/DienstInfoDC.cs b/Shared/DataContracts/DienstInfoDC.cs index 0acc95ffb..4f09069b6 100644 --- a/Shared/DataContracts/DienstInfoDC.cs +++ b/Shared/DataContracts/DienstInfoDC.cs @@ -41,7 +41,13 @@ namespace BS.Shared.DataContracts public override string ToString() { - return string.IsNullOrEmpty(Kurz) ? "-" : Kurz; + string vonStunden = Start.TimeOfDay.Hours < 10 ? "0" + Start.TimeOfDay.Hours : Start.TimeOfDay.Hours.ToString(); + string vonMinuten = Start.TimeOfDay.Minutes < 10 ? "0" + Start.TimeOfDay.Minutes : Start.TimeOfDay.Minutes.ToString(); + string bisStunden = Ende.TimeOfDay.Hours < 10 ? "0" + Ende.TimeOfDay.Hours : Ende.TimeOfDay.Hours.ToString(); + string bisMinuten = Ende.TimeOfDay.Minutes < 10 ? "0" + Ende.TimeOfDay.Minutes : Ende.TimeOfDay.Minutes.ToString(); + + string vonbis = vonStunden + ":" + vonMinuten + " Uhr - " + bisStunden + ":" + bisMinuten + " Uhr"; + return string.IsNullOrEmpty(Kurz) ? "" : vonbis + " (" + DienstName + ")"; //return $"ID:{Oid}|N:{DienstName}|K:{Kurz}"; } diff --git a/Shared/DataContracts/DienstZeileDC.cs b/Shared/DataContracts/DienstZeileDC.cs index 508330553..c4c4836a4 100644 --- a/Shared/DataContracts/DienstZeileDC.cs +++ b/Shared/DataContracts/DienstZeileDC.cs @@ -33,9 +33,21 @@ namespace BS.Shared.DataContracts Zeile = zeile; Date = date; DienstDict = dienste ?? new Dictionary(); - } + } //Tag public List GetDienstWoche(int sonntag) => DienstDict.Where(x => x.Key <= sonntag && sonntag - x.Key < 7).Select(x => x.Value).ToList(); + //public List GetDienstMonat(int letzterMonatstag) => DienstDict.Where(x => x.Key <= letzterMonatstag && letzterMonatstag - x.Key < 7).Select(x => x.Value).ToList(); + public List GetDienstMonat() + { + var result = new List(); + + foreach (var dienst in DienstDict) + { + result.Add(dienst.Value); + } + + return result; + } public void AddDienst(int tag, DienstInfoDC dienst) { diff --git a/Shared/DataContracts/DienstvertretungDC.cs b/Shared/DataContracts/DienstvertretungDC.cs new file mode 100644 index 000000000..082b32b82 --- /dev/null +++ b/Shared/DataContracts/DienstvertretungDC.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace BS.Shared.DataContracts +{ + public class DienstvertretungDC + { + [DataMember] + public long? Oid { get; set; } + + [DataMember] + public string Notice { get; set; } + + [DataMember] + public long? Version { get; set; } + + + [DataMember] + public long EmployeeOid { get; set; } + + [DataMember] + public long WohnheimOid { get; set; } + + [DataMember] + public long DienstOid { get; set; } + + [DataMember] + public int Zeile { get; set; } + + [DataMember] + public DateTime Datum { get; set; } + + + public override string ToString() + { + return $"ID:{Oid}|E:{EmployeeOid}|W:{WohnheimOid}|D:{DienstOid}"; + } + + public override bool Equals(object obj) + { + return obj is DienstEintragDC d && DienstOid == d.Oid; + } + + public override int GetHashCode() + { + return GetType().Name.GetHashCode() ^ DienstOid.GetHashCode(); + } + } +} diff --git a/Shared/DataContracts/EmployeeDC.cs b/Shared/DataContracts/EmployeeDC.cs index a90c62526..230804e59 100644 --- a/Shared/DataContracts/EmployeeDC.cs +++ b/Shared/DataContracts/EmployeeDC.cs @@ -138,6 +138,12 @@ namespace BS.Shared.DataContracts return new SolidColorBrush((Color) ColorConverter.ConvertFromString(EmployeeColor)); } + public override string ToString() + { + return LastName + ", " + FirstName; + + } + public virtual string LastNameFirstName { get => LastName + ", " + FirstName; diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index 8d9c90cac..dfad6eb7a 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -159,6 +159,7 @@ +