This commit is contained in:
Lyndon Jetten
2020-08-04 12:45:46 +02:00
parent dd37254bd8
commit 57b1e3d93a
20 changed files with 522 additions and 282 deletions

View File

@@ -2070,38 +2070,64 @@ namespace BeWo.Core
}
}
public static void CreateZeiterfassung(DateTime start, DateTime end, List<CompactCustomerDC> customer, List<CompactEmployeeDC> employees, String notice)
public static void CreateZeiterfassung(DateTime start, DateTime end, List<CompactCustomerDC> customer, List<CompactEmployeeDC> employees, String notice, Appointment appointment, Action schedulerCallback)
{
ChatDokumentationsView newView;
if (customer.Count == 0)
{
//Normale Buchung
ChatDokumentationsView newView = new ChatDokumentationsView(notice, null, start, end);
newView.ShowDialog();
// Normale Buchung
newView = new ChatDokumentationsView(notice, null, start, end, schedulerCallback, appointment);
}
else if (customer.Count == 1 && employees.Count == 0)
{
var compactKlient = ServiceFacade.DoCustomerServiceSync(s => s.GetCompactCustomerDC(customer[0].CustomerOid));
//Normale Buchung
ChatDokumentationsView newView = new ChatDokumentationsView(notice, compactKlient, start, end);
newView.ShowDialog();
// Normale Buchung
newView = new ChatDokumentationsView(notice, compactKlient, start, end, schedulerCallback, appointment);
}
else
{
if (employees.Count == 0)
{
employees.Add(BeWoApp.CompactLoggedOnEmployee);
}
//gruppenbuchungen
ChatDokumentationsView newView = new ChatDokumentationsView(notice, start, end, customer, employees);
newView.ShowDialog();
// Gruppenbuchungen
newView = new ChatDokumentationsView(notice, start, end, customer, employees, schedulerCallback, appointment);
}
newView.ShowDialog();
}
public static void CreateZeiterfassung(DateTime start, DateTime end, List<CompactCustomerDC> customer, List<CompactEmployeeDC> employees, String notice)
{
ChatDokumentationsView newView;
if(customer.Count == 0)
{
// Normale Buchung
newView = new ChatDokumentationsView(notice, null, start, end);
}
else if(customer.Count == 1 && employees.Count == 0)
{
var compactKlient = ServiceFacade.DoCustomerServiceSync(s => s.GetCompactCustomerDC(customer[0].CustomerOid));
// Normale Buchung
newView = new ChatDokumentationsView(notice, compactKlient, start, end);
}
else
{
if(employees.Count == 0)
{
employees.Add(BeWoApp.CompactLoggedOnEmployee);
}
// Gruppenbuchungen
newView = new ChatDokumentationsView(notice, start, end, customer, employees);
}
newView.ShowDialog();
}
public static void OwnChatSynchronisationVeranlassen()

View File

@@ -90,6 +90,10 @@ namespace BeWo.Scheduler.Utils
return appointment.GetCustomFieldStorage()?.SchedulerAppointmentOid;
}
public static bool CF_HasServiceRecordEntry(this Appointment appointment)
{
return appointment.GetCustomFieldStorage()?.HasServiceRecordEntry ?? false;
}
@@ -164,5 +168,10 @@ namespace BeWo.Scheduler.Utils
{
appointment.GetCustomFieldStorage().TaskDescription = pTaskDescription;
}
public static void CF_HasServiceRecordEntry(this Appointment appointment, bool hasServiceRecordEntry)
{
appointment.GetCustomFieldStorage().HasServiceRecordEntry = hasServiceRecordEntry;
}
}
}

View File

@@ -29,11 +29,11 @@
<!-- Region Appointment Templates -->
<!-- Region VerticalAppointmentTemplate -->
<ControlTemplate x:Key="{dxscht:SchedulerViewThemeKey ResourceKey=VerticalAppointmentTemplate, IsThemeIndependent=true}" TargetType="{x:Type dxschint:VisualVerticalAppointmentControl}">
<!--<dxschint:AppointmentColorConvertControl x:Name="clrConvCtrl" ControlColor="{TemplateBinding ViewInfo, Converter={StaticResource AppointmentBackgroundConverter}}" SnapsToDevicePixels="True">-->
<!-- TODO: ändern! -->
<dxschint:AppointmentColorConvertControl x:Name="clrConvCtrl" ControlColor="{Binding Path=ViewInfo.CustomViewInfo[CustomFieldStorage].BackgroundColor.GradientStops[0].Color, RelativeSource={RelativeSource TemplatedParent}}" SnapsToDevicePixels="True">
<!-- Region VerticalAppointmentTemplate -->
<ControlTemplate x:Key="{dxscht:SchedulerViewThemeKey ResourceKey=VerticalAppointmentTemplate, IsThemeIndependent=true}" TargetType="{x:Type dxschint:VisualVerticalAppointmentControl}">
<!--<dxschint:AppointmentColorConvertControl x:Name="clrConvCtrl" ControlColor="{TemplateBinding ViewInfo, Converter={StaticResource AppointmentBackgroundConverter}}" SnapsToDevicePixels="True">-->
<!-- TODO: ändern! -->
<dxschint:AppointmentColorConvertControl x:Name="clrConvCtrl" ControlColor="{Binding Path=ViewInfo.CustomViewInfo[CustomFieldStorage].BackgroundColor.GradientStops[0].Color, RelativeSource={RelativeSource TemplatedParent}}" SnapsToDevicePixels="True">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="DraggedStates">
<VisualState x:Name="NotDragged">
@@ -72,33 +72,33 @@
</ToolTipService.ToolTip>
<!-- Endregion -->
<dxschint:AppointmentBorder x:Name="back" DefaultCornerRadius="4" Opacity="1" ViewInfo="{TemplateBinding ViewInfo}" Background="{Binding Path=ViewInfo.CustomViewInfo, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource AppointmentBorderZusageConverter}}">
<dxschint:AppointmentBorder DefaultCornerRadius="3" DefaultMargin="2" ViewInfo="{TemplateBinding ViewInfo}" Background="{Binding Path=ViewInfo.CustomViewInfo[CustomFieldStorage].BackgroundColor, RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="1" DefaultBorderThickness="1">
<dxschint:AppointmentBorder DefaultCornerRadius="3" DefaultMargin="2" ViewInfo="{TemplateBinding ViewInfo}" Background="{Binding Path=ViewInfo.CustomViewInfo[CustomFieldStorage].BackgroundColor, RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="1" DefaultBorderThickness="1">
<dxschint:AppointmentBorder x:Name="AppointmentBorder" DefaultCornerRadius="2" DefaultMargin="0" ViewInfo="{TemplateBinding ViewInfo}" Background="Transparent">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Width="10" CornerRadius="4,0,0,4" HorizontalAlignment="Left" SnapsToDevicePixels="True">
<Border.Background>
<MultiBinding Converter="{StaticResource EmployeeBrushConverter}">
<Binding Path="AllItems" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type view:NewSchedulerView}}" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="ViewInfo.CustomViewInfo" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type dxschint:AppointmentBorder}}" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="IsEmployeeBrushVisible" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type view:NewSchedulerView}}" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" />
</MultiBinding>
</Border.Background>
</Border>
<Border SnapsToDevicePixels="True" Background="Transparent" Grid.Column="1" />
<Border Width="10" CornerRadius="0,4,4,0" HorizontalAlignment="Right" SnapsToDevicePixels="True" Grid.Column="2">
<Border.Background>
<MultiBinding Converter="{StaticResource DickbuttConverter}">
<Binding Path="AllItems" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type view:NewSchedulerView}}" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="ViewInfo.CustomViewInfo" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type dxschint:AppointmentBorder}}" />
</MultiBinding>
</Border.Background>
</Border>
</Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Width="10" CornerRadius="4,0,0,4" HorizontalAlignment="Left" SnapsToDevicePixels="True">
<Border.Background>
<MultiBinding Converter="{StaticResource EmployeeBrushConverter}">
<Binding Path="AllItems" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type view:NewSchedulerView}}" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="ViewInfo.CustomViewInfo" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type dxschint:AppointmentBorder}}" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="IsEmployeeBrushVisible" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type view:NewSchedulerView}}" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" />
</MultiBinding>
</Border.Background>
</Border>
<Border SnapsToDevicePixels="True" Background="Transparent" Grid.Column="1" />
<Border Width="10" CornerRadius="0,4,4,0" HorizontalAlignment="Right" SnapsToDevicePixels="True" Grid.Column="2">
<Border.Background>
<MultiBinding Converter="{StaticResource DickbuttConverter}">
<Binding Path="AllItems" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type view:NewSchedulerView}}" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="ViewInfo.CustomViewInfo" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type dxschint:AppointmentBorder}}" />
</MultiBinding>
</Border.Background>
</Border>
</Grid>
</dxschint:AppointmentBorder>
</dxschint:AppointmentBorder>
</dxschint:AppointmentBorder>
@@ -129,28 +129,30 @@
</ControlTemplate>
<!--Endregion-->
<!-- Region VerticalAppointmentContentTemplate Wochenansicht etc. -->
<!-- Region VerticalAppointmentContentTemplate 1, 5 und x Tageansicht -->
<DataTemplate x:Key="{dxscht:SchedulerViewThemeKey ResourceKey=VerticalAppointmentContentTemplate, IsThemeIndependent=true}">
<Grid SnapsToDevicePixels="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" MinWidth="0" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="0,0,0,5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Subject}" TextWrapping="NoWrap" Margin="6,0,0,3" Foreground="{Binding Path=CustomViewInfo[CustomFieldStorage].ForegroundColor}" />
<TextBlock Grid.Row="1" Text="{Binding Location}" TextWrapping="Wrap" Margin="6,0,0,3" Foreground="{Binding Path=CustomViewInfo[CustomFieldStorage].ForegroundColor}" />
<TextBlock Grid.Row="0" Text="{Binding Subject}" TextWrapping="NoWrap" Margin="6,0,0,3" Foreground="{Binding Path=CustomViewInfo[CustomFieldStorage].ForegroundColor}" />
<TextBlock Grid.Row="1" Text="{Binding Location}" TextWrapping="Wrap" Margin="6,0,0,3" Foreground="{Binding Path=CustomViewInfo[CustomFieldStorage].ForegroundColor}" />
</Grid>
<dxschint:AppointmentImagesControl Grid.Column="1" ViewInfo="{Binding}" Orientation="Vertical" SnapsToDevicePixels="True" />
</Grid>
<Image Grid.Row="0" Grid.Column="2" Visibility="{Binding Path=CustomViewInfo[CustomFieldStorage].HasServiceRecordEntry, Converter={StaticResource BoolVisibilityConverter}}" Source="/BeWoPlaner;component/Ressources/Icons/HistoryDisabled.png" SnapsToDevicePixels="True" Height="20" Width="20" VerticalAlignment="Top" />
</Grid>
</DataTemplate>
<!--Endregion-->
<!-- Region Horizontal -->
<!-- HorizontalAppointmentTemplate -->
<!-- HorizontalAppointmentTemplate -->
<ControlTemplate x:Key="{dxscht:SchedulerViewThemeKey ResourceKey=HorizontalAppointmentTemplate, IsThemeIndependent=true}"
TargetType="{x:Type dxschint:VisualHorizontalAppointmentControl}">
<dxschint:AppointmentColorConvertControl x:Name="clrConvCtrl" SnapsToDevicePixels="True" ControlColor="{Binding Path=ViewInfo.CustomViewInfo[CustomFieldStorage].BackgroundColor.GradientStops[0].Color, RelativeSource={RelativeSource TemplatedParent}}">

