diff --git a/BeWo/Core/BeWoUtils.cs b/BeWo/Core/BeWoUtils.cs
index 609fd88ad..d8b3e3b23 100644
--- a/BeWo/Core/BeWoUtils.cs
+++ b/BeWo/Core/BeWoUtils.cs
@@ -2133,8 +2133,6 @@ namespace BeWo.Core
{
BeWo.Scheduling.View.AbsenceTimesCreationView newView = new Scheduling.View.AbsenceTimesCreationView(start, end, customer, employees, notice, appointment, schedulerCallback);
-
-
newView.ShowDialog();
}
diff --git a/BeWo/Scheduler/View/NewSchedulerView.xaml b/BeWo/Scheduler/View/NewSchedulerView.xaml
index f5d187b71..c1ecff876 100644
--- a/BeWo/Scheduler/View/NewSchedulerView.xaml
+++ b/BeWo/Scheduler/View/NewSchedulerView.xaml
@@ -1898,6 +1898,14 @@
Content="{markup:Translate In Zeiterfassung übertragen}"
ItemClick="ZeiterfassungButtonItem_OnItemClick" />
+
+
+
employee2SchedulerAppointment.Employee).ToList();
+
+ // Betreff des Termins als Notiz der einzutragenden Abwesenheit nutzen
+ String notice = "(aus Kalender übertragen)";
+ if (appointment.Subject.IsNotNullOrEmpty())
+ {
+ notice = appointment.Subject + " " + notice;
+ }
+
+ BeWoUtils.CreateAbsenceTime(appointment.Start, appointment.End, customerList, employeeList, notice, appointment, absenceTimes =>
+ {
+ try
+ {
+ IgnoreManualAppointmentCreation = true;
+ IgnoreChangeEvents = true;
+ }
+ finally
+ {
+ IgnoreManualAppointmentCreation = false;
+ IgnoreChangeEvents = false;
+ }
+ });
+ }
private bool IgnoreManualAppointmentCreation { get; set; }
diff --git a/BeWo/Scheduling/View/AbsenceTimesCreationView.xaml b/BeWo/Scheduling/View/AbsenceTimesCreationView.xaml
index 60a22f97b..c41e36579 100644
--- a/BeWo/Scheduling/View/AbsenceTimesCreationView.xaml
+++ b/BeWo/Scheduling/View/AbsenceTimesCreationView.xaml
@@ -5,8 +5,168 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BeWo.Scheduling.View"
mc:Ignorable="d"
- Title="AbsenceTimesCreationView" Height="450" Width="800">
-
-
-
+ xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
+ xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
+ xmlns:converter="clr-namespace:BeWo.Converter"
+ xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
+ dx:ThemeManager.ThemeName="Office2010Black"
+ Title="BeWoPlaner"
+ Height="250" MinHeight="250" Width="400" MinWidth="400"
+ WindowStartupLocation="CenterScreen"
+ ResizeMode="CanResizeWithGrip">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BeWo/Scheduling/View/AbsenceTimesCreationView.xaml.cs b/BeWo/Scheduling/View/AbsenceTimesCreationView.xaml.cs
index c0a5647eb..cac71ae8c 100644
--- a/BeWo/Scheduling/View/AbsenceTimesCreationView.xaml.cs
+++ b/BeWo/Scheduling/View/AbsenceTimesCreationView.xaml.cs
@@ -1,4 +1,10 @@
-using System;
+using BeWo.ServiceProxy;
+using BS.Shared.DataContracts;
+using BS.Shared.DataContracts.Compact;
+using BS.Shared.Extensions;
+using BS.Shared.Translation;
+using DevExpress.XtraScheduler;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -19,9 +25,169 @@ namespace BeWo.Scheduling.View
///
public partial class AbsenceTimesCreationView : Window
{
- public AbsenceTimesCreationView()
+ public List EmployeeList { get; set; }
+ public DateTime Start { get; set; }
+ public DateTime Ende { get; set; }
+
+ public AbsenceTimesCreationView(DateTime start, DateTime end, List customer, List employees, string notice, Appointment appointment, Action> schedulerCallback)
{
InitializeComponent();
+
+ // Wenn ein Termin im Kalender ganztägig eingetragen wird, ist das Enddatum einen Tag später als eingetragen. Die DevExpress Logik ist einfach anders als die vom BWP
+ // Beim Einsetzen in die Übertragsmaske muss das Enddatum um 1 reduziert werden, wenn der Termin ganztätig ist
+ if (appointment != null && !appointment.AllDay)
+ {
+ IsAllDay.IsChecked = false;
+ TextEditStartTime.EditValue = string.Format("{0:HH:mm}", start);
+ TextEditEndTime.EditValue = string.Format("{0:HH:mm}", end);
+
+ }
+ else
+ end = end.AddDays(-1);
+
+ EmployeeList = employees;
+
+ var allAbsenceReasons = ServiceFacade.DoOperationsServiceSync(s => s.GetAllAbsenceReason());
+ ListboxAbwesenheitskategorie.ItemsSource = allAbsenceReasons;
+
+ DateEditStartDate.EditValue = start.Date;
+ DateEditEndDate.EditValue = end.Date;
+ TextEditBemerkung.EditValue = notice;
+ }
+
+ private void ListboxAbwesenheitskategorie_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+
+ }
+
+ private void ButtonSpeichern_Click(object sender, RoutedEventArgs e)
+ {
+ bool doSave = true;
+ bool auchUeberschneidungenSpeichern = false;
+
+ // Hat der zu übertragende Termin keine Mitarbeiter in der Liste, kann auch nichts übertragen werden
+ if (EmployeeList == null || EmployeeList != null && EmployeeList.Count == 0)
+ MessageBox.Show(Translator.Translate(
+ "Der zu übertragende Termin wurde keinem Mitarbeiter zugeordnet. Der Übertrag ist so nicht möglich."), "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Information);
+ else if (ListboxAbwesenheitskategorie.SelectedItem == null)
+ MessageBox.Show(Translator.Translate(
+ "Bitte wählen Sie eine Abwesenheitskatgorie aus der Liste aus."), "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Information);
+ else
+ {
+ // Eine Liste zusammenstellen, in der alle MA drin sind, die schon eine Abwesenheit in dem Zeitraum haben, der gespeichert werden soll
+ var ueberschneidungen = PruefeAufUeberschneidungen(EmployeeList);
+
+ if (ueberschneidungen != null && ueberschneidungen.Count > 0)
+ {
+ // Namen zusammenstellen und Nutzer*in anzeigen
+ var mitarbeiterNamen = string.Join(Environment.NewLine, ueberschneidungen.Select(u => u.FirstNameLastName));
+
+ doSave = false;
+
+ var result = MessageBox.Show(Translator.Translate(
+ "Bei folgenden Mitarbeitern gibt es mind. eine Abwesenheit, die sich mit der zu übertragenden überschneidet:\n\n") + mitarbeiterNamen +
+ "\n\nSoll trotzdem auch für diese gespeichert werden?\nJa = Auch bei Überschneidung speichern\nNein = Für oben genannte nicht speichern",
+ "BeWoPlaner", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning);
+
+ // "Ja" heißt, es soll gespeichert werden und auch für die mitt einer Überschneidung
+ if (result == MessageBoxResult.Yes)
+ {
+ doSave = true;
+ auchUeberschneidungenSpeichern = true;
+ }
+ // "Nein" heißt, es soll gespeichert werden, aber die mit Überschneidung werden ausgelassen
+ else if (result == MessageBoxResult.No)
+ {
+ doSave = true;
+ }
+ // Vorgang abbrechen
+ else if (result == MessageBoxResult.Cancel)
+ {
+ doSave = false;
+ }
+ }
+ if (DateEditEndDate.EditValue == null)
+ {
+ doSave = false;
+ MessageBox.Show(Translator.Translate(
+ "Die Abwesenheit hat kein Startdatum. Ohne Startdatum kann die Abwesenheit nicht gespeichert werden"),
+ "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
+ if (DateEditEndDate.EditValue == null)
+ {
+ doSave = false;
+ if (MessageBox.Show(Translator.Translate(
+ "Die Abwesenheit hat kein Enddatum.\nBeachten Sie, dass Abwesenheiten ohne Enddatum unbegrenzt weiterlaufen und es dadurch " +
+ "zu Fehlberechnungen im Stunden- und Urlaubskonto kommen kann.\nMöchten Sie trotzdem fortfahren?"),
+ "BeWoPlaner", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
+ {
+ doSave = true;
+ }
+ }
+ if (doSave)
+ {
+ if (!auchUeberschneidungenSpeichern)
+ EmployeeList.RemoveRange(ueberschneidungen);
+
+ string bemerkung = TextEditBemerkung.EditValue != null ? TextEditBemerkung.EditValue.ToString() : "";
+ AbsenceReasonDC absReasonDC = (AbsenceReasonDC)ListboxAbwesenheitskategorie.SelectedItem;
+
+ try
+ {
+ ServiceFacade.DoEmployeeServiceSync(s => s.SpeichereKalenderterminAlsAbwesenheit(EmployeeList, absReasonDC, bemerkung, Start, Ende));
+ if (EmployeeList.Count > 0)
+ {
+ MessageBox.Show(Translator.Translate(
+ "Übertrag erfolgreich!"), "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Information);
+ }
+ else
+ MessageBox.Show(Translator.Translate(
+ "Es wurde nichts gespeichert, da es ausschließlich Überschneidungen gab."), "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Information);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(Translator.Translate(
+ "Beim Speichern gab es einen Fehler. Grund:\n" + ex.Message), "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+
+
+ this.Close();
+ }
+ }
+ }
+
+ private void ButtonAbbrechen_Click(object sender, RoutedEventArgs e)
+ {
+ var result = MessageBox.Show("Sind Sie sicher, dass Sie das Übertragen abbrechen wollen?", "", MessageBoxButton.YesNo, MessageBoxImage.Question);
+
+ if (result == MessageBoxResult.Yes)
+ this.Close();
+ }
+
+ private List PruefeAufUeberschneidungen(List employee)
+ {
+ DateTime start = (DateTime)DateEditStartDate.EditValue;
+ DateTime ende = (DateTime)DateEditEndDate.EditValue;
+ var startZeitArray = new string[2] { "00", "00" };
+ var endZeitArray = new string[2] { "00", "00" };
+ // Wenn es bestimmte Start- und Endzeiten gibt in Start- und Enddatum übernehmen
+ if (!IsAllDay.IsChecked.Value)
+ {
+ if (TextEditStartTime.EditValue != null && TextEditStartTime.EditValue.ToString() != "")
+ startZeitArray = TextEditStartTime.EditValue.ToString().Split(':');
+ if (TextEditEndTime.EditValue != null && TextEditEndTime.EditValue.ToString() != "")
+ endZeitArray = TextEditEndTime.EditValue.ToString().Split(':');
+
+ Start = new DateTime(start.Year, start.Month, start.Day, Convert.ToInt32(startZeitArray[0]), Convert.ToInt32(startZeitArray[1]), 0);
+ Ende = new DateTime(ende.Year, ende.Month, ende.Day, Convert.ToInt32(endZeitArray[0]), Convert.ToInt32(endZeitArray[1]), 0);
+ }
+ else
+ {
+ Start = start;
+ Ende = ende;
+ }
+
+ return ServiceFacade.DoEmployeeServiceSync(s => s.GetAllEmployeeMitUeberschneidendenAbwesenheiten(employee, Start, Ende));
}
}
}
diff --git a/BeWo/ServiceProxy/GeneratedEmployeeService.cs b/BeWo/ServiceProxy/GeneratedEmployeeService.cs
index 80cce9a3d..73095821d 100644
--- a/BeWo/ServiceProxy/GeneratedEmployeeService.cs
+++ b/BeWo/ServiceProxy/GeneratedEmployeeService.cs
@@ -17,6 +17,19 @@ namespace BeWo.ServiceProxy
public interface IEmployeeService
{
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEmployeeService/FindLeadingCompactTeamsOfEmployee", ReplyAction="http://tempuri.org/IEmployeeService/FindLeadingCompactTeamsOfEmployeeResponse")]
+ [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/FindLeadingCompactTeamsOfEmployeeBeWoFaultFau" +
+ "lt", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
+ System.Collections.Generic.List FindLeadingCompactTeamsOfEmployee(long employeeOid);
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEmployeeService/GetAllGroupsCompact", ReplyAction="http://tempuri.org/IEmployeeService/GetAllGroupsCompactResponse")]
+ [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/GetAllGroupsCompactBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
+ System.Collections.Generic.List GetAllGroupsCompact(System.Nullable employeeOid);
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEmployeeService/GetAllGroups", ReplyAction="http://tempuri.org/IEmployeeService/GetAllGroupsResponse")]
+ [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/GetAllGroupsBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
+ System.Collections.Generic.List GetAllGroups(System.Nullable employeeOid);
+
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEmployeeService/LoadCompactTeam", ReplyAction="http://tempuri.org/IEmployeeService/LoadCompactTeamResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/LoadCompactTeamBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
BS.Shared.DataContracts.Compact.CompactTeamDC LoadCompactTeam(long pTeamOid);
@@ -292,11 +305,6 @@ namespace BeWo.ServiceProxy
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/LoadCompactTeamsByOidBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
System.Collections.Generic.List LoadCompactTeamsByOid(System.Collections.Generic.List teamOids);
- [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEmployeeService/FindLeadingCompactTeamsOfEmployee", ReplyAction="http://tempuri.org/IEmployeeService/FindLeadingCompactTeamsOfEmployeeResponse")]
- [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/FindLeadingCompactTeamsOfEmployeeBeWoFaultFau" +
- "lt", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
- System.Collections.Generic.List FindLeadingCompactTeamsOfEmployee(long employeeOid);
-
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEmployeeService/ArchiveEmployee", ReplyAction="http://tempuri.org/IEmployeeService/ArchiveEmployeeResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/ArchiveEmployeeBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
void ArchiveEmployee(long pOid, long pVersion);
@@ -540,6 +548,19 @@ namespace BeWo.ServiceProxy
"lt", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
System.Collections.Generic.List GetAllEmployeeAbsenceTimesForYear(int year);
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEmployeeService/GetAllEmployeeMitUeberschneidendenAbwesenheit" +
+ "en", ReplyAction="http://tempuri.org/IEmployeeService/GetAllEmployeeMitUeberschneidendenAbwesenheit" +
+ "enResponse")]
+ [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/GetAllEmployeeMitUeberschneidendenAbwesenheit" +
+ "enBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
+ System.Collections.Generic.List GetAllEmployeeMitUeberschneidendenAbwesenheiten(System.Collections.Generic.List compactEmployeeList, System.DateTime newAbsEnd, System.DateTime newAbsStart);
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEmployeeService/SpeichereKalenderterminAlsAbwesenheit", ReplyAction="http://tempuri.org/IEmployeeService/SpeichereKalenderterminAlsAbwesenheitResponse" +
+ "")]
+ [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/SpeichereKalenderterminAlsAbwesenheitBeWoFaul" +
+ "tFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
+ void SpeichereKalenderterminAlsAbwesenheit(System.Collections.Generic.List compactEmployeeList, BS.Shared.DataContracts.AbsenceReasonDC reason, string notice, System.DateTime newAbsStart, System.DateTime newAbsEnd);
+
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEmployeeService/GetMultipleEmployeeAbsenceTimesForMonth", ReplyAction="http://tempuri.org/IEmployeeService/GetMultipleEmployeeAbsenceTimesForMonthRespon" +
"se")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/GetMultipleEmployeeAbsenceTimesForMonthBeWoFa" +
@@ -561,14 +582,6 @@ namespace BeWo.ServiceProxy
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEmployeeService/UpdateGroupOfPeople", ReplyAction="http://tempuri.org/IEmployeeService/UpdateGroupOfPeopleResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/UpdateGroupOfPeopleBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
long UpdateGroupOfPeople(BS.Shared.DataContracts.GroupOfPeopleDC pGroupOfPeople);
-
- [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEmployeeService/GetAllGroupsCompact", ReplyAction="http://tempuri.org/IEmployeeService/GetAllGroupsCompactResponse")]
- [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/GetAllGroupsCompactBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
- System.Collections.Generic.List GetAllGroupsCompact(System.Nullable employeeOid);
-
- [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEmployeeService/GetAllGroups", ReplyAction="http://tempuri.org/IEmployeeService/GetAllGroupsResponse")]
- [System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IEmployeeService/GetAllGroupsBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
- System.Collections.Generic.List GetAllGroups(System.Nullable employeeOid);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
@@ -605,6 +618,21 @@ namespace BeWo.ServiceProxy
{
}
+ public System.Collections.Generic.List FindLeadingCompactTeamsOfEmployee(long employeeOid)
+ {
+ return base.Channel.FindLeadingCompactTeamsOfEmployee(employeeOid);
+ }
+
+ public System.Collections.Generic.List GetAllGroupsCompact(System.Nullable employeeOid)
+ {
+ return base.Channel.GetAllGroupsCompact(employeeOid);
+ }
+
+ public System.Collections.Generic.List GetAllGroups(System.Nullable employeeOid)
+ {
+ return base.Channel.GetAllGroups(employeeOid);
+ }
+
public BS.Shared.DataContracts.Compact.CompactTeamDC LoadCompactTeam(long pTeamOid)
{
return base.Channel.LoadCompactTeam(pTeamOid);
@@ -915,11 +943,6 @@ namespace BeWo.ServiceProxy
return base.Channel.LoadCompactTeamsByOid(teamOids);
}
- public System.Collections.Generic.List FindLeadingCompactTeamsOfEmployee(long employeeOid)
- {
- return base.Channel.FindLeadingCompactTeamsOfEmployee(employeeOid);
- }
-
public void ArchiveEmployee(long pOid, long pVersion)
{
base.Channel.ArchiveEmployee(pOid, pVersion);
@@ -1205,6 +1228,16 @@ namespace BeWo.ServiceProxy
return base.Channel.GetAllEmployeeAbsenceTimesForYear(year);
}
+ public System.Collections.Generic.List GetAllEmployeeMitUeberschneidendenAbwesenheiten(System.Collections.Generic.List compactEmployeeList, System.DateTime newAbsEnd, System.DateTime newAbsStart)
+ {
+ return base.Channel.GetAllEmployeeMitUeberschneidendenAbwesenheiten(compactEmployeeList, newAbsEnd, newAbsStart);
+ }
+
+ public void SpeichereKalenderterminAlsAbwesenheit(System.Collections.Generic.List compactEmployeeList, BS.Shared.DataContracts.AbsenceReasonDC reason, string notice, System.DateTime newAbsStart, System.DateTime newAbsEnd)
+ {
+ base.Channel.SpeichereKalenderterminAlsAbwesenheit(compactEmployeeList, reason, notice, newAbsStart, newAbsEnd);
+ }
+
public System.Collections.Generic.List GetMultipleEmployeeAbsenceTimesForMonth(int year, int month, System.Collections.Generic.List empOids)
{
return base.Channel.GetMultipleEmployeeAbsenceTimesForMonth(year, month, empOids);
@@ -1229,15 +1262,5 @@ namespace BeWo.ServiceProxy
{
return base.Channel.UpdateGroupOfPeople(pGroupOfPeople);
}
-
- public System.Collections.Generic.List GetAllGroupsCompact(System.Nullable employeeOid)
- {
- return base.Channel.GetAllGroupsCompact(employeeOid);
- }
-
- public System.Collections.Generic.List GetAllGroups(System.Nullable employeeOid)
- {
- return base.Channel.GetAllGroups(employeeOid);
- }
}
}
diff --git a/Service/ServiceContracts/IEmployeeService.cs b/Service/ServiceContracts/IEmployeeService.cs
index 3d1af9954..362fd6212 100644
--- a/Service/ServiceContracts/IEmployeeService.cs
+++ b/Service/ServiceContracts/IEmployeeService.cs
@@ -242,6 +242,14 @@ namespace BeWo.Service.ServiceContracts
[OperationContract]
List GetAllEmployeeAbsenceTimesForYear(int year);
+ [FaultContract(typeof(BeWoFault))]
+ [OperationContract]
+ List GetAllEmployeeMitUeberschneidendenAbwesenheiten(List compactEmployeeList, DateTime newAbsEnd, DateTime newAbsStart);
+
+ [FaultContract(typeof(BeWoFault))]
+ [OperationContract]
+ void SpeichereKalenderterminAlsAbwesenheit(List compactEmployeeList, AbsenceReasonDC reason, string notice, DateTime newAbsStart, DateTime newAbsEnd);
+
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List GetMultipleEmployeeAbsenceTimesForMonth(int year, int month, List empOids);
diff --git a/Service/ServiceImplementations/EmployeeServiceImp.cs b/Service/ServiceImplementations/EmployeeServiceImp.cs
index 0ea6f7b44..f5827981d 100644
--- a/Service/ServiceImplementations/EmployeeServiceImp.cs
+++ b/Service/ServiceImplementations/EmployeeServiceImp.cs
@@ -1028,6 +1028,56 @@ namespace BeWo.Service.ServiceImplementations
throw Utils.CreateBeWoFaultException(e);
}
}
+ public List GetAllEmployeeMitUeberschneidendenAbwesenheiten(List compactEmployeeList, DateTime newAbsStart, DateTime newAbsEnd)
+ {
+ var result = new List();
+ var employee = DAOFactory.GenericDAO.GetByIDs(compactEmployeeList.Select(e => e.EmployeeOid));
+ foreach (var emp in employee)
+ {
+ if (emp.AbsenceTimes != null)
+ {
+ foreach (var abs in emp.AbsenceTimes)
+ {
+ // Jede vorhandene Abwesenheit auf eine Überschneidung prüfen
+ DateTime altStart = abs.Start ?? DateTime.MinValue;
+ DateTime altEnd = abs.End ?? DateTime.MaxValue;
+
+ if (newAbsEnd >= altStart && newAbsStart <= altEnd)
+ {
+ // Gibt es eine Überschneidung, diesen Mitarbeiter zum Result hinzufügen und mit dem nächsten weitermachen
+ result.Add(compactEmployeeList.First(c => c.EmployeeOid == emp.Oid));
+ break;
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+ public void SpeichereKalenderterminAlsAbwesenheit(List compactEmployeeList, AbsenceReasonDC reasonDC, string notice, DateTime newAbsStart, DateTime newAbsEnd)
+ {
+ // Da man technisch die EmployeeOid nicht mit speichern kann, wenn man in die DB insertet, muss der Employee geholt werden.
+ // In den speichert man dann eine neue AbsenceTime und dann muss der Employee geupdated werden
+ AbsenceReason reason = DAOFactory.GenericDAO.GetByID(reasonDC.AbsenceReasonOid.Value);
+ List empList = DAOFactory.GenericDAO.GetByIDs(compactEmployeeList.Select(e => e.EmployeeOid).ToList());
+
+ foreach (var emp in empList)
+ {
+ AbsenceTime absenceTime = new AbsenceTime()
+ {
+ AbsenceReason = reason,
+ CustomerOid = null,
+ EmployeeOid = emp.Oid,
+ IsActive = ActivationTypeId.Active,
+ Notice = notice,
+ Start = newAbsStart,
+ End = newAbsEnd
+ };
+ emp.AbsenceTimes.Add(absenceTime);
+ }
+
+ DAOFactory.GenericDAO.Update(empList);
+ }
public void DeactivateGroupOfPeople(long pOid, long pVersion)
{