View File

@@ -7,7 +7,6 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
@@ -37,7 +36,7 @@ using DevExpress.Xpf.Editors;
using DevExpress.Xpf.Scheduler;
using DevExpress.Xpf.Scheduler.Reporting;
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.Compatibility;
using Appointment = DevExpress.XtraScheduler.Appointment;
using AppointmentViewInfoCustomizingEventArgs = DevExpress.Xpf.Scheduler.AppointmentViewInfoCustomizingEventArgs;
using ColorConverter = System.Windows.Media.ColorConverter;
@@ -974,14 +973,14 @@ namespace BeWo.Scheduler.View
private void NewSchedulerStorage_AppointmentsChanged(object sender, PersistentObjectsEventArgs e)
{
if (IgnoreChangeEvents)
if (IgnoreChangeEvents || IgnoreManualAppointmentCreation)
{
return;
}
WriteToDebug("AppointmentsChanged, bitch");
Debug.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NewSchedulerStorage_AppointmentsChanged");
var appList = e.Objects.Cast<Appointment>().ToList();
var appList = e.Objects.Cast<Appointment>().ToList();
if (appList.Any(f => f.CF_IsPrivate()))
{
@@ -1051,6 +1050,11 @@ namespace BeWo.Scheduler.View
private void NewSchedulerStorage_AppointmentsInserted(object sender, PersistentObjectsEventArgs e)
{
if(IgnoreManualAppointmentCreation)
{
return;
}
var appList = e.Objects.Cast<Appointment>().ToList();
if(appList.Any(f => f.CF_IsPrivate()))
@@ -1058,7 +1062,7 @@ namespace BeWo.Scheduler.View
ShowPrivateAppointmentsCheckBox.IsChecked = true;
}
ViewModel.ActiveAppointmentViewModel.InsertAppointments(Scheduler, appList);
ViewModel.ActiveAppointmentViewModel.InsertAppointments(Scheduler, appList);
UpdateRequestString();
ReloadVM(true);
}
@@ -1550,53 +1554,77 @@ namespace BeWo.Scheduler.View
return;
}
var app = Scheduler.SelectedAppointments[0];
var appointment = Scheduler.SelectedAppointments.FirstOrDefault();
var e2aList = app.CF_EmployeeList();
var customerList = app.CF_CustomerList();
if(appointment == null)
{
return;
}
var empList = e2aList.Select(e2a => e2a.Employee).ToList();
var employee2SchedulerAppointmentList = appointment.CF_EmployeeList();
var customerList = appointment.CF_CustomerList();
var employeeList = employee2SchedulerAppointmentList.Select(employee2SchedulerAppointment => employee2SchedulerAppointment.Employee).ToList();
BeWoUtils.CreateZeiterfassung(app.Start, app.End, customerList, empList, app.Subject);
//var employ = SelectedMitarbeiter.Items;
//var y = SelectedKlient.Items;
BeWoUtils.CreateZeiterfassung(appointment.Start, appointment.End, customerList, employeeList, appointment.Subject, appointment, () =>
{
try
{
IgnoreManualAppointmentCreation = true;
IgnoreChangeEvents = true;
var schedulerAppointment = (SchedulerAppointmentVM) appointment.GetSourceObject(Scheduler.GetCoreStorage());
//if (y.Count == 0)
//{
// MessageBox.Show("Bitte wählen Sie mindestens einen Klienten aus!");
//}
//else
//{
// var startDate = StartDate.DateTime;
// var startTime = DateTime.Parse(StartTime.Text);
var appointmentOid = schedulerAppointment?.CommitToDataContract().SchedulerAppointmentOid;
// var endDate = EndDate.DateTime;
// var endTime = DateTime.Parse(EndTime.Text);
if(appointmentOid.HasValue)
{
appointment.CF_HasServiceRecordEntry(true);
// DateTime start = new DateTime(startDate.Year, startDate.Month, startDate.Day, startTime.Hour, startTime.Minute, startTime.Second);
// DateTime end = new DateTime(endDate.Year, endDate.Month, endDate.Day, endTime.Hour, endTime.Minute, endTime.Second);
ViewModel.ActiveAppointmentViewModel.SaveAppointments(Scheduler, new List<Appointment> {appointment});
// List<CompactCustomerDC> customerlist = new List<CompactCustomerDC>();
// List<CompactEmployeeDC> employeelist = new List<CompactEmployeeDC>();
ReloadVM(true);
}
else
{
// Serientermin!
var recurrenceInfo = appointment.RecurrenceInfo;
// foreach (var employee in employ)
// {
// var xy = (Employee2SchedulerAppointmentDC)employee;
// employeelist.Add(xy.Employee);
// }
var pattern = StaticAppointmentFactory.CreateAppointment(AppointmentType.Pattern);
pattern.RecurrenceInfo.FromXml(recurrenceInfo.ToXml());
// foreach (var klient in y)
// {
// var s = (CompactCustomerDC)klient;
// customerlist.Add(s);
// }
var apt = appointment.RecurrencePattern.CreateException(AppointmentType.ChangedOccurrence, appointment.RecurrenceIndex);
// BeWoUtils.CreateZeiterfassung(start, end, customerlist, employeelist, Notice.Text);
//}
apt.Duration = appointment.Duration;
apt.End = apt.Start.Add(appointment.Duration);
apt.Subject = appointment.Subject;
apt.Location = appointment.Location;
apt.Description = appointment.Description;
Scheduler.Storage.AppointmentStorage.CreateCustomFields(apt);
apt.CustomFields[nameof(CustomFieldStorage)] = appointment.CustomFields[nameof(CustomFieldStorage)];
apt.CF_HasServiceRecordEntry(true);
ViewModel.ActiveAppointmentViewModel.InsertAppointments(Scheduler, new List<Appointment> {apt});
IgnoreChangeEvents = true;
ReloadVM(true);
}
}
finally
{
IgnoreManualAppointmentCreation = false;
IgnoreChangeEvents = false;
}
});
}
private bool IgnoreManualAppointmentCreation { get; set; }
private void MeinTB_OnChecked(object sender, RoutedEventArgs e)
{
var tb = (ToggleButton) sender;
@@ -2349,7 +2377,6 @@ namespace BeWo.Scheduler.View
}
}
private static void WriteToDebug(string pText)
{
Debug.WriteLine($"-----------------------> {pText}");

View File

@@ -103,6 +103,8 @@ namespace BeWo.Scheduler.ViewModel
_AbsenceTimeStart = pAppointment.AbsenceTimeStart;
_AbsenceTimeEnd = pAppointment.AbsenceTimeEnd;
HasServiceRecordEntry = pAppointment.HasServiceRecordEntry;
}
public CustomFieldStorage(SchedulerAppointmentDC pAppointment)
@@ -129,6 +131,8 @@ namespace BeWo.Scheduler.ViewModel
RecurrenceId = pAppointment.RecurrenceId;
RecurrenceIndex = pAppointment.RecurrenceIndex;
HasServiceRecordEntry = pAppointment.HasServiceRecordEntry;
}
public CustomFieldStorage(ObservableCollection<Employee2SchedulerAppointmentDC> pEmployees, List<CompactCustomerDC> pCustomers, List<ResourceDC> pResources, CompactEmployeeDC pOriginator, bool pIsPrivate, bool pIsTask, string pTaskDescription, DateTime? pDueDate, DateTime? pCompletedDate, string pCompletedNotice, List<CompactSupportConceptDC> pSupportConcepts, string pSubject, bool pIsAllDay)
@@ -162,5 +166,7 @@ namespace BeWo.Scheduler.ViewModel
public Visibility ToolTipTrennstrichVisibility => EmployeeList?.Count > 0 || CustomerList?.Count > 0 || ResourceList?.Count > 0 ? Visibility.Visible : Visibility.Collapsed;
public Visibility ToolTipZusageVisibility => IsTask ? Visibility.Collapsed : Visibility.Visible;
public bool HasServiceRecordEntry { get; set; }
}
}

View File

@@ -137,20 +137,27 @@ namespace BeWo.Scheduler.ViewModel
}
public void SaveAppointments(SchedulerControl control, IEnumerable<Appointment> list)
{
{
var areEqual = false;
var dcList = new List<SchedulerAppointmentDC>();
foreach (var item in list)
{
var vm = item.GetSourceObject(control.GetCoreStorage()) as SchedulerAppointmentVM;
if (vm == null)
{
if (!(item.GetSourceObject(control.GetCoreStorage()) is SchedulerAppointmentVM vm))
{
continue;
continue;
}
UpdateSchedulerAppointment(item, vm);
if(vm.ResourceList.Any())
{
if(!CheckForUnavailableResources(vm))
{
return;
}
}
if (!ShouldLockOverlappingAppointmentCheck && vm.EventType != 3 && !vm.IsTask)
{
var isOverlapping = false;
@@ -167,7 +174,7 @@ namespace BeWo.Scheduler.ViewModel
if (isOverlapping)
{
var erg = MessageBox.Show("Dieser Termin überschneidet sich mit einem anderen bereits existierenden Termin.\n Möchten Sie ihn wirklich speichern?", "Überschneidung", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
var erg = MessageBox.Show("Dieser Termin überschneidet sich mit einem anderen bereits existierenden Termin.\nMöchten Sie ihn wirklich speichern?", "Überschneidung", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
if (erg.Equals(MessageBoxResult.No))
{
@@ -202,17 +209,55 @@ namespace BeWo.Scheduler.ViewModel
public void InsertAppointments(SchedulerControl control, IEnumerable<Appointment> list)
{
var dcList = new List<SchedulerAppointmentDC>();
var dcList = new List<SchedulerAppointmentDC>();
foreach (var item in list)
{
var vm = item.GetSourceObject(control.GetCoreStorage()) as SchedulerAppointmentVM;
if (vm == null)
{
if (!(item.GetSourceObject(control.GetCoreStorage()) is SchedulerAppointmentVM vm))
{
continue;
if(item.IsException && item.CF_HasServiceRecordEntry())
{
var dc = new SchedulerAppointmentDC
{
IsPrivate = item.CF_IsPrivate(),
Subject = item.Subject,
Description = item.Description,
StartDate = item.Start,
EndDate = item.End,
Originator = item.CF_Originator(),
LabelId = item.LabelId,
AllDay = item.AllDay,
Status = item.StatusId,
Type = (int) item.Type,
Location = item.Location,
RecurrenceInfo = item.RecurrenceInfo.ToXml(),
ReminderInfo = item.Reminder?.ToXml(),
CustomerList = item.CF_CustomerList(),
EmployeeList = item.CF_EmployeeList().ToList(),
ResourceList = item.CF_ResourceList(),
SupportConceptList = item.CF_SupportConceptList(),
RecurrenceIndex = item.RecurrenceIndex,
RecurrenceId = item.RecurrenceInfo.Id.ToString(),
HasServiceRecordEntry = item.CF_HasServiceRecordEntry()
};
vm = new SchedulerAppointmentVM(dc);
}
else
{
continue;
}
}
UpdateSchedulerAppointment(item, vm);
if(vm.ResourceList.Any())
{
if(!CheckForUnavailableResources(vm))
{
return;
}
}
if (!ShouldLockOverlappingAppointmentCheck && !vm.IsTask)
{
var isOverlapping = false;
@@ -228,7 +273,7 @@ namespace BeWo.Scheduler.ViewModel
if (isOverlapping)
{
var erg = MessageBox.Show("Dieser Termin überschneidet sich mit einem anderen bereits existierenden Termin.\n Möchten Sie ihn wirklich speichern?", "Überschneidung", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
var erg = MessageBox.Show("Dieser Termin überschneidet sich mit einem anderen bereits existierenden Termin.\nMöchten Sie ihn wirklich speichern?", "Überschneidung", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
if (erg.Equals(MessageBoxResult.No))
{
@@ -266,6 +311,7 @@ namespace BeWo.Scheduler.ViewModel
vm.CompletedNotice = app.CF_CompletedNotice();
vm.TaskDescription = app.CF_TaskDescription();
vm.SupportConceptList = app.CF_SupportConceptList();
vm.HasServiceRecordEntry = app.CF_HasServiceRecordEntry();
if(vm.IsTask)
{
@@ -594,6 +640,39 @@ namespace BeWo.Scheduler.ViewModel
return areEqual;
}
private static bool CheckForUnavailableResources(SchedulerAppointmentVM vm)
{
var unavailableResources = new List<ResourceDC>();
ServiceFacade.DoResourceServiceSync(s => unavailableResources = s.CheckResourceAvailability(vm.Start, vm.End, vm.ResourceList.Select(resource => resource.ResourceOid.Value).ToList(), null));
if(unavailableResources.Any())
{
var names = string.Empty;
unavailableResources.DoForEach(resource => names += resource.Name + ", ");
names = names.TrimEnd(' ').TrimEnd(',');
var resourceCount = vm.ResourceList.Count;
var warningMessage = unavailableResources.Count > 1 ?
$"Ein{(resourceCount > 1 ? "ige" : "e")} der ausgewählten Ressourcen ({names}) sind" :
$"{(resourceCount > 1 ? "Eine der" : "Die")} ausgewählte{(resourceCount > 1 ? "n" : string.Empty)} Ressource{(resourceCount > 1 ? "n" : string.Empty)} ({names}) ist";
warningMessage += $" zum gewählten Zeitpunkt ({vm.Start.GetIntervalDescription(vm.End).TrimStart(' ')}) nicht verfügbar.\n\nMöchten Sie trotzdem speichern?";
var erg = MessageBox.Show(warningMessage, "Überschneidung", MessageBoxButton.YesNo);
if(erg.Equals(MessageBoxResult.No))
{
return false;
}
}
return true;
}
}
}

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using BeWo.ViewModel;
@@ -58,7 +57,25 @@ namespace BeWo.Scheduler.ViewModel
private DateTime? _CompletedDate;
private DateTime? _DueDate;
private DateTime? _DueTime;
public DateTime? AbsenceTimeStart { get; set; }
private bool _HasServiceRecordEntry;
public bool HasServiceRecordEntry
{
get => _HasServiceRecordEntry;
set
{
if(AreDifferent(_HasServiceRecordEntry, value))
{
_HasServiceRecordEntry = value;
StoreDirtyInformation(AreDifferent(DataContract.HasServiceRecordEntry, value), nameof(HasServiceRecordEntry));
FirePropertyChanged(nameof(HasServiceRecordEntry));
}
}
}
public DateTime? AbsenceTimeStart { get; set; }
public DateTime? AbsenceTimeEnd { get; set; }
public object Id { get; set; }
@@ -545,27 +562,29 @@ namespace BeWo.Scheduler.ViewModel
protected override void InitByDataContract(SchedulerAppointmentDC pDataContract)
{
_AllDay = pDataContract.AllDay;
_Description = pDataContract.Description;
_End = pDataContract.EndDate ?? DateTime.Now;
_Location = pDataContract.Location;
_RecurrenceInfo = pDataContract.RecurrenceInfo;
_Start = pDataContract.StartDate ?? DateTime.Now;
_Status = pDataContract.Status;
_Subject = pDataContract.Subject;
_Type = pDataContract.Type;
_IsPrivate = pDataContract.IsPrivate;
_Originator = pDataContract.Originator;
_CustomerList = pDataContract.CustomerList ?? new List<CompactCustomerDC>();
_EmployeeList = new ObservableCollection<Employee2SchedulerAppointmentDC>(pDataContract.EmployeeList ?? new List<Employee2SchedulerAppointmentDC>());
_ResourceList = pDataContract.ResourceList ?? new List<ResourceDC>();
_IsTask = pDataContract.IsTask;
_TaskDescription = pDataContract.TaskDescription;
_CompletedNotice = pDataContract.CompletedNotice;
_CompletedDate = pDataContract.CompletedDate;
_SupportConceptList = pDataContract.SupportConceptList ?? new List<CompactSupportConceptDC>();
_AllDay = pDataContract.AllDay;
_Description = pDataContract.Description;
_End = pDataContract.EndDate ?? DateTime.Now;
_Location = pDataContract.Location;
_RecurrenceInfo = pDataContract.RecurrenceInfo;
_Start = pDataContract.StartDate ?? DateTime.Now;
_Status = pDataContract.Status;
_Subject = pDataContract.Subject;
_Type = pDataContract.Type;
_IsPrivate = pDataContract.IsPrivate;
_Originator = pDataContract.Originator;
_CustomerList = pDataContract.CustomerList ?? new List<CompactCustomerDC>();
_EmployeeList = new ObservableCollection<Employee2SchedulerAppointmentDC>(pDataContract.EmployeeList ?? new List<Employee2SchedulerAppointmentDC>());
_ResourceList = pDataContract.ResourceList ?? new List<ResourceDC>();
_IsTask = pDataContract.IsTask;
_TaskDescription = pDataContract.TaskDescription;
_CompletedNotice = pDataContract.CompletedNotice;
_CompletedDate = pDataContract.CompletedDate;
_SupportConceptList = pDataContract.SupportConceptList ?? new List<CompactSupportConceptDC>();
_HasServiceRecordEntry = pDataContract.HasServiceRecordEntry;
if(pDataContract.DueDate.HasValue)
if(pDataContract.DueDate.HasValue)
{
_DueDate = pDataContract.DueDate;
_DueTime = pDataContract.DueDate;
@@ -574,27 +593,29 @@ namespace BeWo.Scheduler.ViewModel
protected override SchedulerAppointmentDC MapToDataContract(SchedulerAppointmentDC pDataContract, bool doCommit)
{
pDataContract.AllDay = _AllDay;
pDataContract.Description = _Description;
pDataContract.EndDate = _End;
pDataContract.Location = _Location;
pDataContract.RecurrenceInfo = _RecurrenceInfo;
pDataContract.StartDate = _Start;
pDataContract.Status = _Status;
pDataContract.Subject = _Subject;
pDataContract.Type = _Type;
pDataContract.IsPrivate = _IsPrivate;
pDataContract.Originator = _Originator;
pDataContract.CustomerList = _CustomerList;
pDataContract.EmployeeList = _EmployeeList.ToList();
pDataContract.ResourceList = _ResourceList;
pDataContract.IsTask = _IsTask;
pDataContract.TaskDescription = _TaskDescription;
pDataContract.CompletedNotice = _CompletedNotice;
pDataContract.CompletedDate = _CompletedDate;
pDataContract.SupportConceptList = _SupportConceptList;
pDataContract.AllDay = _AllDay;
pDataContract.Description = _Description;
pDataContract.EndDate = _End;
pDataContract.Location = _Location;
pDataContract.RecurrenceInfo = _RecurrenceInfo;
pDataContract.StartDate = _Start;
pDataContract.Status = _Status;
pDataContract.Subject = _Subject;
pDataContract.Type = _Type;
pDataContract.IsPrivate = _IsPrivate;
pDataContract.Originator = _Originator;
pDataContract.CustomerList = _CustomerList;
pDataContract.EmployeeList = _EmployeeList.ToList();
pDataContract.ResourceList = _ResourceList;
pDataContract.IsTask = _IsTask;
pDataContract.TaskDescription = _TaskDescription;
pDataContract.CompletedNotice = _CompletedNotice;
pDataContract.CompletedDate = _CompletedDate;
pDataContract.SupportConceptList = _SupportConceptList;
pDataContract.HasServiceRecordEntry = _HasServiceRecordEntry;
if(_DueDate.HasValue && _DueTime.HasValue)
if(_DueDate.HasValue && _DueTime.HasValue)
{
pDataContract.DueDate = new DateTime(_DueDate.Value.Year, _DueDate.Value.Month, _DueDate.Value.Day, _DueTime.Value.Hour, _DueTime.Value.Minute, 0);
}
@@ -657,7 +678,8 @@ namespace BeWo.Scheduler.ViewModel
Equals(EndTime, obj.EndTime) &&
Equals(Location, obj.Location) &&
ResourceList.AreEqual(obj.ResourceList) &&
Equals(RecurrenceInfo, obj.RecurrenceInfo);
Equals(RecurrenceInfo, obj.RecurrenceInfo) &&
HasServiceRecordEntry == obj.HasServiceRecordEntry;
return areEqual;
}

View File

@@ -7,9 +7,6 @@ using BS.Shared.Extensions;
using System.Windows.Controls;
using System.Windows.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using BeWo.Core.Service;
using BeWo.View;
using BeWo.View.Detail;
@@ -17,14 +14,14 @@ using BeWo.ViewModel.ListViewModel;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Translation;
using ChatController.ChatKlassen;
using DevExpress.XtraScheduler;
namespace BeWo.ownChat
{
public partial class ChatDokumentationsView
{
private ServiceRecordVM serviceRecord;
private ServiceRecordVM _ServiceRecord;
public ChatDokumentationsView() {}
@@ -32,14 +29,14 @@ namespace BeWo.ownChat
{
InitializeComponent();
this.serviceRecord = serviceRecord;
_ServiceRecord = serviceRecord;
var newView = new ServiceRecordEditView();
newView.InitView(list, serviceRecord, false);
newView.SetSearchText(serviceRecord.Customer != null ? serviceRecord.Customer.LastName : "");
CommandBindingsCloseSave(newView);
CommandBindingsCloseSave(newView, null);
Popup_Content(newView);
}
@@ -105,11 +102,11 @@ namespace BeWo.ownChat
//}
//Konstruktor für Kalender
public ChatDokumentationsView(string notice, CompactCustomerDC _compactCustomer, DateTime firstTime, DateTime lastTime)
public ChatDokumentationsView(string notice, CompactCustomerDC _compactCustomer, DateTime firstTime, DateTime lastTime, Action schedulerCallback = null, Appointment appointment = null)
{
InitializeComponent();
CompactCustomerDC customerCompact = _compactCustomer;
var customerCompact = _compactCustomer;
Cache.GetInstance().GetActiveSupportConceptCostbearer(scList =>
VMFactory.CreateServiceRecordVMAsync(
@@ -117,7 +114,7 @@ namespace BeWo.ownChat
vm => this.Dispatch(
delegate
{
ServiceRecordEditView newView = new ServiceRecordEditView();
var serviceRecordEditView = new ServiceRecordEditView();
vm.DispatcherObject = this;
@@ -131,101 +128,92 @@ namespace BeWo.ownChat
dc.ServiceDescription = vm.PrototypeVM.Category2Services[cat1][0];
}
serviceRecord = new ServiceRecordVM(dc, vm.PrototypeVM.Category2Services, vm.PrototypeVM.AllGoalCategories, vm.PrototypeVM.AllGoals);
serviceRecord.Notice = notice;
bool hideCustomerCombo = serviceRecord.SupportConcept == null;
newView.InitView(vm, serviceRecord, hideCustomerCombo);
if(customerCompact != null)
{
newView.SetSearchText(customerCompact.LastName);
}
else
{
newView.SetSearchText("");
}
_ServiceRecord = new ServiceRecordVM(dc, vm.PrototypeVM.Category2Services, vm.PrototypeVM.AllGoalCategories, vm.PrototypeVM.AllGoals) {Notice = notice};
var hideCustomerCombo = _ServiceRecord.SupportConcept == null;
serviceRecordEditView.InitView(vm, _ServiceRecord, hideCustomerCombo);
CommandBindingsCloseSave(newView);
serviceRecordEditView.SetSearchText(customerCompact != null ? customerCompact.LastName : "");
Popup_Content(newView);
CommandBindingsCloseSave(serviceRecordEditView, schedulerCallback);
Popup_Content(serviceRecordEditView);
})));
}
//GruppenBuchung Konstruktor für Kalender
public ChatDokumentationsView(string notice, DateTime firstTime,DateTime lastTime ,List<CompactCustomerDC> _compactCustomer, List<CompactEmployeeDC> _compactEmployee)
public ChatDokumentationsView(string notice, DateTime firstTime, DateTime lastTime, List<CompactCustomerDC> _compactCustomer, List<CompactEmployeeDC> _compactEmployee, Action schedulerCallback = null, Appointment appointment = null)
{
InitializeComponent();
var customerCompact = _compactCustomer[0];
Cache.GetInstance().GetActiveSupportConceptCostbearer(scList =>
VMFactory.CreateServiceRecordVMAsync(
BeWoApp.LoggedOnUser.Employee.EmployeeOid,
vm => this.Dispatch(
delegate
{
ServiceRecordGroupEditView newView = new ServiceRecordGroupEditView();
var newView = new ServiceRecordGroupEditView();
vm.DispatcherObject = this;
var group = new ServiceRecordGroupDC();
group.StartDate = firstTime;
group.EndDate = lastTime;
group.CustomerCount = _compactCustomer.Count;
group.EmployeeCount = _compactEmployee.Count;
group.Notice = notice;
List<ServiceRecordDC> ServiceListRecordDC = new List<ServiceRecordDC>();
var serviceRecordGroup = new ServiceRecordGroupDC
{
StartDate = firstTime,
EndDate = lastTime,
CustomerCount = _compactCustomer.Count,
EmployeeCount = _compactEmployee.Count,
Notice = notice
};
var serviceRecordList = new List<ServiceRecordDC>();
foreach (var emp in _compactEmployee)
{
foreach (var cus in _compactCustomer)
{
var sc = SupportConceptService.HoleHilfeplanAusListe(scList, cus, firstTime, lastTime);
if (sc != null)
var supportConcept = SupportConceptService.HoleHilfeplanAusListe(scList, cus, firstTime, lastTime);
if (supportConcept != null)
{
var dcs = new ServiceRecordDC();
dcs.Start = firstTime;
dcs.End = lastTime;
dcs.Employee = emp;
dcs.Customer = cus;
dcs.SupportConcept = SupportConceptService.HoleHilfeplanAusListe(scList, cus, firstTime, lastTime);
dcs.GroupEmployeeCount = _compactEmployee.Count;
dcs.GroupPersonCount = _compactCustomer.Count;
var serviceRecord = new ServiceRecordDC
{
Start = firstTime,
End = lastTime,
Employee = emp,
Customer = cus,
SupportConcept = SupportConceptService.HoleHilfeplanAusListe(scList, cus, firstTime, lastTime),
GroupEmployeeCount = _compactEmployee.Count,
GroupPersonCount = _compactCustomer.Count
};
if (BeWoApp.AppSettings.IsEndDateVisible)
{
dcs.ServiceRecordFormat = ServiceRecordFormate.ZeiterfassungMitEndDatum;
serviceRecord.ServiceRecordFormat = ServiceRecordFormate.ZeiterfassungMitEndDatum;
}
else if (BeWoApp.AppSettings.IsOnlyYearMonthVisible)
{
dcs.ServiceRecordFormat =
serviceRecord.ServiceRecordFormat =
ServiceRecordFormate.ZeiterfassungMitMonatJahr;
}
else
{
dcs.ServiceRecordFormat = ServiceRecordFormate.OriginaleZeiterfassung;
serviceRecord.ServiceRecordFormat = ServiceRecordFormate.OriginaleZeiterfassung;
}
dcs.DurationInStunden = ZeiterfassungsDauer.Minuten;
serviceRecord.DurationInStunden = ZeiterfassungsDauer.Minuten;
if (dcs.SupportConcept.CostBearerList != null &&
dcs.SupportConcept.CostBearerList.Count > 0)
if (serviceRecord.SupportConcept.CostBearerList != null && serviceRecord.SupportConcept.CostBearerList.Count > 0)
{
dcs.CostBearer = dcs.SupportConcept.CostBearerList[0].Organisation;
serviceRecord.CostBearer = serviceRecord.SupportConcept.CostBearerList[0].Organisation;
}
ServiceListRecordDC.Add(dcs);
serviceRecordList.Add(serviceRecord);
}
}
}
if (ServiceListRecordDC.Count == 0)
if (serviceRecordList.Count == 0)
{
MessageBox.Show(
"Es wurden keine laufenden Hilfepläne für die ausgewählten Klienten gefunden. Die Übernahme in die Zeiterfassung ist nicht möglich.",
@@ -233,22 +221,19 @@ namespace BeWo.ownChat
Close();
return;
}
group.ServiceRecordList = ServiceListRecordDC;
serviceRecordGroup.ServiceRecordList = serviceRecordList;
if (vm.PrototypeVM.SortedCategories != null && vm.PrototypeVM.SortedCategories.Count > 0)
{
var cat1 = vm.PrototypeVM.SortedCategories[0];
ServiceListRecordDC[0].ServiceDescription = vm.PrototypeVM.Category2Services[cat1][0];
serviceRecordList[0].ServiceDescription = vm.PrototypeVM.Category2Services[cat1][0];
}
serviceRecord = new ServiceRecordVM(ServiceListRecordDC[0], vm.PrototypeVM.Category2Services, vm.PrototypeVM.AllGoalCategories, vm.PrototypeVM.AllGoals);
serviceRecord.Notice = notice;
newView.InitView(vm, serviceRecord, group);
_ServiceRecord = new ServiceRecordVM(serviceRecordList[0], vm.PrototypeVM.Category2Services, vm.PrototypeVM.AllGoalCategories, vm.PrototypeVM.AllGoals) {Notice = notice};
newView.InitView(vm, _ServiceRecord, serviceRecordGroup);
if (newView.CommandBindings.Count == 0)
{
@@ -269,7 +254,7 @@ namespace BeWo.ownChat
ApplicationCommands.Save,
(s, e) =>
{
bool save = newView.IsValid();
var save = newView.IsValid();
if (!save)
{
@@ -277,20 +262,18 @@ namespace BeWo.ownChat
}
newView.SaveData();
schedulerCallback?.Invoke();
Close();
}));
}
popup_contentChat.Child = newView;
popup_contentChat.Visibility = Visibility.Visible;
})));
}
private void CommandBindingsCloseSave(ServiceRecordEditView newView)
private void CommandBindingsCloseSave(ServiceRecordEditView newView, Action schedulerCallback)
{
if (newView.CommandBindings.Count == 0)
{
@@ -311,32 +294,33 @@ namespace BeWo.ownChat
ApplicationCommands.Save,
(s, e) =>
{
bool save = newView.IsValid();
var isValid = newView.IsValid();
if (!save)
if (!isValid)
{
return;
}
newView.SaveData();
Close();
// TODO: Callback einbauen, das den Termin verändert (vom Kalender übergeben)
if(newView.SaveData())
{
schedulerCallback?.Invoke();
}
Close();
}));
}
}
private void Popup_Content( ServiceRecordEditView newView)
private void Popup_Content(UIElement serviceRecordEditView)
{
popup_contentChat.Child = newView;
popup_contentChat.Child = serviceRecordEditView;
popup_contentChat.Visibility = Visibility.Visible;
}
private void RootGroupBox_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
try
@@ -348,7 +332,6 @@ namespace BeWo.ownChat
}
}
private DateTime ConvertToDateTimeStart(string startTime)
{

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.Mvc;
@@ -61,6 +62,19 @@ namespace BeWoPlanerMobil.Controllers
private static readonly List<ValueListEntryType> _Zieltypen = new List<ValueListEntryType> { ValueListEntryType.SupportConceptGoalCategoryType, ValueListEntryType.SupportConceptIndividualGoalCategoryType };
private static readonly List<ValueListEntryType> _Massnahmentypen = new List<ValueListEntryType> { ValueListEntryType.SupportConceptGoalType, ValueListEntryType.SupportConceptIndividualGoalType };
private MandatorDC GetMandator()
{
var mandator = (MandatorDC)HttpContext.Session["mandator"];
if(mandator == null)
{
mandator = OperationsService.GetMandator();
HttpContext.Session["mandator"] = mandator;
}
return mandator;
}
[Authorize]
public ActionResult Main()
{
@@ -81,7 +95,8 @@ namespace BeWoPlanerMobil.Controllers
Model.ShowExpiredSupportConcepts = GetUserSettingValue("ShowExpiredSupportConcepts") == "1";
Model.ShowOnlyOwnSupportConcepts = GetUserSettingValue("ShowOnlyMySupportConcepts") == "1";
var mandator = OperationsService.GetMandator();
var mandator = GetMandator();
var supportConceptExpirationLimitInMonths = GetSettingValue(mandator.Settings, "HilfeplanAuslaufAuswahl");
var anzTageZeiterfassErfolgt = GetSettingValue(mandator.Settings, "AnzTageZeiterfassErfolgt");
var maxDaysEditServiceRecordsAllowed = GetSettingValue(mandator.Settings, "MaxDaysEditServiceRecordsAllowed");
@@ -359,7 +374,7 @@ namespace BeWoPlanerMobil.Controllers
return SerializeObject(goalTree);
}
private static List<GoalTreeItem> BuildGoalTree(List<ValueListEntryDC> goals)
private static List<GoalTreeItem> BuildGoalTree(IReadOnlyCollection<ValueListEntryDC> goals)
{
var ziele = goals.Where(w => _Zieltypen.Contains(w.Type)).OrderBy(s => s.TypeDescription).ToList();
var massnahmen = goals.Where(w => _Massnahmentypen.Contains(w.Type)).OrderBy(s => s.TypeDescription).ToList();
@@ -859,7 +874,7 @@ namespace BeWoPlanerMobil.Controllers
if(Model.Dokutypes != null && Model.Dokutypes.Length > 1)
{
doku1 = collection["Dokumentation"];
doku1 = collection["Dokumentation1"];
}
else
{
@@ -1489,6 +1504,13 @@ namespace BeWoPlanerMobil.Controllers
private void LoadServiceCategoriesToModel(long? cb2ScOid)
{
if(cb2ScOid == null && Model.IsInGroupBookingMode)
{
Model.ServiceCategories = CreateServiceCategoryModels(OperationsService.GetAllServiceDescriptions());
return;
}
Model.CostBearer2SupportConceptOid = cb2ScOid;
Model.SelectedSupportConcept =
Model.SupportConcepts.FirstOrDefault(
@@ -1644,7 +1666,13 @@ namespace BeWoPlanerMobil.Controllers
recordsOhneDuplikate.Add(r);
}
Model.ServiceRecords = recordsOhneDuplikate;
Model.ServiceRecords = recordsOhneDuplikate.Where(serviceRecord => serviceRecord.Start.HasValue && serviceRecord.End.HasValue)
.OrderBy(serviceRecord => serviceRecord.Start.Value.Date)
.ThenBy(serviceRecord => serviceRecord.Start.Value.Hour)
.ThenBy(serviceRecord => serviceRecord.Start.Value.Minute)
.ThenBy(serviceRecord => serviceRecord.End.Value.Date)
.ThenBy(serviceRecord => serviceRecord.End.Value.Hour)
.ThenBy(serviceRecord => serviceRecord.End.Value.Minute).ToList();
}
[HttpPost]
@@ -1810,7 +1838,7 @@ namespace BeWoPlanerMobil.Controllers
}
}
var mandator = OperationsService.GetMandator();
var mandator = GetMandator();
var maxDaysEditSRsAllowedString = GetSettingValue(mandator.Settings, "MaxDaysEditServiceRecordsAllowed");
var limitFuerZeiterfassungString = GetSettingValue(mandator.Settings, "AnzTageZeiterfassErfolgt");
@@ -2115,6 +2143,12 @@ namespace BeWoPlanerMobil.Controllers
return RedirectToAction("Main");
}
/// <summary>
/// Setzt die getroffenen Auswahlen zurück
/// </summary>
/// <param name="pIsInGroupBookingMode">
/// Wenn true, wird davon ausgegangen, dass man von der Einzelbuchung in eine Gruppenbuchung wechselt und es wird sich der vorher ausgewählte Mitarbeiter und Hilfeplan gemerkt.
/// Bei false wird davon ausgegangen, dass man von der Gruppenbuchung in eine Einzelbuchung wechselt und der vorher ausgewählte Mitarbeiter und Hilfeplan wird automatisch ausgewählt.</param>
private void ResetGroupBookingMode(bool pIsInGroupBookingMode)
{
if (Model == null)
@@ -2182,8 +2216,7 @@ namespace BeWoPlanerMobil.Controllers
Model.NewServiceRecord = new ServiceRecordDC();
Model.SelectedServiceRecord = null;
Model.SelectedSupportConcepts.Clear();
Model.SelectedEmployees.Clear();
//Model.SelectedEmployees.Clear();
Model.IsInEditingMode = false;
Model.SelectedSupportConcepts.Clear();
Model.SelectedConceptCostBearerRelations.Clear();
@@ -2191,7 +2224,10 @@ namespace BeWoPlanerMobil.Controllers
Model.SelectedGroupOfPeopleOids.Clear();
Model.SelectedEmployees = new List<CompactEmployeeDC> { MobileSessionFacade.LoggedInCompactEmployee };
Model.SelectedEmployee = MobileSessionFacade.LoggedInCompactEmployee;
LoadServiceCategoriesToModel(Model.CostBearer2SupportConceptOid);
Model.ServiceCategories = CreateServiceCategoryModels(OperationsService.GetAllServiceDescriptions());
//LoadServiceCategoriesToModel(Model.CostBearer2SupportConceptOid);
var serviceDescriptions = Model.GetServiceDesctiptions();
@@ -2315,7 +2351,7 @@ namespace BeWoPlanerMobil.Controllers
if(string.IsNullOrEmpty(pEmployeeOids))
{
Model.SelectedEmployees.Clear();
return _LeerzeichenFuerGetMethoden;
return JsonConvert.SerializeObject(Model.SelectedEmployees.Count);
}
var rawEmployeeOids = pEmployeeOids.Split(',');
@@ -2328,7 +2364,7 @@ namespace BeWoPlanerMobil.Controllers
Model.SelectedEmployees.Clear();
Model.SelectedEmployees.AddRangeIfElementsNotIn(employees);
return _LeerzeichenFuerGetMethoden;
return JsonConvert.SerializeObject(Model.SelectedEmployees.Count);
}
[HttpPost]
@@ -2576,6 +2612,8 @@ namespace BeWoPlanerMobil.Controllers
if(Model.IsInGroupBookingMode && Model.SelectedSupportConcepts.Count > 1)
{
ResetGroupBookingMode(true);
return SaveGroupBooking();
}
@@ -2590,7 +2628,7 @@ namespace BeWoPlanerMobil.Controllers
Log.Error(e.Message, e);
}
return RedirectToActionPermanent("Main");
return ResetEditingMode(null);
}
[HttpPost]

View File

@@ -30,7 +30,7 @@
groupOidString += ",";
}
}
//TODO: Formular deaktivieren oder aktivieren, je nach dem, ob Gruppen oder Hilfepläne ausgewählt sind.
$.get(url, {pRelOids: scOidString, pGroupOids: groupOidString}).done(updateGroupBookingCb2ScList);
}
@@ -126,5 +126,9 @@ function addEmployeeToGroupBooking() {
}
}
$.get(url, { pEmployeeOids: oidString});
$.get(url, { pEmployeeOids: oidString }).done(function(numberOfSelectedEmployees) {
$("#selected-employees-count-badge").text(numberOfSelectedEmployees);
$("#create-button").prop("disabled", numberOfSelectedEmployees === "0" ? true : false);
});
}

View File

@@ -98,6 +98,13 @@
}
setInputFilter();
@if(Model.IsInGroupBookingMode)
{
<text>
$("#create-button").prop("disabled", @Model.SelectedEmployees.Count === 0 ? true : false);
</text>
}
});
function setInputFilter() {
@@ -539,7 +546,7 @@
var textareaName = i + 1 < 1 ? "Dokumentation" : "Dokumentation" + (i + 1);
<div class="tab-pane show@(i == 0 ? " active" : string.Empty)" id="doku_@i" role="tabpanel" aria-labelledby="doku_@i-tab">
<textarea class="form-control doku-form-control" id="doku-textarea-@i" name="@textareaName">@Model.NoticeListToEdit[0]</textarea>
<textarea class="form-control doku-form-control" id="doku-textarea-@i" name="@textareaName">@Model.NoticeListToEdit[i]</textarea>
</div>
}
</div>
@@ -896,7 +903,9 @@
<div class="form-row">
<div class="col-md">
<div class="form-group mb-1">
<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#group-booking-employee-selection-popup" id="employees-button">Mitarbeiter hinzufügen</button>
<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#group-booking-employee-selection-popup" id="employees-button">
Mitarbeiter hinzufügen <span class="badge badge-light text-primary" id="selected-employees-count-badge">@Model.SelectedEmployees.Count</span>
</button>
</div>
</div>
</div>
@@ -1140,7 +1149,9 @@
<div class="form-row">
<div class="col-md">
<div class="form-group mb-1">
<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#group-booking-employee-selection-popup">Mitarbeiter hinzufügen</button>
<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#group-booking-employee-selection-popup">
Mitarbeiter hinzufügen <span class="badge badge-light text-primary" id="selected-employees-count-badge">@Model.SelectedEmployees.Count</span>
</button>
</div>
</div>
</div>
@@ -1438,9 +1449,15 @@
<div class="modal" tabindex="-1" role="dialog" id="group-booking-employee-selection-popup">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Mitarbeiter hinzufügen</h5>
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<div class="modal-body">
<ul class="list-group" id="employee-list">
@foreach (var employee in Model.Employees)
@foreach(var employee in Model.Employees)
{
<li class="list-group-item">
@{

View File

@@ -71,7 +71,7 @@
s = "0" + s;
}
$("#countdown").html(m + ":" + s);
$("#countdown").html(m + ":" + s + '<span class="fas fa-unlock-alt pl-1"></span>');
}, 1000);
}
} catch (error) {
@@ -94,15 +94,19 @@
<a href="#" class="navbar-brand">
@Model.LoggedInEmplyeeFirstNameLastName
</a>
<span class="navbar-text" id="countdown"></span>
<span class="navbar-text" id="countdown">
</span>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
@if (AbstractModel.IsAllowedToSeeCustomers)
@if(AbstractModel.IsAllowedToSeeCustomers)
{
using (Html.BeginForm("RedirectToCustomer", "Main", FormMethod.Post))
using(Html.BeginForm("RedirectToCustomer", "Main", FormMethod.Post))
{
<li class="nav-item">
<button class="btn btn-link text-light no-underline" onclick="showSpinner()">
@@ -113,7 +117,7 @@
}
}
@using (Html.BeginForm("RedirectToMain", "Main", FormMethod.Post))
@using(Html.BeginForm("RedirectToMain", "Main", FormMethod.Post))
{
<li class="nav-item">
<button class="btn btn-link text-light no-underline" onclick="showSpinner()">
@@ -123,9 +127,9 @@
</li>
}
@if (AbstractModel.IsAllowedToSeeScheduler)
@if(AbstractModel.IsAllowedToSeeScheduler)
{
using (Html.BeginForm("RedirectToScheduler", "Main", FormMethod.Post))
using(Html.BeginForm("RedirectToScheduler", "Main", FormMethod.Post))
{
<li class="nav-item">
<button class="btn btn-link text-light no-underline" onclick="showSpinner()">
@@ -138,7 +142,7 @@
}
<li class="nav-item">
@using (Html.BeginForm("Logout", "Main", FormMethod.Post))
@using(Html.BeginForm("Logout", "Main", FormMethod.Post))
{
<button class="btn btn-link text-light no-underline" onclick="showSpinner()">
<i class="fas fa-sign-out-alt text-primary"></i>

View File

@@ -1352,7 +1352,7 @@ namespace BeWo.Data.Access
// Der generierte Serientermin muss sich zeitlich mit dem neuen Termin überschneiden
// und darf nicht in der Liste der geänderten Serientermine oder der Liste der gelöschten Serientermine sein.
if(!start.InBetweenOrAround(end, occurence.Start, occurence.Start.AddMinutes(duration)) ||
if(!start.IsInInterval(end, occurence.Start, occurence.Start.AddMinutes(duration)) ||
changedOccurences.Any(changedOccurence => changedOccurence.PatternId.Equals(patternId) && changedOccurence.Index == index) ||
deletedOccurences.Any(deletedOccurence => deletedOccurence.PatternId.Equals(patternId) && deletedOccurence.Index == index))
{

View File

@@ -45,6 +45,20 @@ namespace BeWo.Data.Entities
private string _Notice4;
private string _Notice5;
private long? _FormerTaskOid;
private bool _HasServiceRecordEntry;
public virtual bool HasServiceRecordEntry
{
get => _HasServiceRecordEntry;
set
{
if(AreDifferent(_HasServiceRecordEntry, value))
{
_HasServiceRecordEntry = value;
}
}
}
public virtual IList<Customer> CustomerList
{

View File

@@ -24,12 +24,13 @@
<property column="ReminderInfo" type="String" name="ReminderInfo" />
<property column="FormerBookingSequenceOid" type="Int64" name="FormerBookingSequenceOid" />
<property column="IsPrivate" type="Boolean" name="IsPrivate" />
<property column="IsTask" type="Boolean" name="IsTask" />
<property column="TaskDescription" type="String" name="TaskDescription" />
<property column="CompletedDate" type="DateTime" name="CompletedDate" />
<property column="CompletedNotice" type="String" name="CompletedNotice" />
<property column="DueDate" type="DateTime" name="DueDate" />
<property column="FormerTaskOid" type="Int64" name="FormerTaskOid" />
<property column="IsTask" type="Boolean" name="IsTask" />
<property column="TaskDescription" type="String" name="TaskDescription" />
<property column="CompletedDate" type="DateTime" name="CompletedDate" />
<property column="CompletedNotice" type="String" name="CompletedNotice" />
<property column="DueDate" type="DateTime" name="DueDate" />
<property column="FormerTaskOid" type="Int64" name="FormerTaskOid" />
<property type="Boolean" name="HasServiceRecordEntry" />
<many-to-one name="Originator" column="OriginatorOid" class="BeWo.Data.Entities.Employee, BeWo.Data" cascade="none" />
@@ -48,9 +49,9 @@
<many-to-many column="ResourceOid" class="BeWo.Data.Entities.Resource, BeWo.Data" />
</bag>
<bag name="SupportConceptList" table="SupportConcept2NewSchApp" generic="true" cascade="none" batch-size="250">
<key column="NewSchAppOid" />
<many-to-many column="SupportConceptOid" class="BeWo.Data.Entities.SupportConcept, BeWo.Data" />
</bag>
<bag name="SupportConceptList" table="SupportConcept2NewSchApp" generic="true" cascade="none" batch-size="250">
<key column="NewSchAppOid" />
<many-to-many column="SupportConceptOid" class="BeWo.Data.Entities.SupportConcept, BeWo.Data" />
</bag>
</class>
</hibernate-mapping>

View File

@@ -0,0 +1 @@
ALTER TABLE newschedulerappointment ADD COLUMN HasServiceRecordEntry TINYINT(1);

View File

@@ -45,6 +45,8 @@ namespace BeWo.Service.DCEntityMapper
pDataContract.FormerTaskOid = pEntity.FormerTaskOid;
pDataContract.HasServiceRecordEntry = pEntity.HasServiceRecordEntry;
if (pEntity.Originator != null)
{
pDataContract.Originator = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(pEntity.Originator);
@@ -88,6 +90,8 @@ namespace BeWo.Service.DCEntityMapper
pEntity.IsPrivate = pDataContract.IsPrivate;
pEntity.HasServiceRecordEntry = pDataContract.HasServiceRecordEntry;
try
{
pEntity.EmployeeList = DAOFactory.GenericDAO.LoadByIDs<Employee2SchedulerAppointment>(pDataContract.EmployeeList.Select(e => e.Employee2SchedulerAppointmentOid.Value));

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;

View File

@@ -95,7 +95,11 @@ namespace BS.Shared.DataContracts
[DataMember]
public long? FormerTaskOid { get; set; }
public override bool Equals(object obj)
[DataMember]
public bool HasServiceRecordEntry { get; set; }
public override bool Equals(object obj)
{
if (!(obj is SchedulerAppointmentDC))
{

View File

@@ -366,16 +366,6 @@ namespace BS.Shared.Extensions
return date.Year == pDate.Year && date.Month == pDate.Month && date.Day == pDate.Day;
}
public static bool InBetweenOrAround(this DateTime start1, DateTime end1, DateTime start2, DateTime end2)
{
var gleich = start1 == start2 && end1 == end2;
var vorne = start1 < start2 && end1 > start2 && end1 < end2;
var hinten = start1 > start2 && start1 < end2;
var drumherum = start1 < start2 && end1 > end2;
return gleich || vorne || hinten || drumherum;
}
public static double GetIntersectingMinutes(this DateTime start1, DateTime end1, DateTime start2, DateTime end2)
{
var e = end1 <= end2 ? end1 : end2;
@@ -545,5 +535,13 @@ namespace BS.Shared.Extensions
return result;
}
public static bool IsInInterval(this DateTime start, DateTime end, DateTime start2, DateTime end2)
{
var interval1 = new TimeInterval(start, end);
var interval2 = new TimeInterval(start2, end2);
return interval1.IntersectsWithExcludingBounds(interval2);
}
}
}