Merge branch 'master' of ssh://float.beyondsoft.de/git/beyondSoft/BeWo

# Conflicts:
#	BeWoPlanerMobil/Controllers/MainController.cs
#	BeWoPlanerMobil/Scripts/mainView.js
#	Host/Multitenancy/demo.config
#	Service/Plugins/ServiceRecordValidator.cs
This commit is contained in:
Christian
2019-02-12 20:34:41 +01:00
64 changed files with 6447 additions and 4218 deletions

View File

@@ -605,6 +605,9 @@
<Compile Include="ProxyLoginView.xaml.cs">
<DependentUpon>ProxyLoginView.xaml</DependentUpon>
</Compile>
<Compile Include="Scheduler\Converter\AppointmentBackgroundConverter.cs" />
<Compile Include="Scheduler\Converter\AppointmentForegroundConverter.cs" />
<Compile Include="Scheduler\Converter\AppointmentToolTipTextConverter.cs" />
<Compile Include="SchulbegleitenderDienst\SchulbegleitenderDienstEmployeeView.xaml.cs">
<DependentUpon>SchulbegleitenderDienstEmployeeView.xaml</DependentUpon>
</Compile>

View File

@@ -0,0 +1,48 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using BeWo.Scheduler.ViewModel;
using DevExpress.Xpf.Scheduler.Drawing;
using DevExpress.XtraScheduler;
namespace BeWo.Scheduler.Converter
{
public class AppointmentBackgroundConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
try
{
var farbe = Color.FromRgb(192, 255, 208);
if (!(value is VisualAppointmentViewInfo customViewInfo))
{
return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1));
}
var customFields = (CustomFieldCollection) customViewInfo.CustomViewInfo;
var isTaskValue = customFields[nameof(SchedulerAppointmentVM.IsTask)];
if(isTaskValue != null && (bool)isTaskValue)
{
farbe = Color.FromRgb(153, 59, 59);
}
return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1));
}
catch (Exception)
{
return new LinearGradientBrush(new GradientStopCollection { new GradientStop(Color.FromRgb(192, 255, 208), 1) }, new Point(.5, 0), new Point(.5, 1));
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using BeWo.Scheduler.ViewModel;
using DevExpress.XtraScheduler;
namespace BeWo.Scheduler.Converter
{
public class AppointmentForegroundConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var farbe = Color.FromRgb(0, 0, 0);
if(!(value is CustomFieldCollection customViewInfo))
{
return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1));
}
var isTaskValue = customViewInfo[nameof(SchedulerAppointmentVM.IsTask)];
var isTask = (bool?) isTaskValue ?? false;
if (isTask)
{
farbe = Color.FromRgb(224, 224, 224);
}
return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1));
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,55 @@
using System;
using System.Globalization;
using System.Windows.Data;
using BeWo.Scheduler.ViewModel;
using DevExpress.Xpf.Scheduler.Drawing;
using DevExpress.XtraScheduler;
namespace BeWo.Scheduler.Converter
{
public class AppointmentToolTipTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is VisualAppointmentViewInfo viewInfo))
{
return string.Empty;
}
var result = viewInfo.Subject;
var customFields = (CustomFieldCollection) viewInfo.CustomViewInfo;
var isTaskValue = customFields[nameof(SchedulerAppointmentVM.IsTask)];
var isTask = (bool?) isTaskValue ?? false;
if (!isTask)
{
return result;
}
var completedDate = (DateTime?) customFields[nameof(SchedulerAppointmentVM.CompletedDate)];
var dueDate = (DateTime?) customFields[nameof(SchedulerAppointmentVM.DueDate)];
if (completedDate.HasValue)
{
return result + " erledigt am " + completedDate.Value.ToShortDateString();
}
if(dueDate.HasValue)
{
return result + " bis " + dueDate.Value.ToString("dd.MM.yyyy HH:mm");
}
return string.Empty;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -22,8 +22,8 @@ namespace BeWo.Scheduler
bool AllDay { get; set; }
int EventType { get; set; }
string RecurrenceInfo { get; set; }
string RecurrenceInfo { get; set; }
Dictionary<string, object> CustomFields { get; }
}

View File

@@ -25,7 +25,7 @@ namespace BeWo.Scheduler
BindingList<IBeWoAppointment> Appointments { get; }
Dictionary<Guid, Dictionary<string, Dictionary<string, object>>> ChangedOccurencyCustomFields { get; }
Dictionary<Guid, Dictionary<string, Dictionary<string, object>>> ChangedOccurenceCustomFields { get; }
void UpdateViewModel(IEnumerable<SchedulerAppointmentDC> updatedDcList);
@@ -39,7 +39,9 @@ namespace BeWo.Scheduler
void InitNewAppointment(Appointment appointment);
bool HideAppointment(string filterCategory, object selectedObject, Appointment appointment, bool showPrivateAppointments, bool showAbsenceTimes);
void InitNewTask(Appointment pAppointment, DateTime? pDueDate, IEnumerable<Employee2SchedulerAppointmentDC> pSelectedEmployees, IEnumerable<CompactCustomerDC> pSelectedCustomers, IEnumerable<ResourceDC> pSelectedResources);
bool HideAppointment(string filterCategory, object selectedObject, Appointment appointment, bool showPrivateAppointments, bool showAbsenceTimes, bool pShowTasks);
void InitChangedOccurrencyCustomFields(IEnumerable<SchedulerAppointmentDC> appList);
}

View File

@@ -91,34 +91,28 @@ namespace BeWo.Scheduler.View
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
{
var child = VisualTreeHelper.GetChild(obj, i);
if (child is WeekOfMonthEdit)
if (child is WeekOfMonthEdit edt1)
{
var edt = child as WeekOfMonthEdit;
edt1.CustomDisplayText -= EditCustomDisplayText;
edt1.CustomDisplayText += EditCustomDisplayText;
edt.CustomDisplayText -= EditCustomDisplayText;
edt.CustomDisplayText += EditCustomDisplayText;
foreach (var womEditItem in edt.Items)
foreach (var womEditItem in edt1.Items)
{
var ne = womEditItem as NamedElement;
if (ne != null)
if (womEditItem is NamedElement ne)
{
ne.Caption = Translate(ne.Caption);
}
}
}
if (child is WeekDaysEdit)
if (child is WeekDaysEdit edt)
{
var edt = child as WeekDaysEdit;
edt.CustomDisplayText -= EditCustomDisplayText;
edt.CustomDisplayText += EditCustomDisplayText;
foreach (var womEditItem in edt.Items)
{
var ne = womEditItem as NamedElement;
if (ne != null)
if (womEditItem is NamedElement ne)
{
ne.Caption = Translate(ne.Caption);
}

View File

@@ -23,6 +23,7 @@
<localSchConv:TimeScale2TextConverter x:Key="TimeScale2TextConverter" />
<localSchConv:CheckBoxConverter x:Key="CheckBoxConverter" />
<localSchConv:NewCalendarBackgroundConverter x:Key="NewCalendarBackgroundConverter" />
<localSchConv:AppointmentToolTipTextConverter x:Key="AppointmentToolTipTextConverter" />
<view:TextFromIDataContractConverter x:Key="TextFromIDataContractConverter" />
<Style x:Key="VerticalEmployeeResourceHeaderStyle" TargetType="{x:Type dxschint:VisualResourceHeader}">
<Style.Resources>
@@ -93,11 +94,13 @@
<view:AppointmentBorderZusageConverter x:Key="AppointmentBorderZusageConverter" />
<converter:ParticipationBrushConverter x:Key="ParticipationBrushConverter" />
<view:NichtNochEinConverter x:Key="NichtNochEinConverter" />
<localSchConv:AppointmentBackgroundConverter x:Key="AppointmentBackgroundConverter" />
<localSchConv:AppointmentForegroundConverter x:Key="AppointmentForegroundConverter" />
<!-- Region Appointment Templates -->
<!-- Region VerticalAppointmentTemplate #FF45993B c0ffd0 -->
<!-- Region VerticalAppointmentTemplate -->
<ControlTemplate x:Key="{dxscht:SchedulerViewThemeKey ResourceKey=VerticalAppointmentTemplate, IsThemeIndependent=true}" TargetType="{x:Type dxschint:VisualVerticalAppointmentControl}">
<dxschint:AppointmentColorConvertControl x:Name="clrConvCtrl" ControlColor="#c0ffd0" SnapsToDevicePixels="True">
<dxschint:AppointmentColorConvertControl x:Name="clrConvCtrl" ControlColor="{TemplateBinding ViewInfo, Converter={StaticResource AppointmentBackgroundConverter}}" SnapsToDevicePixels="True">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="DraggedStates">
<VisualState x:Name="NotDragged">
@@ -134,10 +137,10 @@
Visibility="{Binding ViewInfo.View.AppointmentToolTipVisibility, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ToolTipVisibilityConverter}}">
</ToolTip>
</ToolTipService.ToolTip>
<!-- Endregion -->
<!-- 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="#c0ffd0" BorderThickness="1" DefaultBorderThickness="1">
<dxschint:AppointmentBorder DefaultCornerRadius="3" DefaultMargin="2" ViewInfo="{TemplateBinding ViewInfo}" Background="{TemplateBinding ViewInfo, Converter={StaticResource AppointmentBackgroundConverter}}" BorderThickness="1" DefaultBorderThickness="1">
<dxschint:AppointmentBorder x:Name="AppointmentBorder" DefaultCornerRadius="2" DefaultMargin="0" ViewInfo="{TemplateBinding ViewInfo}" Background="Transparent">
<Grid>
<Grid.ColumnDefinitions>
@@ -206,8 +209,8 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Subject}" TextWrapping="NoWrap" Margin="6,0,0,3" Foreground="Black" />
<TextBlock Grid.Row="1" Text="{Binding Location}" TextWrapping="Wrap" Margin="6,0,0,3" Foreground="Black" />
<TextBlock Grid.Row="0" Text="{Binding Subject}" TextWrapping="NoWrap" Margin="6,0,0,3" Foreground="{Binding Path=CustomViewInfo, Converter={StaticResource AppointmentForegroundConverter}}" />
<TextBlock Grid.Row="1" Text="{Binding Location}" TextWrapping="Wrap" Margin="6,0,0,3" Foreground="{Binding Path=CustomViewInfo, Converter={StaticResource AppointmentForegroundConverter}}" />
</Grid>
<dxschint:AppointmentImagesControl Grid.Column="1" ViewInfo="{Binding}" Orientation="Vertical" SnapsToDevicePixels="True" />
</Grid>
@@ -215,10 +218,10 @@
<!--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="#c0ffd0">
<dxschint:AppointmentColorConvertControl x:Name="clrConvCtrl" SnapsToDevicePixels="True" ControlColor="{TemplateBinding ViewInfo, Converter={StaticResource AppointmentBackgroundConverter}}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="DraggedStates">
<VisualState x:Name="NotDragged">
@@ -249,14 +252,14 @@
</dxschint:ColorCollection>
</dxschint:AppointmentColorConvertControl.BaseBrushColors>
<Grid x:Name="PART_ToolTipContainer" dxsch:SchedulerControl.HitTestType="AppointmentContent" dxsch:SchedulerControl.SelectableIntervalViewInfo="{TemplateBinding ViewInfo}">
<ToolTipService.ToolTip>
<ToolTip Content="{TemplateBinding ViewInfo}" ContentTemplate="{Binding ViewInfo.View.AppointmentToolTipContentTemplate, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
<ToolTipService.ToolTip>
<ToolTip Content="{TemplateBinding ViewInfo}" ContentTemplate="{Binding ViewInfo.View.AppointmentToolTipContentTemplate, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding ViewInfo.View.AppointmentToolTipVisibility, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ToolTipVisibilityConverter}}">
</ToolTip>
</ToolTipService.ToolTip>
</ToolTip>
</ToolTipService.ToolTip>
<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="1" ViewInfo="{TemplateBinding ViewInfo}" Background="#c0ffd0" DefaultBorderThickness="1">
<dxschint:AppointmentBorder DefaultCornerRadius="3" DefaultMargin="1" ViewInfo="{TemplateBinding ViewInfo}" Background="{TemplateBinding ViewInfo, Converter={StaticResource AppointmentBackgroundConverter}}" DefaultBorderThickness="1">
<dxschint:AppointmentBorder x:Name="AppointmentBorder" DefaultCornerRadius="2" DefaultMargin="0" ViewInfo="{TemplateBinding ViewInfo}" Background="Transparent">
<Grid>
<Grid.ColumnDefinitions>
@@ -347,16 +350,16 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
<dxschint:AppointmentContinueStartDateControl ViewInfo="{Binding}" Margin="12, 4, 0, 2" Foreground="Black" VerticalAlignment="Center" />
<dxschint:AppointmentContinueStartDateControl ViewInfo="{Binding}" Margin="12, 4, 0, 2" Foreground="{Binding Path=CustomViewInfo, Converter={StaticResource AppointmentForegroundConverter}}" VerticalAlignment="Center" />
<dxschint:HorizontalAppointmentStartClockControl ViewInfo="{Binding}" Margin="12, 4, 0, 2" VerticalAlignment="Center" />
</StackPanel>
<dxschint:HorizontalAppointmentContentPanel Grid.Column="1" ClipToBounds="True" VerticalAlignment="Center" Margin="2,0,2,0">
<dxschint:AppointmentImagesControl HorizontalAlignment="Center" ViewInfo="{Binding}" Orientation="Horizontal" />
<TextBlock Text="{Binding Subject}" VerticalAlignment="Center" TextWrapping="Wrap" Foreground="Black" Margin="8, 2, 0, 0" />
<TextBlock Text="{Binding Subject}" VerticalAlignment="Center" TextWrapping="Wrap" Foreground="{Binding Path=CustomViewInfo, Converter={StaticResource AppointmentForegroundConverter}}" Margin="8, 2, 0, 0" />
</dxschint:HorizontalAppointmentContentPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
<dxschint:HorizontalAppointmentEndClockControl ViewInfo="{Binding}" Margin="0, 4, 12, 2" VerticalAlignment="Center" />
<dxschint:AppointmentContinueEndDateControl ViewInfo="{Binding}" Margin="0, 4, 12, 2" Foreground="Black" VerticalAlignment="Center" />
<dxschint:AppointmentContinueEndDateControl ViewInfo="{Binding}" Margin="0, 4, 12, 2" Foreground="{Binding Path=CustomViewInfo, Converter={StaticResource AppointmentForegroundConverter}}" VerticalAlignment="Center" />
</StackPanel>
</Grid>
</DataTemplate>
@@ -385,11 +388,11 @@
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" Visibility="{Binding Path=CustomViewInfo, Converter={StaticResource ToolTipTimeVisibilityConverter}}">
<TextBlock Text="{Binding Path=StartTimeText}" />
<TextBlock Text=" - " />
<TextBlock Text=" - " />
<TextBlock Text="{Binding Path=EndTimeText}" />
<TextBlock Text=" Uhr" Margin="0,0,4,0" />
</StackPanel>
<TextBlock Grid.Column="1" Text="{Binding Path=Subject}" TextWrapping="Wrap" MaxWidth="{Binding ElementName=Scheduler, Path=ActualWidth}" />
<TextBlock Grid.Column="1" Text="{Binding Converter={StaticResource AppointmentToolTipTextConverter}}" TextWrapping="Wrap" MaxWidth="{Binding ElementName=Scheduler, Path=ActualWidth}" />
</Grid>
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Height="1" Background="DimGray" Visibility="{Binding Path=CustomViewInfo, Converter={StaticResource CustomField2VisibilityConverter}, ConverterParameter=Trennstrich}" />
@@ -649,6 +652,7 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" Content="{markup:Translate Mitarbeiterfarben Ein/Aus}" x:Name="MitarbeiterfarbenEinAusCheckBox" Checked="MitarbeiterfarbenEinAusCheckBox_OnChecked"
Unchecked="MitarbeiterfarbenEinAusCheckBox_OnChecked"
@@ -661,7 +665,8 @@
<TextBlock Text="{Binding Requests, UpdateSourceTrigger=PropertyChanged}" />
</Hyperlink>
</TextBlock>
<CheckBox Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" Content="Nur private Termine anzeigen" x:Name="ShowPrivateAppointmentsCheckBox" Click="ShowPrivateAppointmentsCheckBox_OnClick" />
<CheckBox Grid.Column="2" HorizontalAlignment="Right" Margin="0,0,6,0" VerticalAlignment="Center" Content="Aufgaben Ein/Aus" x:Name="ShowTasksCheckBox" Click="ShowTasksCheckBox_OnClick" />
<CheckBox Grid.Column="3" HorizontalAlignment="Right" VerticalAlignment="Center" Content="Nur private Termine anzeigen" x:Name="ShowPrivateAppointmentsCheckBox" Click="ShowPrivateAppointmentsCheckBox_OnClick" />
</Grid>
<Border Grid.Row="0" Grid.Column="3" Width="{Binding ElementName=RightExpanderButton, Path=ActualWidth}" />
<Border Grid.Row="0" Grid.Column="4" Width="{Binding ElementName=DateNavigator, Path=ActualWidth}">
@@ -975,22 +980,22 @@
</StackPanel>
<ToggleButton Grid.Column="1" Style="{StaticResource VerticalExpanderLookAlikeToggleBotton}" Width="23" Height="23" Margin="3" Click="LeftExpanderClick" x:Name="LeftExpanderButton" />
<dxsch:SchedulerControl Grid.Column="2" x:Name="Scheduler" dx:ThemeManager.ThemeName="Office2010Black"
FormCustomizationUsingMVVMLocal="False"
InplaceEditorShowing="Scheduler_OnInplaceEditorShowing"
GroupType="None"
VerticalAlignment="Stretch"
EditAppointmentFormShowing="Scheduler_EditAppointmentFormShowing"
EditRecurrentAppointmentFormShowing="SchedulerControl_EditRecurrentAppointmentFormShowing"
PopupMenuShowing="Scheduler_PopupMenuShowing"
InitNewAppointment="Scheduler_InitNewAppointment"
AppointmentViewInfoCustomizing="Scheduler_AppointmentViewInfoCustomizing"
AllowAppointmentDrag="AllowAppointmentAenderung"
AllowAppointmentEdit="AllowAppointmentAenderung"
AllowAppointmentResize="AllowAppointmentAenderung"
AllowAppointmentCreate="AllowAppointmentCreateEvent"
AllowAppointmentDragBetweenResources="AllowAppointmentAenderung"
AllowAppointmentDelete="AllowAppointmentAenderung"
ActiveViewType="WorkWeek">
FormCustomizationUsingMVVMLocal="False"
InplaceEditorShowing="Scheduler_OnInplaceEditorShowing"
GroupType="None"
VerticalAlignment="Stretch"
EditAppointmentFormShowing="Scheduler_EditAppointmentFormShowing"
EditRecurrentAppointmentFormShowing="SchedulerControl_EditRecurrentAppointmentFormShowing"
PopupMenuShowing="Scheduler_PopupMenuShowing"
InitNewAppointment="Scheduler_InitNewAppointment"
AppointmentViewInfoCustomizing="Scheduler_AppointmentViewInfoCustomizing"
AllowAppointmentDrag="AllowAppointmentAenderung"
AllowAppointmentEdit="AllowAppointmentAenderung"
AllowAppointmentResize="AllowAppointmentAenderung"
AllowAppointmentCreate="AllowAppointmentCreateEvent"
AllowAppointmentDragBetweenResources="AllowAppointmentAenderung"
AllowAppointmentDelete="AllowAppointmentAenderung"
ActiveViewType="WorkWeek">
<dxsch:SchedulerControl.DayView>
<dxsch:DayView AppointmentToolTipContentTemplate="{StaticResource {dxscht:SchedulerViewThemeKey ResourceKey=AppointmentToolTipContentTemplate}}" />
</dxsch:SchedulerControl.DayView>
@@ -1009,7 +1014,7 @@
<dxsch:SchedulerControl.Storage>
<dxsch:SchedulerStorage AppointmentsChanged="NewSchedulerStorage_AppointmentsChanged"
AppointmentDeleting="NewSchedulerStorage_AppointmentDeleting"
AppointmentsInserted="NewSchedulerStorage_AppointmentsInserted"
AppointmentsInserted="NewSchedulerStorage_AppointmentsInserted"
FetchAppointments="SchedulerStorage_OnFetchAppointments">
<dxsch:SchedulerStorage.AppointmentStorage>
<dxsch:AppointmentStorage>
@@ -1042,6 +1047,11 @@
<dxb:RemoveBarItemAndLinkAction ItemName="{x:Static dxsch:SchedulerMenuItemName.NewAllDayEvent}" />
<dxb:RemoveBarItemAndLinkAction ItemName="{x:Static dxsch:SchedulerMenuItemName.NewRecurringAppointment}" />
<dxb:RemoveBarItemAndLinkAction ItemName="{x:Static dxsch:SchedulerMenuItemName.NewRecurringEvent}" />
<dxb:AddBarItemAction>
<dxb:BarButtonItem Name="AufgabeAnlegenButtonItem" Content="{markup:Translate Neue Aufgabe}" ItemClick="AufgabeAnlegen_OnItemClick" />
</dxb:AddBarItemAction>
<dxb:AddBarItemAction>
<dxb:BarButtonItem Name="MitarbeiterVerfuegbarkeitPruefenButtonItem"
Content="{markup:Translate Verfügbare Mitarbeiter anzeigen}"
@@ -1053,36 +1063,29 @@
<dxsch:SchedulerControl.AppointmentMenuCustomizations>
<dxb:RemoveBarItemAndLinkAction ItemName="{x:Static dxsch:SchedulerMenuItemName.RestoreOccurrence}" />
<dxb:AddBarItemAction>
<dxb:BarButtonItem Name="RestoreAppointmentButtonItem" Content="Serientermin wiederherstellen" ItemClick="RestoreAppointmentButtonItem_OnItemClick" />
<dxb:BarButtonItem Name="RestoreAppointmentButtonItem" Content="Serientermin wiederherstellen" ItemClick="RestoreAppointmentButtonItem_OnItemClick" />
</dxb:AddBarItemAction>
<dxb:AddBarItemAction>
<dxb:BarButtonItem Name="ZusagenButtonItem" Content="Zusagen" ItemClick="ZusagenButtonItem_OnItemClick" />
<dxb:BarButtonItem Name="ZusagenButtonItem" Content="Zusagen" ItemClick="ZusagenButtonItem_OnItemClick" />
</dxb:AddBarItemAction>
<dxb:AddBarItemAction>
<dxb:BarButtonItem Name="MitVorbehaltButtonItem" Content="Mit Vorbehalt zusagen" ItemClick="MitVorbehaltButtonItem_OnItemClick" />
<dxb:BarButtonItem Name="MitVorbehaltButtonItem" Content="Mit Vorbehalt zusagen" ItemClick="MitVorbehaltButtonItem_OnItemClick" />
</dxb:AddBarItemAction>
<dxb:AddBarItemAction>
<dxb:BarButtonItem Name="AbsagenButtonItem" Content="Absagen" ItemClick="AbsagenButtonItem_OnItemClick" />
<dxb:BarButtonItem Name="AbsagenButtonItem" Content="Absagen" ItemClick="AbsagenButtonItem_OnItemClick" />
</dxb:AddBarItemAction>
<dxb:AddBarItemAction>
<dxb:BarButtonItem Name="ZeiterfassungButtonItem" Content="{markup:Translate In Zeiterfassung übertragen}" ItemClick="ZeiterfassungButtonItem_OnItemClick" />
</dxb:AddBarItemAction>
<dxb:AddBarItemAction>
<dxb:BarButtonItem Name="MitarbeiterVerfuegbarkeitPruefenButtonItem2"
<dxb:AddBarItemAction>
<dxb:BarButtonItem Name="ZeiterfassungButtonItem" Content="{markup:Translate In Zeiterfassung übertragen}" ItemClick="ZeiterfassungButtonItem_OnItemClick" />
</dxb:AddBarItemAction>
<dxb:AddBarItemAction>
<dxb:BarButtonItem Name="MitarbeiterVerfuegbarkeitPruefenButtonItem2"
Content="{markup:Translate Verfügbare Mitarbeiter anzeigen}"
ItemClick="MitarbeiterVerfuegbarkeitPruefenButtonItem_OnItemClick" />
</dxb:AddBarItemAction>
</dxb:AddBarItemAction>
<dxb:RemoveBarItemAndLinkAction ItemName="{x:Static dxsch:SchedulerMenuItemName.StatusSubMenu}" />
<dxb:RemoveBarItemAndLinkAction ItemName="{x:Static dxsch:SchedulerMenuItemName.LabelSubMenu}" />
<dxb:BarSubItem x:Name="TeilnahmeMenue" Content="Teilnahmestatus ändern">
<dxb:BarSubItem.ItemLinks>
<dxb:BarButtonItemLink BarItemName="ZusagenButtonItem" />
<dxb:BarButtonItemLink BarItemName="MitVorbehaltButtonItem" />
<dxb:BarButtonItemLink BarItemName="AbsagenButtonItem" />
</dxb:BarSubItem.ItemLinks>
</dxb:BarSubItem>
<dxb:BarButtonItemLink BarItemName="ZeiterfassungButtonItem" />
<dxb:BarButtonItemLink BarItemName="MitarbeiterVerfuegbarkeitPruefenButtonItem2" />
<dxb:RemoveBarItemAndLinkAction ItemName="{x:Static dxsch:SchedulerMenuItemName.LabelSubMenu}" />
<dxb:BarButtonItemLink BarItemName="ZeiterfassungButtonItem" />
<dxb:BarButtonItemLink BarItemName="MitarbeiterVerfuegbarkeitPruefenButtonItem2" />
</dxsch:SchedulerControl.AppointmentMenuCustomizations>
</dxsch:SchedulerControl>
<dxsch:DXSchedulerControlPrintAdapter Grid.Column="0" x:Name="PrintAdapter" SchedulerControl="{Binding ElementName=Scheduler}" />

View File

@@ -32,7 +32,8 @@ using DevExpress.Xpf.Editors;
using DevExpress.Xpf.Scheduler;
using DevExpress.Xpf.Scheduler.Reporting;
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.Internal.Implementations;
using DevExpress.XtraScheduler.Native;
using Appointment = DevExpress.XtraScheduler.Appointment;
using ColorConverter = System.Windows.Media.ColorConverter;
using DateTime = System.DateTime;
@@ -69,6 +70,19 @@ namespace BeWo.Scheduler.View
}
}
private bool _IsTasksVisible;
public bool IsTasksVisible
{
get => _IsTasksVisible;
set
{
_IsTasksVisible = value;
OnPropertyChanged(nameof(IsTasksVisible));
}
}
public bool IsInCustomerViewMode { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
@@ -226,7 +240,7 @@ namespace BeWo.Scheduler.View
return _Category2ResourcesDictionary == null && dic2 == null || _Category2ResourcesDictionary != null && dic2 != null && _Category2ResourcesDictionary.Count == dic2.Count && _Category2ResourcesDictionary.Except(dic2).Any();
}
private static bool ListEquals<T>(IReadOnlyCollection<T> list1, List<T> list2)
private static bool ListEquals<T>(IReadOnlyCollection<T> list1, ICollection<T> list2)
{
if(list1 == null && list2 == null)
{
@@ -488,38 +502,31 @@ namespace BeWo.Scheduler.View
#region InitViewModel
private void InitViewModel()
{
//WriteToDebugLog("Beginning");
ViewModel = new NewSchedulerViewModel();
ViewModel.ViewModelChanged += ViewModel_ViewModelChanged;
ViewModel.ViewModelChanged += UpdateRequestStringEvent;
//WriteToDebugLog("Done");
}
private void ViewModel_ViewModelChanged(object sender, EventArgs<ISchedulerViewModel> e)
{
this.Dispatch(() =>
{
//WriteToDebugLog("Beginning");
UpdateDataSource(e.Data);
if (_IstErsterAufruf)
if(_IstErsterAufruf)
{
if (MainControl.HatNeueTermine)
if(MainControl.HatNeueTermine)
{
FensterOeffnen();
}
_IstErsterAufruf = false;
}
//WriteToDebugLog("Done");
});
}
private void InitScheduler()
{
//WriteToDebugLog("Beginning");
Scheduler.Start = DateTime.Now;
_TimelineDayCount = 0;
Scheduler.DayView.NavigationButtonVisibility = NavigationButtonVisibility.Always;
@@ -540,7 +547,6 @@ namespace BeWo.Scheduler.View
Scheduler.TimelineView.NavigationButtonVisibility = NavigationButtonVisibility.Always;
Scheduler.TimelineView.ResourcesPerPage = 0;
//WriteToDebugLog("Done");
}
private void InitRights()
@@ -558,7 +564,6 @@ namespace BeWo.Scheduler.View
{
try
{
//WriteToDebugLog("Beginning");
IgnoreChangeEvents = true;
Scheduler.Storage.BeginUpdate();
@@ -571,40 +576,40 @@ namespace BeWo.Scheduler.View
UpdateSchedulerSettings();
foreach (var item in Scheduler.Storage.AppointmentStorage.Items)
foreach(var item in Scheduler.Storage.AppointmentStorage.Items)
{
var bapp = item.GetSourceObject(Scheduler.GetCoreStorage()) as IBeWoAppointment;
if (item.IsRecurring)
if(item.IsRecurring)
{
var ausnahmen = item.GetExceptions();
foreach (var exc in ausnahmen)
foreach(var exc in ausnahmen)
{
var b = exc.GetSourceObject(Scheduler.GetCoreStorage()) as IBeWoAppointment;
if (b?.CustomFields == null)
if(b?.CustomFields == null)
{
continue;
}
foreach (var field in b.CustomFields)
foreach(var field in b.CustomFields)
{
exc.CustomFields[field.Key] = field.Value;
}
}
}
if (bapp?.CustomFields == null)
if(bapp?.CustomFields == null)
{
continue;
}
foreach (var field in bapp.CustomFields)
foreach(var field in bapp.CustomFields)
{
item.CustomFields[field.Key] = field.Value;
}
}
}
catch (Exception e)
catch(Exception e)
{
throw e;
}
@@ -612,13 +617,11 @@ namespace BeWo.Scheduler.View
{
Scheduler.Storage.EndUpdate();
IgnoreChangeEvents = false;
//WriteToDebugLog("Done");
}
}
private void UpdateSchedulerSettings()
{
//WriteToDebugLog("Beginning");
var settings = ViewModel.GetActiveSettings();
Scheduler.Start = settings.StartDate;
@@ -667,16 +670,12 @@ namespace BeWo.Scheduler.View
{
MessageBox.Show("Ein Fehler bei der Darstellung ist aufgetreten.", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
}
//WriteToDebugLog("Done");
}
private void UpdateCustomFieldMappings(ISchedulerViewModel vm)
{
//WriteToDebugLog("Beginning");
Scheduler.Storage.AppointmentStorage.CustomFieldMappings.Clear();
vm.AddCustomFieldsMapping(Scheduler.Storage);
//WriteToDebugLog("Done");
}
#endregion
@@ -994,8 +993,6 @@ namespace BeWo.Scheduler.View
private void NewSchedulerStorage_AppointmentsInserted(object sender, PersistentObjectsEventArgs e)
{
//WriteToDebugLog("Appointments inserted");
var appList = e.Objects.Cast<Appointment>().ToList();
if(appList.Any(f => f.CustomFields["IsPrivate"] != null && (bool) f.CustomFields["IsPrivate"]))
@@ -1066,7 +1063,7 @@ namespace BeWo.Scheduler.View
{
var item = (BarButtonItemLink) f;
if(item != null && item.Name.Contains("RestoreAppointmentButtonItem"))
if(item.Name.Contains("RestoreAppointmentButtonItem"))
{
return true;
}
@@ -1092,22 +1089,39 @@ namespace BeWo.Scheduler.View
//}
var zusageUntermenue = e.Menu.ItemLinks.FirstOrDefault(f=>f.GetType() == typeof(BarSubItemLink) && ((BarSubItemLink) f).Item.Name.Equals("TeilnahmeMenue"));
if (Scheduler.SelectedAppointments.Count > 0)
{
var zusageButton = e.Menu.ItemLinks.FirstOrDefault(f => f.GetType() == typeof(BarButtonItemLink) && ((BarButtonItemLink)f).BarItemName.Equals("ZusagenButtonItem"));
var mitVorbehaltButton = e.Menu.ItemLinks.FirstOrDefault(f => f.GetType() == typeof(BarButtonItemLink) && ((BarButtonItemLink)f).BarItemName.Equals("MitVorbehaltButtonItem"));
var absageButton = e.Menu.ItemLinks.FirstOrDefault(f => f.GetType() == typeof(BarButtonItemLink) && ((BarButtonItemLink)f).BarItemName.Equals("AbsagenButtonItem"));
if (zusageUntermenue == null || ((List<Employee2SchedulerAppointmentDC>)Scheduler.SelectedAppointments[0].CustomFields["EmployeeList"]).Any(a => a.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)))
{
return;
if(((List<Employee2SchedulerAppointmentDC>)Scheduler.SelectedAppointments[0].CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)]).Any(a => a.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)))
{
return;
}
if (zusageButton != null)
{
e.Menu.ItemLinks.Remove(zusageButton);
}
if (mitVorbehaltButton != null)
{
e.Menu.ItemLinks.Remove(mitVorbehaltButton);
}
if (absageButton != null)
{
e.Menu.ItemLinks.Remove(absageButton);
}
}
e.Menu.ItemLinks.Remove(zusageUntermenue);
}
private bool _IsNew;
private void Scheduler_InitNewAppointment(object sender, AppointmentEventArgs e)
{
//WriteToDebugLog("Initiating new appointment");
_IsNew = true;
ViewModel.InitNewAppointment(e.Appointment);
}
@@ -1116,12 +1130,12 @@ namespace BeWo.Scheduler.View
{
var cf = e.ViewInfo.Appointment.CustomFields;
if(cf[SchedulerAppointmentListVM.CustomField_CustomerList] == null &&
cf[SchedulerAppointmentListVM.CustomField_EmployeeList] == null &&
cf[SchedulerAppointmentListVM.CustomField_IsAbsenceTime] == null &&
cf[SchedulerAppointmentListVM.CustomField_IsPrivate] == null &&
cf[SchedulerAppointmentListVM.CustomField_Originator] == null &&
cf[SchedulerAppointmentListVM.CustomField_ResourceList] == null)
if(cf[nameof(SchedulerAppointmentVM.CustomerList)] == null &&
cf[nameof(SchedulerAppointmentVM.EmployeeList)] == null &&
cf[nameof(SchedulerAppointmentVM.IsAbsenceTime)] == null &&
cf[nameof(SchedulerAppointmentVM.IsPrivate)] == null &&
cf[nameof(SchedulerAppointmentVM.Originator)] == null &&
cf[nameof(SchedulerAppointmentVM.ResourceList)] == null)
{
return;
}
@@ -1138,17 +1152,17 @@ namespace BeWo.Scheduler.View
var darfTerminDetailsSehen = true;
var appointment = e.Appointment;
if((bool) appointment.CustomFields["IsAbsenceTime"])
if((bool) appointment.CustomFields[nameof(SchedulerAppointmentVM.IsAbsenceTime)])
{
e.Allow = false;
return;
}
var ersteller = (CompactEmployeeDC) appointment.CustomFields["Originator"];
var mitarbeiterliste = (List<Employee2SchedulerAppointmentDC>) appointment.CustomFields["EmployeeList"];
var ersteller = (CompactEmployeeDC) appointment.CustomFields[nameof(SchedulerAppointmentVM.Originator)];
var mitarbeiterliste = (List<Employee2SchedulerAppointmentDC>) appointment.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)];
var hatNurAndereMitarbeiter = mitarbeiterliste.Count > 0 && !(mitarbeiterliste.Count == 1 && mitarbeiterliste.ElementAt(0).Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid));
var hatKlienten = ((List<CompactCustomerDC>) appointment.CustomFields["CustomerList"]).Count > 0;
var hatKlienten = ((List<CompactCustomerDC>) appointment.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)]).Count > 0;
var istErsteller = ersteller.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid);
if(hatNurAndereMitarbeiter || !istErsteller)
@@ -1166,7 +1180,7 @@ namespace BeWo.Scheduler.View
darfTerminDetailsSehen = mitarbeiterliste.Select(ml => ml.Employee).Any(a => a.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)) || istErsteller;
}
if(!istErsteller && (bool) appointment.CustomFields["IsPrivate"] && !mitarbeiterliste.Any(em => em.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)))
if(!istErsteller && (bool) appointment.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)] && !mitarbeiterliste.Any(em => em.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid)))
{
darfTerminDetailsSehen = false;
}
@@ -1279,37 +1293,37 @@ namespace BeWo.Scheduler.View
var zuBestaetigen = vm.Appointments.Where(app =>
{
var originator = (CompactEmployeeDC) app.CustomFields["Originator"];
var originator = (CompactEmployeeDC) app.CustomFields[nameof(SchedulerAppointmentVM.Originator)];
if (!app.CustomFields.ContainsKey("EmployeeList") || originator.EmployeeOid == BeWoApp.LoggedOnEmployee.EmployeeOid.Value)
if(!app.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.EmployeeList)) || originator.EmployeeOid == BeWoApp.LoggedOnEmployee.EmployeeOid.Value)
{
return false;
}
var empList = (List<Employee2SchedulerAppointmentDC>) app.CustomFields["EmployeeList"];
var empList = (List<Employee2SchedulerAppointmentDC>) app.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)];
return empList.Any(a => a.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid) && a.ParticipationAnswer == ParticipationAnswer.Offen);
}).ToList();
var updates = vm.Appointments.Where(app =>
{
if (!app.CustomFields.ContainsKey("Originator") || !app.CustomFields.ContainsKey("EmployeeList"))
if(!app.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.Originator)) || !app.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.EmployeeList)))
{
return false;
}
var empList = (List<Employee2SchedulerAppointmentDC>) app.CustomFields["EmployeeList"];
var or = (CompactEmployeeDC) app.CustomFields["Originator"];
var empList = (List<Employee2SchedulerAppointmentDC>) app.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)];
var or = (CompactEmployeeDC) app.CustomFields[nameof(SchedulerAppointmentVM.Originator)];
return or.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid) && empList.Any(a => a.IsPChanged && a.ParticipationAnswer != ParticipationAnswer.Offen && a.ParticipationAnswer != ParticipationAnswer.Verstrichen && !a.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid));
}).ToList();
if (!zuBestaetigen.Any() && !updates.Any())
if(!zuBestaetigen.Any() && !updates.Any())
{
return;
}
var requestAnswerView = new RequestAnswerView(zuBestaetigen, updates);
var requestAnswerView = new RequestAnswerView(zuBestaetigen, updates);
requestAnswerView.Closed += RequestAnswerViewClosedEvent;
requestAnswerView.ParticipationChanged += UpdateRequestStringEvent;
@@ -1420,7 +1434,7 @@ namespace BeWo.Scheduler.View
private void ZusageAendern(ParticipationAnswer antwort, Appointment sa)
{
var el = (List<Employee2SchedulerAppointmentDC>) sa.CustomFields["EmployeeList"];
var el = (List<Employee2SchedulerAppointmentDC>) sa.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)];
var neu = el.DoForEach(dfe =>
{
if (!dfe.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid))
@@ -1431,7 +1445,7 @@ namespace BeWo.Scheduler.View
dfe.ParticipationAnswer = antwort;
dfe.IsPC_CheckedTs = null;
}).ToList();
sa.CustomFields["EmployeeList"] = neu;
sa.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)] = neu;
UpdateVM(true);
}
@@ -1445,8 +1459,8 @@ namespace BeWo.Scheduler.View
var app = Scheduler.SelectedAppointments[0];
var e2aList = app.CustomFields["EmployeeList"] as List<Employee2SchedulerAppointmentDC>;
var customerList = app.CustomFields["CustomerList"] as List<CompactCustomerDC>;
var e2aList = app.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)] as List<Employee2SchedulerAppointmentDC>;
var customerList = app.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)] as List<CompactCustomerDC>;
var empList = e2aList.Select(e2a => e2a.Employee).ToList();
@@ -1601,7 +1615,7 @@ namespace BeWo.Scheduler.View
{
ServiceFacade.DoResourceServiceAsync(s => s.GetAllCategories2ResourcesInDictionary(), cats2Res =>
{
ServiceFacade.DoResourceServiceAsync(s2 => s2.LoadFilteredAppointments(BeWoApp.HasLoggedOnUserRight(new[] { UserRightType.KalenderMitarbeitertermineAnsehen }), BeWoApp.LoggedOnEmployee.EmployeeOid.Value, start, end, pSelectedEmployees, pSelectedCustomer, pSelectedResources, pEmployeesOnly, pCustomersOnly, pResourcesOnly, pPrivateAppointmentsOnly, pOnlyMyAppointments),
ServiceFacade.DoResourceServiceAsync(s2 => s2.LoadFilteredAppointmentsMitAufgaben(BeWoApp.HasLoggedOnUserRight(new[] { UserRightType.KalenderMitarbeitertermineAnsehen }), BeWoApp.LoggedOnEmployee.EmployeeOid.Value, start, end, pSelectedEmployees, pSelectedCustomer, pSelectedResources, pEmployeesOnly, pCustomersOnly, pResourcesOnly, pPrivateAppointmentsOnly, pOnlyMyAppointments, IsTasksVisible),
appointments =>
{
Cache.GetInstance().GetAllActiveCustomersCompact(customers =>
@@ -1696,9 +1710,9 @@ namespace BeWo.Scheduler.View
// var iCalArgs = (iCalendarAppointmentExportingEventArgs) appointmentExportingEventArgs;
// var vEvent = iCalArgs.VEvent;
// var ma = (List<Employee2SchedulerAppointmentDC>)appointmentExportingEventArgs.Appointment.CustomFields["EmployeeList"];
// var ca = (List<CompactCustomerDC>)appointmentExportingEventArgs.Appointment.CustomFields["CustomerList"];
// var ra = (List<ResourceDC>)appointmentExportingEventArgs.Appointment.CustomFields["ResourceList"];
// var ma = (List<Employee2SchedulerAppointmentDC>)appointmentExportingEventArgs.Appointment.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)];
// var ca = (List<CompactCustomerDC>)appointmentExportingEventArgs.Appointment.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)];
// var ra = (List<ResourceDC>)appointmentExportingEventArgs.Appointment.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)];
//}
//private void SyncWithOutlook(object sender, RoutedEventArgs e)
@@ -1732,7 +1746,7 @@ namespace BeWo.Scheduler.View
datesList.AddRange(range.Select(x => x.Start));
}
var apps = Scheduler.ActiveView.GetAppointments().Where(w => w.CustomFields["IsAbsenceTime"] == null || (bool) w.CustomFields["IsAbsenceTime"] == false).ToList();
var apps = Scheduler.ActiveView.GetAppointments().Where(w => w.CustomFields[nameof(SchedulerAppointmentVM.IsAbsenceTime)] == null || (bool) w.CustomFields[nameof(SchedulerAppointmentVM.IsAbsenceTime)] == false).ToList();
var appointmentOidListe = apps.Where(w => !w.IsOccurrence && !w.IsRecurring || w.IsException).Select(app => Convert.ToInt64(((SchedulerAppointmentVM) app.GetSourceObject(Scheduler.GetCoreStorage())).Id)).Distinct().ToList();
var serienTerminOids = apps.Where(w => w.IsRecurring || w.IsOccurrence).Select(app => Convert.ToInt64(((SchedulerAppointmentVM)app.RecurrencePattern.GetSourceObject(Scheduler.GetCoreStorage())).Id)).Distinct().ToList();
var serienTermine = new List<SchedulerAppointmentDC>();
@@ -1750,8 +1764,8 @@ namespace BeWo.Scheduler.View
var ausnahmen = apps.Where(w => w.RecurrenceInfo != null && w.RecurrenceInfo.Id.Equals(info.Id) && w.IsException).ToList();
var calc = OccurrenceCalculator.CreateInstance(info);
var ttc = new TimeInterval(range.Start, range.End + new TimeSpan(1, 0, 0));
var kollektionOhneAusnahmen = calc.CalcOccurrences(ttc, serienTermin.RecurrencePattern).Where(w => (w.RecurrenceIndex != 0 && !w.IsException)).ToList();
var kollektionOhneAusnahmen = calc.CalcOccurrences(ttc, serienTermin.RecurrencePattern).Where(w => w.RecurrenceIndex != 0 && !w.IsException).ToList();
if (ausnahmen.Any(appointment => appointment.IsException && appointment.RecurrenceIndex == 0) && basistermin.DataContract.SchedulerAppointmentOid != null)
{
serienTerminOids.Remove(basistermin.DataContract.SchedulerAppointmentOid.Value);
@@ -2003,7 +2017,7 @@ namespace BeWo.Scheduler.View
UpdateVM(true);
}
private static void WriteToDebugLog(string message, bool isWithoutTimestamp = false)
public static void WriteToDebugLog(string message, bool isWithoutTimestamp = false)
{
#if DEBUG
var callerName2 = new StackTrace().GetFrame(2).GetMethod().Name;
@@ -2026,9 +2040,9 @@ namespace BeWo.Scheduler.View
if(_IsNew)
{
var n = SelectedEmployees.Select(item => new Employee2SchedulerAppointmentDC { Employee = item, ParticipationAnswer = ParticipationAnswer.Offen }).ToList();
e.Appointment.CustomFields["EmployeeList"] = n;
e.Appointment.CustomFields["CustomerList"] = new List<CompactCustomerDC>(SelectedCustomers);
e.Appointment.CustomFields["ResourceList"] = new List<ResourceDC>(SelectedResources);
e.Appointment.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)] = n;
e.Appointment.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)] = new List<CompactCustomerDC>(SelectedCustomers);
e.Appointment.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)] = new List<ResourceDC>(SelectedResources);
_IsNew = false;
}
@@ -2149,6 +2163,34 @@ namespace BeWo.Scheduler.View
});
});
}
private void AufgabeAnlegen_OnItemClick(object sender, ItemClickEventArgs e)
{
var end = Scheduler.SelectedInterval.End.GetShortDateTime();
var dueDate = Scheduler.SelectedInterval.End;
var start = end.AddDays(1);
var newTask = Scheduler.Storage.CreateAppointment(AppointmentType.Normal);
newTask.Start = end;
newTask.End = start;
newTask.AllDay = true;
newTask.Subject = "Neue Aufgabe";
var employees2Appointments = SelectedEmployees.Select(item => new Employee2SchedulerAppointmentDC { Employee = item, ParticipationAnswer = ParticipationAnswer.Offen }).ToList();
ViewModel.InitNewTask(newTask, dueDate, employees2Appointments, SelectedCustomers, SelectedResources);
Scheduler.ShowEditAppointmentForm(newTask);
}
private void ShowTasksCheckBox_OnClick(object sender, RoutedEventArgs e)
{
var cb = (CheckBox) sender;
IsTasksVisible = cb.IsChecked ?? false;
UpdateVM(true);
}
}
#region Converter
@@ -2211,7 +2253,7 @@ namespace BeWo.Scheduler.View
if(customFields != null)
{
var ressourcen = (List<ResourceDC>) customFields["ResourceList"];
var ressourcen = (List<ResourceDC>) customFields[nameof(SchedulerAppointmentVM.ResourceList)];
if (parameter != null && parameter.Equals("AlleRessourcen"))
{
@@ -2232,9 +2274,9 @@ namespace BeWo.Scheduler.View
try
{
var customFields = (CustomFieldCollection)value;
var mitarbeiter = (List<Employee2SchedulerAppointmentDC>)customFields["EmployeeList"];
var ressourcen = (List<ResourceDC>)customFields["ResourceList"];
var klienten = (List<CompactCustomerDC>)customFields["CustomerList"];
var mitarbeiter = (List<Employee2SchedulerAppointmentDC>)customFields[nameof(SchedulerAppointmentVM.EmployeeList)];
var ressourcen = (List<ResourceDC>)customFields[nameof(SchedulerAppointmentVM.ResourceList)];
var klienten = (List<CompactCustomerDC>)customFields[nameof(SchedulerAppointmentVM.CustomerList)];
if (parameter == null)
{
@@ -2271,9 +2313,9 @@ namespace BeWo.Scheduler.View
try
{
var customfields = (CustomFieldCollection) value;
var mitarbeiter = (List<Employee2SchedulerAppointmentDC>)customfields["EmployeeList"];
var ressourcen = (List<ResourceDC>) customfields["ResourceList"];
var klienten = (List<CompactCustomerDC>) customfields["CustomerList"];
var mitarbeiter = (List<Employee2SchedulerAppointmentDC>)customfields[nameof(SchedulerAppointmentVM.EmployeeList)];
var ressourcen = (List<ResourceDC>) customfields[nameof(SchedulerAppointmentVM.ResourceList)];
var klienten = (List<CompactCustomerDC>) customfields[nameof(SchedulerAppointmentVM.CustomerList)];
var tooltip = string.Empty;
var seperator = "; ";
@@ -2365,8 +2407,15 @@ namespace BeWo.Scheduler.View
return new LinearGradientBrush(new GradientStopCollection { new GradientStop(farbe, 1) }, new Point(.5, 0), new Point(.5, 1));
}
var aptCustomers = (List<CompactCustomerDC>) customViewInfo["CustomerList"];
var aptResources = (List<ResourceDC>) customViewInfo["ResourceList"];
var isTask = (bool?) customViewInfo[nameof(SchedulerAppointmentVM.IsTask)];
if (isTask.HasValue && isTask.Value)
{
farbe = Color.FromRgb(153, 59, 59);
}
var aptCustomers = (List<CompactCustomerDC>) customViewInfo[nameof(SchedulerAppointmentVM.CustomerList)];
var aptResources = (List<ResourceDC>) customViewInfo[nameof(SchedulerAppointmentVM.ResourceList)];
var gradientCollection = new GradientStopCollection();
var farbKollektion = new List<Color>();
@@ -2422,12 +2471,14 @@ namespace BeWo.Scheduler.View
try
{
var customFields = (CustomFieldCollection)value;
var employeeList = (List<Employee2SchedulerAppointmentDC>) customFields["EmployeeList"];
var employeeList = (List<Employee2SchedulerAppointmentDC>) customFields[nameof(SchedulerAppointmentVM.EmployeeList)];
var isTaskValue = customFields[nameof(SchedulerAppointmentVM.IsTask)];
var isTask = (bool?) isTaskValue ?? false;
return employeeList.Any(e => e.Employee.EmployeeOid.Equals(BeWoApp.LoggedOnEmployee.EmployeeOid) && e.ParticipationAnswer == ParticipationAnswer.Vorbehalt) ?
new SolidColorBrush(Color.FromRgb(185, 39, 217)) :
new SolidColorBrush(Color.FromRgb(192, 255, 208));
}
isTask ? new SolidColorBrush(Color.FromRgb(153, 59, 59)) : new SolidColorBrush(Color.FromRgb(192, 255, 208));
}
catch(Exception e)
{
Console.WriteLine(e);
@@ -2455,7 +2506,7 @@ namespace BeWo.Scheduler.View
if (parameter != null && parameter.Equals("ListenQuelle"))
{
var customFields = (CustomFieldCollection) value;
var employeeList = (List<Employee2SchedulerAppointmentDC>) customFields["EmployeeList"];
var employeeList = (List<Employee2SchedulerAppointmentDC>) customFields[nameof(SchedulerAppointmentVM.EmployeeList)];
return employeeList;
}
@@ -2496,7 +2547,15 @@ namespace BeWo.Scheduler.View
return Visibility.Visible;
}
var isParsingSuccessful = bool.TryParse(customFields[SchedulerAppointmentListVM.CustomField_IsAbsenceTime].ToString(), out var isAbsenceTime);
var isTaskValue = customFields[nameof(SchedulerAppointmentVM.IsTask)];
var isTask = (bool?) isTaskValue ?? false;
if (isTask)
{
return Visibility.Collapsed;
}
var isParsingSuccessful = bool.TryParse(customFields[nameof(SchedulerAppointmentVM.IsAbsenceTime)].ToString(), out var isAbsenceTime);
return isParsingSuccessful && isAbsenceTime ? Visibility.Collapsed : Visibility.Visible;
}

View File

@@ -16,6 +16,7 @@
<view:OriginatorExtraxtor x:Key="OriginatorExtraxtor" />
<converter:ObjectBoolConverter x:Key="ObjectBoolConverter" />
<view:Int2VisibilityConverter x:Key="Int2VisibilityConverter" />
<view:SerienterminDauerAnzeigeConverter x:Key="SerienterminDauerAnzeigeConverter" />
<LinearGradientBrush x:Key="NavigationContentBrush" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF04B4D0" Offset="0" />
<GradientStop Color="#FF038195" Offset="1" />
@@ -115,10 +116,12 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="4" HorizontalAlignment="Center" Visibility="{Binding Path=SelektierterTermin, Converter={StaticResource Int2VisibilityConverter}, ConverterParameter=TerminVerstrichen}" Foreground="#9a0000">Dieser Termin liegt in der Vergangenheit</TextBlock>
<TextBlock Grid.ColumnSpan="4" HorizontalAlignment="Center" Visibility="{Binding Path=SelektierterTermin, Converter={StaticResource Int2VisibilityConverter}, ConverterParameter=TerminVerstrichen}" Foreground="#9a0000">Dieser Termin liegt in der Vergangenheit</TextBlock>
<Label Grid.Column="0" Grid.Row="1" Content="Betreff" Margin="3" />
<TextBox Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="1" Height="23" Margin="3" Text="{Binding Path=SelektierterTermin.Subject}" IsReadOnly="True" />
@@ -129,25 +132,29 @@
<TextBox Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="3" Height="23" Margin="3" Text="{Binding Path=SelektierterTermin, Converter={StaticResource OriginatorExtraxtor}}" IsReadOnly="True" />
<Label Grid.Column="0" Grid.Row="4" VerticalAlignment="Center" Content="Start" Margin="3"/>
<dxe:DateEdit Grid.Column="1" Grid.Row="4" MaskType="DateTimeAdvancingCaret" Background="White" Height="23" MinWidth="80" Margin="3" IsEnabled="False" EditValue="{Binding SelektierterTermin.Start}" IsReadOnly="True" />
<dxe:TextEdit IsEnabled="False" Grid.Column="2" Grid.Row="4" MaskType="DateTime" Mask="t" MaskUseAsDisplayFormat="True" Margin="3" Height="23" EditValue ="{Binding SelektierterTermin.StartTime, Converter={StaticResource TimeSpanToDateTimeConverter}, Mode=OneWay}" IsReadOnly="True"/>
<dxe:DateEdit Grid.Column="1" Grid.Row="4" MaskType="DateTimeAdvancingCaret" Background="White" Height="23" MinWidth="80" Margin="3" IsEnabled="True" EditValue="{Binding SelektierterTermin.Start}" IsReadOnly="True" PopupOpening="PopupBaseEdit_OnPopupOpening" />
<dxe:TextEdit IsEnabled="True" Grid.Column="2" Grid.Row="4" MaskType="DateTime" Mask="t" MaskUseAsDisplayFormat="True" Margin="3" Height="23" EditValue ="{Binding SelektierterTermin.StartTime, Converter={StaticResource TimeSpanToDateTimeConverter}, Mode=OneWay}" IsReadOnly="True"/>
<dxe:CheckEdit IsEnabled="False" Grid.Column="3" Grid.Row="4" Content="Ganztägig" EditValue ="{Binding SelektierterTermin.AllDay}" HorizontalAlignment="Right" Margin="3" IsReadOnly="True" />
<Label Grid.Column="0" Grid.Row="5" VerticalAlignment="Center" Content="Ende" Margin="3"/>
<dxe:DateEdit IsEnabled="False" Grid.Column="1" Grid.Row="5" MaskType="DateTimeAdvancingCaret" Background="White" Height="23" MinWidth="80" Margin="3" EditValue="{Binding SelektierterTermin.End}" IsReadOnly="True" />
<dxe:TextEdit IsEnabled="False" Grid.Column="2" Grid.Row="5" MaskType="DateTime" Mask="t" MaskUseAsDisplayFormat="True" Margin="3" Height="23" EditValue ="{Binding SelektierterTermin.EndTime, Converter={StaticResource TimeSpanToDateTimeConverter}, Mode=OneWay}" IsReadOnly="True"/>
<dxe:DateEdit IsEnabled="True" Grid.Column="1" Grid.Row="5" MaskType="DateTimeAdvancingCaret" Background="White" Height="23" MinWidth="80" Margin="3" EditValue="{Binding SelektierterTermin.End}" IsReadOnly="True" PopupOpening="PopupBaseEdit_OnPopupOpening" />
<dxe:TextEdit IsEnabled="True" Grid.Column="2" Grid.Row="5" MaskType="DateTime" Mask="t" MaskUseAsDisplayFormat="True" Margin="3" Height="23" EditValue ="{Binding SelektierterTermin.EndTime, Converter={StaticResource TimeSpanToDateTimeConverter}, Mode=OneWay}" IsReadOnly="True"/>
<Label Grid.Column="0" Grid.Row="6" Margin="3" Content="Notiz"/>
<TextBox Grid.Column="1" Grid.Row="6" Grid.ColumnSpan="3" AcceptsReturn="True" VerticalScrollBarVisibility="Auto"
VerticalAlignment="Stretch" HorizontalScrollBarVisibility="Disabled" Margin="3" TextWrapping="Wrap"
Text="{Binding Path=SelektierterTermin.Description}" IsReadOnly="True" />
<Label Grid.Column="0" Grid.Row="6" VerticalAlignment="Center" Content="Serientermin" Margin="3" Visibility="{Binding Path=SelektierterTermin, Converter={StaticResource Int2VisibilityConverter}, ConverterParameter=SerienterminLabel}" />
<TextBlock Grid.Column="1" Grid.Row="6" Grid.ColumnSpan="3" Margin="3" Padding="0" Foreground="Black" VerticalAlignment="Center"
Text="{Binding Path=SelektierterTermin, Converter={StaticResource SerienterminDauerAnzeigeConverter}}"
Visibility="{Binding Path=SelektierterTermin, Converter={StaticResource Int2VisibilityConverter}, ConverterParameter=SerienterminLabel}"
TextWrapping="WrapWithOverflow"/>
<Label Grid.Column="0" Grid.Row="7" Margin="3" Content="Notiz"/>
<TextBox Grid.Column="1" Grid.Row="7" Grid.ColumnSpan="3" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" VerticalAlignment="Stretch" HorizontalScrollBarVisibility="Disabled" Margin="3" TextWrapping="Wrap" Text="{Binding Path=SelektierterTermin.Description}" IsReadOnly="True" />
<StackPanel x:Name="ZusagenStack" Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="4" HorizontalAlignment="Right" Orientation="Horizontal" Visibility="{Binding Path=SelektierterTermin, Converter={StaticResource Int2VisibilityConverter}, ConverterParameter=ZusagenStack}">
<StackPanel x:Name="ZusagenStack" Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="4" HorizontalAlignment="Right" Orientation="Horizontal" Visibility="{Binding Path=SelektierterTermin, Converter={StaticResource Int2VisibilityConverter}, ConverterParameter=ZusagenStack}">
<Button Margin="3" Content="Zusagen" Click="Zusagen_OnClick" IsEnabled="{Binding SelektierterTermin, Converter={StaticResource ObjectBoolConverter}}" />
<Button Margin="3" Content="Mit Vorbehalt" Click="MitVorbehalt_OnClick" IsEnabled="{Binding SelektierterTermin, Converter={StaticResource ObjectBoolConverter}}" />
<Button Margin="3" Content="Absagen" Click="Absagen_OnClick" IsEnabled="{Binding SelektierterTermin, Converter={StaticResource ObjectBoolConverter}}" />
</StackPanel>
<Button x:Name="OkButton" Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="4" HorizontalAlignment="Right" Margin="3" Content="OK" Click="OK_OnClick" Visibility="{Binding Path=SelektierterTermin, Converter={StaticResource Int2VisibilityConverter}}" />
<Button x:Name="OkButton" Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="4" HorizontalAlignment="Right" Margin="3" Content="OK" Click="OK_OnClick" Visibility="{Binding Path=SelektierterTermin, Converter={StaticResource Int2VisibilityConverter}, ConverterParameter=OKBtn}" />
</Grid>
</Grid>
<Button Grid.Row="1" x:Name="CloseBtn" Content="Schließen" HorizontalAlignment="Right" Margin="3" Click="CloseButton_Click" />

View File

@@ -7,6 +7,7 @@ using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using BeWo.Annotations;
using BeWo.Scheduler.ViewModel;
using BeWo.ServiceProxy;
@@ -16,16 +17,19 @@ using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using DevExpress.Xpf.Editors;
using DevExpress.XtraScheduler;
namespace BeWo.Scheduler.View
{
public partial class RequestAnswerView : INotifyPropertyChanged
{
public static readonly RoutedEvent ParticipationChangedEvent = EventManager.RegisterRoutedEvent("ParticipationChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(RequestAnswerView));
public static readonly RoutedEvent ParticipationChangedEvent = EventManager.RegisterRoutedEvent(nameof(ParticipationChanged), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(RequestAnswerView));
public event RoutedEventHandler ParticipationChanged
{
add { AddHandler(ParticipationChangedEvent, value); }
remove { RemoveHandler(ParticipationChangedEvent, value); }
add => AddHandler(ParticipationChangedEvent, value);
remove => RemoveHandler(ParticipationChangedEvent, value);
}
private void RaiseParticipationChangedEventEvent()
@@ -39,20 +43,19 @@ namespace BeWo.Scheduler.View
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
if(PropertyChanged != null)
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public ObservableCollection<IBeWoAppointment> OffeneTermine { get; set; }
private IBeWoAppointment selektierterTermin;
private IBeWoAppointment _selektierterTermin;
public IBeWoAppointment SelektierterTermin
{
get { return selektierterTermin; }
set
get => _selektierterTermin;
set
{
selektierterTermin = value;
OnPropertyChanged("SelektierterTermin");
_selektierterTermin = value;
OnPropertyChanged(nameof(SelektierterTermin));
}
}
@@ -67,7 +70,10 @@ namespace BeWo.Scheduler.View
{
if(statusUpdatesAsAppointments.All(a => a.LabelId != relation.Employee2SchedulerAppointmentOid))
{
statusUpdatesAsAppointments.Add(BuildNewVMFromOldVM(item, relation.Employee2SchedulerAppointmentOid.Value));
if(relation.Employee2SchedulerAppointmentOid != null)
{
statusUpdatesAsAppointments.Add(BuildNewVMFromOldVM(item, relation.Employee2SchedulerAppointmentOid.Value));
}
}
}
}
@@ -78,8 +84,8 @@ namespace BeWo.Scheduler.View
DataContext = this;
InitializeComponent();
}
private static SchedulerAppointmentVM BuildNewVMFromOldVM(SchedulerAppointmentVM item, long emp2appOid)
private static SchedulerAppointmentVM BuildNewVMFromOldVM(SchedulerAppointmentVM item, long emp2AppOid)
{
return new SchedulerAppointmentVM(new SchedulerAppointmentDC
{
@@ -88,8 +94,8 @@ namespace BeWo.Scheduler.View
IsPrivate = item.IsPrivate,
RecurrenceInfo = item.RecurrenceInfo,
Type = item.EventType,
CustomerList = (List<CompactCustomerDC>)item.CustomFields["CustomerList"],
ResourceList = (List<ResourceDC>)item.CustomFields["ResourceList"],
CustomerList = (List<CompactCustomerDC>)item.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)],
ResourceList = (List<ResourceDC>)item.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)],
AllDay = item.AllDay,
EmployeeList = item.EmployeeList,
Description = item.Description,
@@ -98,9 +104,10 @@ namespace BeWo.Scheduler.View
Location = item.Location,
Subject = item.Subject,
Status = 1,
Originator = (CompactEmployeeDC)item.CustomFields["Originator"]
Originator = (CompactEmployeeDC)item.CustomFields[nameof(SchedulerAppointmentVM.Originator)],
IsTeilnahmeBestaetigung = true
})
{ CustomFields = item.CustomFields, LabelId = Convert.ToInt32(emp2appOid)};
{ CustomFields = item.CustomFields, LabelId = Convert.ToInt32(emp2AppOid)};
}
private void CloseButton_Click(object sender, RoutedEventArgs e)
@@ -170,18 +177,18 @@ namespace BeWo.Scheduler.View
this.Dispatch(() =>
{
OffeneTermine = OffeneTermine.Where(w => !w.Equals(vm)).ToObservableCollection();
OnPropertyChanged("OffeneTermine");
OnPropertyChanged(nameof(OffeneTermine));
RaiseParticipationChangedEventEvent();
});
}
else
{
var test = (SchedulerAppointmentVM) OffeneTermine.FirstOrDefault(f => dc.EmployeeList.Any(a => a.Employee2SchedulerAppointmentOid.Value == f.LabelId));
var test = (SchedulerAppointmentVM) OffeneTermine.FirstOrDefault(f => dc.EmployeeList.Any(a => a.Employee2SchedulerAppointmentOid.HasValue && a.Employee2SchedulerAppointmentOid.Value == f.LabelId));
this.Dispatch(() =>
{
OffeneTermine = OffeneTermine.Where(w => !w.Equals(test)).ToObservableCollection();
OnPropertyChanged("OffeneTermine");
OnPropertyChanged(nameof(OffeneTermine));
RaiseParticipationChangedEventEvent();
});
@@ -209,18 +216,21 @@ namespace BeWo.Scheduler.View
private void OK_OnClick(object sender, RoutedEventArgs e)
{
SelektierterTermin = OTListView.SelectedItem as IBeWoAppointment;
if (selektierterTermin != null && selektierterTermin.Start < DateTime.Now && selektierterTermin.End < DateTime.Now)
if(_selektierterTermin != null && _selektierterTermin.Start < DateTime.Now && _selektierterTermin.End < DateTime.Now)
{
var emp2app = ((List<Employee2SchedulerAppointmentDC>) SelektierterTermin.CustomFields["EmployeeList"]).Find(f => f.Employee2SchedulerAppointmentOid == SelektierterTermin.LabelId) ??
((List<Employee2SchedulerAppointmentDC>) SelektierterTermin.CustomFields["EmployeeList"]).Find(f => f.Employee.EmployeeOid == BeWoApp.LoggedOnEmployee.EmployeeOid.Value);
if(SelektierterTermin != null && BeWoApp.LoggedOnEmployee.EmployeeOid.HasValue)
{
var emp2App = ((List<Employee2SchedulerAppointmentDC>) SelektierterTermin.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)]).Find(f => f.Employee2SchedulerAppointmentOid == SelektierterTermin.LabelId) ??
((List<Employee2SchedulerAppointmentDC>) SelektierterTermin.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)]).Find(f => f.Employee.EmployeeOid == BeWoApp.LoggedOnEmployee.EmployeeOid.Value);
if (emp2app.Employee.EmployeeOid == BeWoApp.LoggedOnEmployee.EmployeeOid.Value)
{
emp2app.ParticipationAnswer = ParticipationAnswer.Verstrichen;
}
if(emp2App.Employee.EmployeeOid == BeWoApp.LoggedOnEmployee.EmployeeOid.Value)
{
emp2App.ParticipationAnswer = ParticipationAnswer.Verstrichen;
}
emp2app.IsPC_CheckedTs = DateTime.Now;
emp2app.IsPChanged = false;
emp2App.IsPC_CheckedTs = DateTime.Now;
emp2App.IsPChanged = false;
}
ToggleControls();
ServiceFacade.DoResourceServiceAsync(s => s.UpdateSchedulerAppointments(new List<SchedulerAppointmentDC> { ((SchedulerAppointmentVM)SelektierterTermin).DataContract }), UpdateView);
@@ -228,17 +238,16 @@ namespace BeWo.Scheduler.View
return;
}
if (SelektierterTermin == null || SelektierterTermin.LabelId <= 0)
if(SelektierterTermin == null || SelektierterTermin.LabelId <= 0)
{
return;
}
((List<Employee2SchedulerAppointmentDC>) SelektierterTermin.CustomFields["EmployeeList"]).Find(f => f.Employee2SchedulerAppointmentOid == SelektierterTermin.LabelId).IsPC_CheckedTs = DateTime.Now;
((List<Employee2SchedulerAppointmentDC>) SelektierterTermin.CustomFields["EmployeeList"]).Find(f => f.Employee2SchedulerAppointmentOid == SelektierterTermin.LabelId).IsPChanged = false;
((List<Employee2SchedulerAppointmentDC>) SelektierterTermin.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)]).Find(f => f.Employee2SchedulerAppointmentOid == SelektierterTermin.LabelId).IsPC_CheckedTs = DateTime.Now;
((List<Employee2SchedulerAppointmentDC>) SelektierterTermin.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)]).Find(f => f.Employee2SchedulerAppointmentOid == SelektierterTermin.LabelId).IsPChanged = false;
ToggleControls();
ServiceFacade.DoResourceServiceAsync(s => s.UpdateSchedulerAppointments(new List<SchedulerAppointmentDC> {((SchedulerAppointmentVM) SelektierterTermin).DataContract}),
UpdateView);
ServiceFacade.DoResourceServiceAsync(s => s.UpdateSchedulerAppointments(new List<SchedulerAppointmentDC> {((SchedulerAppointmentVM) SelektierterTermin).DataContract}), UpdateView);
}
private static void UpdateViewModel(SchedulerAppointmentDC dc, SchedulerAppointmentVM vm)
@@ -252,6 +261,12 @@ namespace BeWo.Scheduler.View
OkButton.IsEnabled = !OkButton.IsEnabled;
CloseBtn.IsEnabled = !CloseBtn.IsEnabled;
}
private void PopupBaseEdit_OnPopupOpening(object sender, OpenPopupEventArgs e)
{
// Es wird verhindert, dass das Popup angezeigt wird auch wenn das DateEdit readonly ist, damit man es nicht auf disabled setzen muss, da sonst die Schriftfarbe schwer lesbar ist.
e.Cancel = true;
}
}
public class LVItemConverter : IValueConverter
@@ -260,15 +275,20 @@ namespace BeWo.Scheduler.View
{
var app = (IBeWoAppointment) value;
if (app.LabelId <= 0)
if(app == null)
{
return string.Empty;
}
if(app.LabelId <= 0)
{
return String.Format("{0}: {1}", app.Start.ToShortDateString(), app.Subject);
return $"{app.Start.ToShortDateString()}: {app.Subject}";
}
var s = string.Empty;
var l = ((List<Employee2SchedulerAppointmentDC>) app.CustomFields["EmployeeList"]).Find(f => f.Employee2SchedulerAppointmentOid == app.LabelId);
var l = ((List<Employee2SchedulerAppointmentDC>) app.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)]).Find(f => f.Employee2SchedulerAppointmentOid == app.LabelId);
switch (l.ParticipationAnswer)
switch(l.ParticipationAnswer)
{
case ParticipationAnswer.Zusage:
s = "zugesagt";
@@ -281,7 +301,7 @@ namespace BeWo.Scheduler.View
break;
}
return String.Format("{0}: {1} {2} hat {3}",app.Start.ToShortDateString(),l.Employee.FirstName,l.Employee.LastName,s);
return $"{app.Start.ToShortDateString()}: {l.Employee.FirstName} {l.Employee.LastName} hat {s}";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
@@ -294,13 +314,13 @@ namespace BeWo.Scheduler.View
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
if(value == null)
{
return null;
}
var app = (IBeWoAppointment)value;
var originator = (CompactEmployeeDC) app.CustomFields["Originator"];
var originator = (CompactEmployeeDC) app.CustomFields[nameof(SchedulerAppointmentVM.Originator)];
return originator.FirstName + " " + originator.LastName;
}
@@ -315,27 +335,58 @@ namespace BeWo.Scheduler.View
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
if(value == null)
{
return Visibility.Collapsed;
}
var appointment = (SchedulerAppointmentVM) value;
if (parameter != null && parameter.Equals("ZusagenStack"))
{
var shouldBeVisible = appointment.LabelId <= 0 && !(appointment.Start < DateTime.Now && appointment.End < DateTime.Now);
var eternalEh = false;
var liegtInDerVergangenheit = appointment.Start < DateTime.Now && appointment.End < DateTime.Now;
if(appointment.RecurrenceInfo != null)
{
IRecurrenceInfo info = new RecurrenceInfo();
info.FromXml(appointment.RecurrenceInfo);
eternalEh = info.Range == RecurrenceRange.NoEndDate;
liegtInDerVergangenheit = info.Start < DateTime.Now && info.End < DateTime.Now;
}
if(parameter != null && parameter.Equals("ZusagenStack"))
{
if(appointment.IsTeilnahmeBestaetigung)
{
return Visibility.Collapsed;
}
var shouldBeVisible = !liegtInDerVergangenheit;
if(appointment.RecurrenceInfo != null)
{
shouldBeVisible = !liegtInDerVergangenheit || eternalEh;
}
return shouldBeVisible ? Visibility.Visible : Visibility.Collapsed;
}
if (parameter != null && parameter.Equals("TerminVerstrichen"))
if(parameter != null && parameter.Equals("OKBtn"))
{
return appointment.IsTeilnahmeBestaetigung || liegtInDerVergangenheit && !eternalEh ? Visibility.Visible : Visibility.Collapsed;
}
if(parameter != null && parameter.Equals("TerminVerstrichen"))
{
return appointment.Start < DateTime.Now && appointment.End < DateTime.Now ? Visibility.Visible : Visibility.Collapsed;
return liegtInDerVergangenheit && !eternalEh ? Visibility.Visible : Visibility.Collapsed;
}
return appointment.LabelId > 0 || appointment.Start < DateTime.Now && appointment.End < DateTime.Now ? Visibility.Visible : Visibility.Collapsed;
if(parameter != null && parameter.Equals("SerienterminLabel"))
{
return appointment.RecurrenceInfo != null ? Visibility.Visible : Visibility.Collapsed;
}
return appointment.IsTeilnahmeBestaetigung || liegtInDerVergangenheit ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
@@ -343,4 +394,218 @@ namespace BeWo.Scheduler.View
throw new NotImplementedException();
}
}
public class SerienterminDauerAnzeigeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(value == null)
{
return null;
}
var appointment = (SchedulerAppointmentVM) value;
if(appointment.RecurrenceInfo == null)
{
return "";
}
IRecurrenceInfo info = new RecurrenceInfo();
info.FromXml(appointment.RecurrenceInfo);
var rangeString = "";
var suffix = "";
var periodicity = info.Periodicity;
var intervalPlural = "";
var wochentage = "";
string wocheDesMonats;
switch(info.Range)
{
case RecurrenceRange.EndByDate:
rangeString += "bis zum " + info.End.ToShortDateString() + " ";
break;
case RecurrenceRange.OccurrenceCount:
rangeString += info.OccurrenceCount + " mal ";
break;
}
switch(info.Type)
{
case RecurrenceType.Daily:
if(periodicity == 1)
{
suffix = info.WeekDays.Equals(WeekDays.WorkDays) ? "jeden Arbeitstag " : "täglich ";
}
intervalPlural = " Tage ";
break;
case RecurrenceType.Weekly:
if(periodicity == 1)
{
suffix = "wöchentlich ";
}
intervalPlural = " Wochen ";
wochentage = TranslateWorkDays(info.WeekDays.ToString(), true);
break;
case RecurrenceType.Yearly:
wochentage = TranslateWorkDays(info.WeekDays.ToString(), false);
wocheDesMonats = TranslateWeekOfMonth(info.WeekOfMonth);
var tag = info.DayNumber;
suffix = "jährlich ";
if(info.WeekOfMonth != WeekOfMonth.None)
{
suffix += "jeden " + wocheDesMonats + wochentage + "im " + GetMonthByInt(info.Month);
}
else
{
suffix += "am " + tag + ". " + GetMonthByInt(info.Month);
}
wochentage = "";
break;
case RecurrenceType.Monthly:
string monatlichesInterval;
if(info.WeekOfMonth != WeekOfMonth.None)
{
wocheDesMonats = TranslateWeekOfMonth(info.WeekOfMonth);
wochentage = TranslateWorkDays(info.WeekDays.ToString(), false);
suffix = "jeden " + wocheDesMonats + wochentage;
if(periodicity == 1)
{
monatlichesInterval = "jedes Monats ";
}
else
{
monatlichesInterval = "jedes " + periodicity + ". Monats ";
}
suffix += monatlichesInterval;
wochentage = "";
}
else
{
if(periodicity == 1)
{
monatlichesInterval = "jedes Monats ";
}
else
{
monatlichesInterval = "jedes " + periodicity + ". Monats ";
}
suffix = "am " + info.DayNumber + ". " + monatlichesInterval;
wochentage = "";
}
break;
}
if(periodicity > 1 && info.Type != RecurrenceType.Monthly)
{
suffix = "alle " + periodicity + intervalPlural;
}
return "Dieser Termin wird " + rangeString + suffix + wochentage + "wiederholt";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
private static string TranslateWorkDays(string weekDays, bool mitGenitivS)
{
weekDays = weekDays.Replace("Monday", mitGenitivS ? "Montags" : "Montag");
weekDays = weekDays.Replace("Tuesday", mitGenitivS ? "Dienstags" : "Dienstag");
weekDays = weekDays.Replace("Wednesday", mitGenitivS ? "Mittwochs" : "Mittwoch");
weekDays = weekDays.Replace("Thursday", mitGenitivS ? "Donnerstags" : "Donnerstag");
weekDays = weekDays.Replace("Friday", mitGenitivS ? "Freitags" : "Freitag");
weekDays = weekDays.Replace("Saturday", mitGenitivS ? "Samstags" : "Samstag");
weekDays = weekDays.Replace("Sunday", mitGenitivS ? "Sonntags" : "Sonntag");
weekDays = weekDays.Replace("EveryDay", "jeden Tag");
var lastComma = weekDays.LastIndexOf(',');
if(lastComma != -1)
{
weekDays = weekDays.Remove(lastComma, 1).Insert(lastComma, " und");
}
return weekDays + " ";
}
private static string TranslateWeekOfMonth(WeekOfMonth weekOfMonth)
{
var result = " ";
switch(weekOfMonth)
{
case WeekOfMonth.First:
result = "ersten ";
break;
case WeekOfMonth.Second:
result = "zweiten ";
break;
case WeekOfMonth.Third:
result = "dritten ";
break;
case WeekOfMonth.Fourth:
result = "vierten ";
break;
case WeekOfMonth.Last:
result = "letzten ";
break;
case WeekOfMonth.None:
return result;
default:
return result;
}
return result;
}
private static string GetMonthByInt(int month)
{
switch(month)
{
case 1:
return "Januar ";
case 2:
return "Februar ";
case 3:
return "März ";
case 4:
return "April ";
case 5:
return "Mai ";
case 6:
return "Juni ";
case 7:
return "Juli ";
case 8:
return "August ";
case 9:
return "September ";
case 10:
return "Oktober ";
case 11:
return "November ";
case 12:
return "Dezember ";
default:
return " ";
}
}
}
}

View File

@@ -11,6 +11,7 @@
xmlns:bewoConverter="clr-namespace:BeWo.Converter"
xmlns:localSchView="clr-namespace:BeWo.Scheduler.View"
xmlns:search="clr-namespace:BeWo.View.Search"
xmlns:controls="clr-namespace:BeWo.View.Controls"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Width="420">
<localSchView:AbstractAppointmentEditForm.Resources>
<dxschint:TimeSpanToDateTimeConverter x:Key="TimeSpanToDateTimeConverter"/>
@@ -166,22 +167,27 @@
<Grid>
<Grid HorizontalAlignment="Stretch" Background="#0C000000">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <!-- 0 -->
<RowDefinition Height="Auto"/> <!-- 1 -->
<RowDefinition Height="Auto"/> <!-- 2 -->
<RowDefinition Height="Auto"/> <!-- 3 -->
<RowDefinition Height="Auto"/> <!-- 4 -->
<RowDefinition Height="Auto"/> <!-- 5 -->
<RowDefinition Height="Auto"/> <!-- 6 -->
<RowDefinition Height="Auto"/> <!-- 7 -->
<RowDefinition Height="Auto"/> <!-- 8 -->
<RowDefinition Height="Auto"/> <!-- 9 -->
<RowDefinition Height="Auto"/> <!-- 10 -->
<RowDefinition Height="Auto"/> <!-- 11 -->
<RowDefinition Height="Auto"/> <!-- 12 -->
<RowDefinition Height="*"/> <!-- 13 -->
<RowDefinition Height="Auto"/> <!-- 14 -->
<RowDefinition Height="*"/> <!-- 15 -->
<RowDefinition Height="Auto"/> <!-- 16 -->
<RowDefinition Height="Auto"/> <!-- 17 -->
<RowDefinition Height="Auto"/> <!-- 18 -->
<RowDefinition Height="Auto"/> <!-- 19 -->
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
@@ -190,31 +196,37 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Region Betreff -->
<Label Content="Betreff" Grid.Column="0" Grid.Row="0" />
<Label Content="Betreff" Grid.Column="0" Grid.Row="0" x:Name="BetreffLabel" />
<dxe:TextEdit Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="4" Margin="3" Height="23" EditValue="{Binding Controller.Subject}"/>
<!-- Endregion -->
<!-- Region Ort -->
<Label Content="Ort" Grid.Column="0" Grid.Row="1" />
<dxe:TextEdit Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="4" Margin="3" Height="23" EditValue="{Binding Controller.Location}"/>
<Label x:Name="OrtLabel" Content="Ort" Grid.Column="0" Grid.Row="1" />
<dxe:TextEdit x:Name="Ort" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="4" Margin="3" Height="23" EditValue="{Binding Controller.Location}"/>
<!-- Endregion -->
<!-- Region Start -->
<Label Grid.Column="0" Grid.Row="2" VerticalAlignment="Center" Content="Start"/>
<dxe:DateEdit Grid.Column="1" Grid.Row="2" MaskType="DateTimeAdvancingCaret" Background="White" Height="23" MinWidth="80" Margin="3" EditValue="{Binding Controller.DisplayStartDate}" x:Name="StartDate"/>
<dxe:TextEdit Grid.Column="2" Grid.Row="2" MaskType="DateTime" Mask="t" MaskUseAsDisplayFormat="True" Margin="3" Height="23" EditValue ="{Binding Controller.DisplayStartTime, Converter={StaticResource TimeSpanToDateTimeConverter}}" x:Name="StartTime"/>
<dxe:CheckEdit Grid.Column="3" Grid.Row="2" Content="Ganztägig" EditValue ="{Binding Controller.AllDay}" HorizontalAlignment="Right" Margin="3" />
<Label x:Name="StartLabel" Grid.Column="0" Grid.Row="2" VerticalAlignment="Center" Content="Start"/>
<dxe:DateEdit Grid.Column="1" Grid.Row="2" MaskType="DateTimeAdvancingCaret" Background="White" Height="23" MinWidth="80" Margin="3" EditValue="{Binding Controller.DisplayStartDate}" x:Name="StartDate"/>
<dxe:TextEdit Grid.Column="2" Grid.Row="2" MaskType="DateTime" Mask="t" MaskUseAsDisplayFormat="True" Margin="3" Height="23" EditValue ="{Binding Controller.DisplayStartTime, Converter={StaticResource TimeSpanToDateTimeConverter}}" x:Name="StartTime"/>
<dxe:CheckEdit x:Name="AllDay" Grid.Column="3" Grid.Row="2" Content="Ganztägig" EditValue ="{Binding Controller.AllDay}" HorizontalAlignment="Right" Margin="3" />
<!-- Endregion -->
<!-- Region Ende -->
<Label Grid.Column="0" Grid.Row="3" VerticalAlignment="Center" Content="Ende"/>
<Label x:Name="EndLabel" Grid.Column="0" Grid.Row="3" VerticalAlignment="Center" Content="Ende"/>
<dxe:DateEdit Grid.Column="1" Grid.Row="3" MaskType="DateTimeAdvancingCaret" Background="White" Height="23" MinWidth="80" Margin="3" EditValue="{Binding Controller.DisplayEndDate}" x:Name="EndDate"/>
<dxe:TextEdit Grid.Column="2" Grid.Row="3" MaskType="DateTime" Mask="t" MaskUseAsDisplayFormat="True" Margin="3" Height="23" EditValue ="{Binding Controller.DisplayEndTime, Converter={StaticResource TimeSpanToDateTimeConverter}}" x:Name="EndTime"/>
<!-- Endregion -->
<!-- Region Mitarbeiter -->
<Label Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" Content="Mitarbeiter"/>
<Grid Grid.Column="1" Grid.Row="4" Height="23" Margin="3,3,0,3" Grid.ColumnSpan="3">
<!-- Region Zu erledigen bis -->
<Label Visibility="Collapsed" x:Name="DueDateLabel" Grid.Column="0" Grid.Row="4" VerticalAlignment="Center" Content="Zu erledigen bis" />
<dxe:DateEdit Visibility="Collapsed" x:Name="DueDate" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="4" MaskType="DateTimeAdvancingCaret" Background="White" Height="23" MinWidth="80" Margin="3" EditValue="{Binding Controller.DisplayDueDateDate}" />
<dxe:TextEdit Visibility="Collapsed" x:Name="DueDateTime" Grid.Column="3" Grid.ColumnSpan="2" Grid.Row="4" MaskType="DateTime" Mask="t" MaskUseAsDisplayFormat="True" Margin="3" Height="23" EditValue ="{Binding Controller.DisplayDueDateTime, Converter={StaticResource TimeSpanToDateTimeConverter}}" />
<!-- Endregion -->
<!-- Region Mitarbeiter -->
<Label Grid.Row="5" Grid.Column="0" VerticalAlignment="Center" Content="Mitarbeiter"/>
<Grid Grid.Column="1" Grid.Row="5" Height="23" Margin="3,3,0,3" Grid.ColumnSpan="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
@@ -222,16 +234,16 @@
<TextBox IsReadOnly="True" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding CountSelectedEmployees, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Margin="0" />
<ToggleButton Grid.Column="1" x:Name="MitarbeiterToggleButton" IsThreeState="False" Margin="0,0,2,0" Height="19" Width="19" ToolTip="Ausgewählte Mitarbeiter anzeigen" Style="{StaticResource ExpanderLookAlikeToggleBotton}"/>
</Grid>
<Popup Grid.Column="1" Grid.Row="4" Margin="10" Name="PopupEmployee" StaysOpen="False" Placement="MousePoint" Width="370" Height="300" >
<Popup Grid.Column="1" Grid.Row="5" Margin="10" Name="PopupEmployee" StaysOpen="False" Placement="MousePoint" Width="370" Height="300" >
<search:MultiEmployeeSearch x:Name="MultiEmployeeSearch" ResultListBackground="{StaticResource EmployeeListBrush}" SelectionChanged="MultiEmployeeSearch_OnSelectionChanged" SelectedEmployees="{Binding Controller.EmployeeList, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
</Popup>
<Button x:Name="MitarbeiterPopUpOeffnenBtn" Grid.Column="4" Grid.Row="4" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="EmployeePopupClick">
<Button x:Name="MitarbeiterPopUpOeffnenBtn" Grid.Column="4" Grid.Row="5" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="EmployeePopupClick">
<Grid Width="18" HorizontalAlignment="Center" VerticalAlignment="Center">
<Line X1="4" X2="12" Y1="8" Y2="8" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
<Line X1="8" X2="8" Y1="4" Y2="12" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
</Grid>
</Button>
<ListBox Grid.Column="1" Grid.Row="5" Background="{StaticResource ObjectEditBackgroundBrush}" Margin="4,0,1,4" ItemsSource="{Binding Path=SelectedEmployees, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" IsSynchronizedWithCurrentItem="True"
<ListBox Grid.Column="1" Grid.Row="6" Background="{StaticResource ObjectEditBackgroundBrush}" Margin="4,0,1,4" ItemsSource="{Binding Path=SelectedEmployees, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" IsSynchronizedWithCurrentItem="True"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.ColumnSpan="3" x:Name="SelectedMitarbeiter"
ItemContainerStyle="{DynamicResource MultiElementSelectionControlStyle}" MaxHeight="70" Height="70"
Visibility="{Binding IsChecked, ElementName=MitarbeiterToggleButton, Converter={StaticResource BoolVisibilityConverter}}">
@@ -248,8 +260,8 @@
<!-- Endregion -->
<!-- Region Klienten -->
<Label Grid.Column="0" Grid.Row="6" VerticalAlignment="Center" Content="Klienten"/>
<Grid Grid.Column="1" Grid.Row="6" Height="23" Margin="3,3,0,3" Grid.ColumnSpan="3">
<Label Grid.Column="0" Grid.Row="7" VerticalAlignment="Center" Content="Klienten"/>
<Grid Grid.Column="1" Grid.Row="7" Height="23" Margin="3,3,0,3" Grid.ColumnSpan="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
@@ -257,16 +269,16 @@
<TextBox IsReadOnly="True" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding CountSelectedCustomers, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
<ToggleButton Grid.Column="1" x:Name="KlientenToggleButton" IsThreeState="False" Margin="0,0,2,0" Height="19" Width="19" ToolTip="Ausgewählte Klienten anzeigen" Style="{StaticResource ExpanderLookAlikeToggleBotton}"/>
</Grid>
<Button x:Name="KlientenPopUpOeffnenBtn" Grid.Column="4" Grid.Row="6" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="CustomerPopUpEditClick">
<Button x:Name="KlientenPopUpOeffnenBtn" Grid.Column="4" Grid.Row="7" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="CustomerPopUpEditClick">
<Grid Width="18" HorizontalAlignment="Center" VerticalAlignment="Center">
<Line X1="4" X2="12" Y1="8" Y2="8" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
<Line X1="8" X2="8" Y1="4" Y2="12" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
</Grid>
</Button>
<Popup Grid.Column="1" Grid.Row="6" Margin="10" Name="PopupCustomer" StaysOpen="False" Placement="MousePoint" Width="370" Height="300" >
<Popup Grid.Column="1" Grid.Row="7" Margin="10" Name="PopupCustomer" StaysOpen="False" Placement="MousePoint" Width="370" Height="300" >
<search:MultiCustomerSearchView x:Name="MultiCustomerSearch" ResultListBackground="{StaticResource CustomerListBrush}" SelectionChanged="MultiCustomerSearch_OnSelectionChanged" SelectedCustomers="{Binding Controller.CustomerList, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
</Popup>
<ListBox Grid.Column="1" Grid.Row="7" Background="{StaticResource ObjectEditBackgroundBrush}" Margin="4,0,1,4" ItemsSource="{Binding Path=SelectedCustomers, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" IsSynchronizedWithCurrentItem="True"
<ListBox Grid.Column="1" Grid.Row="8" Background="{StaticResource ObjectEditBackgroundBrush}" Margin="4,0,1,4" ItemsSource="{Binding Path=SelectedCustomers, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" IsSynchronizedWithCurrentItem="True"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.ColumnSpan="3"
ItemContainerStyle="{DynamicResource MultiElementSelectionControlStyle}" MaxHeight="70" Height="70" x:Name="SelectedKlient"
Visibility="{Binding IsChecked, ElementName=KlientenToggleButton, Converter={StaticResource BoolVisibilityConverter}}">
@@ -283,8 +295,8 @@
<!-- Endregion -->
<!-- Region Ressourcen -->
<Label Grid.Column="0" Grid.Row="8" VerticalAlignment="Center" Content="Ressourcen"/>
<Grid Grid.Column="1" Grid.Row="8" Height="23" Margin="3,3,0,3" Grid.ColumnSpan="3">
<Label Grid.Column="0" Grid.Row="9" VerticalAlignment="Center" Content="Ressourcen"/>
<Grid Grid.Column="1" Grid.Row="9" Height="23" Margin="3,3,0,3" Grid.ColumnSpan="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
@@ -292,16 +304,16 @@
<TextBox IsReadOnly="True" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding CountSelectedResources, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
<ToggleButton Grid.Column="1" x:Name="RessourcenToggleButton" IsThreeState="False" Margin="0,0,2,0" Height="19" Width="19" ToolTip="Ausgewählte Ressourcen anzeigen" Style="{StaticResource ExpanderLookAlikeToggleBotton}"/>
</Grid>
<Button x:Name="RessourcenPopUpOeffnenBtn" Grid.Column="4" Grid.Row="8" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="ResourcePopUpClick">
<Button x:Name="RessourcenPopUpOeffnenBtn" Grid.Column="4" Grid.Row="9" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="ResourcePopUpClick">
<Grid Width="18" HorizontalAlignment="Center" VerticalAlignment="Center">
<Line X1="4" X2="12" Y1="8" Y2="8" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
<Line X1="8" X2="8" Y1="4" Y2="12" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
</Grid>
</Button>
<Popup Grid.Column="1" Grid.Row="8" Margin="10" Name="PopupResource" StaysOpen="False" Placement="MousePoint" Width="370" Height="300">
<Popup Grid.Column="1" Grid.Row="9" Margin="10" Name="PopupResource" StaysOpen="False" Placement="MousePoint" Width="370" Height="300">
<search:ResourcesTreeSearchView x:Name="ResourcesTreeSearchView" ResultListBackground="{StaticResource ResourceContentBrush}" SelectionChanged="ResourcesTreeSearchView_OnSelectionChanged" SelectedResources="{Binding Controller.ResourceList}" />
</Popup>
<ListBox Grid.Column="1" Grid.Row="9" Background="{StaticResource ObjectEditBackgroundBrush}" Margin="4,0,1,4" ItemsSource="{Binding Path=SelectedResources}" IsSynchronizedWithCurrentItem="True"
<ListBox Grid.Column="1" Grid.Row="10" Background="{StaticResource ObjectEditBackgroundBrush}" Margin="4,0,1,4" ItemsSource="{Binding Path=SelectedResources}" IsSynchronizedWithCurrentItem="True"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.ColumnSpan="3"
ItemContainerStyle="{StaticResource MultiResourceSelectionControlStyle}" MaxHeight="70" Height="70"
Visibility="{Binding IsChecked, ElementName=RessourcenToggleButton, Converter={StaticResource BoolVisibilityConverter}}">
@@ -316,18 +328,66 @@
</ListBox.Template>
</ListBox>
<!-- Endregion -->
<!-- Region Notiz -->
<Label Grid.Column="0" Grid.Row="10" VerticalAlignment="Top" Content="Notiz"/>
<TextBox Grid.Column="1" Grid.Row="10" Grid.ColumnSpan="4" AcceptsReturn="True" VerticalScrollBarVisibility="Auto"
<!-- Region Hilfepläne -->
<Label Grid.Column="0" Grid.Row="11" VerticalAlignment="Center" Content="Hilfepläne" />
<Grid Grid.Column="1" Grid.Row="11" Height="23" Margin="3,3,0,3" Grid.ColumnSpan="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox IsReadOnly="True" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding CountSelectedSupportConcepts, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
<ToggleButton Grid.Column="1" x:Name="SupportConceptsToggleButton" IsThreeState="False" Margin="0,0,2,0" Height="19" Width="19" ToolTip="Ausgewählte Hilfepläne anzeigen" Style="{StaticResource ExpanderLookAlikeToggleBotton}"/>
</Grid>
<Button x:Name="SupportConceptsPopUpOeffnenBtn" Grid.Column="4" Grid.Row="11" Width="20" Height="20" Margin="3,0,3,0" VerticalAlignment="Center" Click="SupportConceptsPopUpClick">
<Grid Width="18" HorizontalAlignment="Center" VerticalAlignment="Center">
<Line X1="4" X2="12" Y1="8" Y2="8" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
<Line X1="8" X2="8" Y1="4" Y2="12" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
</Grid>
</Button>
<Popup Grid.Column="1" Grid.Row="11" Margin="10" Name="PopupSupportConcepts" StaysOpen="False" Placement="MousePoint" Width="370" Height="300">
<controls:SingleSupportConceptSelectionControl x:Name="SupportConceptsTreeSearchView" ItemSelected="SupportConceptSelectionControl_ItemSelected" />
</Popup>
<ListBox Grid.Column="1" Grid.Row="12" Background="{StaticResource ObjectEditBackgroundBrush}" Margin="4,0,1,4" ItemsSource="{Binding Path=SelectedSupportConcepts}" IsSynchronizedWithCurrentItem="True"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" Grid.ColumnSpan="3"
ItemContainerStyle="{StaticResource MultiElementSelectionControlStyle}" MaxHeight="70" Height="70"
Visibility="{Binding IsChecked, ElementName=SupportConceptsToggleButton, Converter={StaticResource BoolVisibilityConverter}}">
<ListBox.Template>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border x:Name="Bd" SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
<ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}" HorizontalScrollBarVisibility="Disabled">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
</Border>
</ControlTemplate>
</ListBox.Template>
</ListBox>
<!-- Endregion -->
<!-- Region Beschreibung -->
<Label x:Name="TaskDescriptionLabel" Visibility="Collapsed" Grid.Column="0" Grid.Row="13" VerticalAlignment="Top" Content="Beschreibung"/>
<TextBox Visibility="Collapsed" Grid.Column="1" Grid.Row="13" Grid.ColumnSpan="4" AcceptsReturn="True" VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled" Height="45" Margin="3" TextWrapping="Wrap" x:Name="TaskDescription"
Text="{Binding Path=Controller.TaskDescription, UpdateSourceTrigger=PropertyChanged}" MaxLength="1024" />
<!-- Endregion -->
<!-- Region Erledigt am -->
<Label Visibility="Collapsed" x:Name="CompletedDateLabel" Grid.Column="0" Grid.Row="14" VerticalAlignment="Center" Content="Erledigt am" />
<dxe:DateEdit Visibility="Collapsed" x:Name="CompletedDate" Grid.Column="1" Grid.ColumnSpan="4" Grid.Row="14" MaskType="DateTimeAdvancingCaret" Background="White" Height="23" MinWidth="80" Margin="3" EditValue="{Binding Controller.DisplayCompletedDateDate}" />
<!-- Endregion -->
<!-- Region Notiz -->
<Label x:Name="NoticeLabel" Grid.Column="0" Grid.Row="15" VerticalAlignment="Top" Content="Notiz"/>
<TextBox Grid.Column="1" Grid.Row="15" Grid.ColumnSpan="4" AcceptsReturn="True" VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled" Height="45" Margin="3" TextWrapping="Wrap" x:Name="Notice"
Text="{Binding Path=Controller.Description, UpdateSourceTrigger=PropertyChanged}" MaxLength="1024" />
<!-- Endregion -->
<!-- Region Serienmuster -->
<Label Grid.Column="0" Grid.Row="11" Content="Wiederholung" Margin="3" />
<dxe:ComboBoxEdit Grid.Column="1" Grid.Row="11" Grid.ColumnSpan="4" x:Name="EdtRecurrenceType" Margin="3"
<Label x:Name="SerienLabel" Grid.Column="0" Grid.Row="16" Content="Wiederholung" Margin="3" />
<dxe:ComboBoxEdit Grid.Column="1" Grid.Row="16" Grid.ColumnSpan="4" x:Name="EdtRecurrenceType" Margin="3"
ItemsSource="{Binding RecurrenceVisualController.RecurrenceElements}"
EditValue="{Binding RecurrenceVisualController.RecurrenceElement, UpdateSourceTrigger=PropertyChanged}" IsTextEditable="False">
<dxe:ComboBoxEdit.ItemTemplate>
@@ -336,9 +396,9 @@
</DataTemplate>
</dxe:ComboBoxEdit.ItemTemplate>
</dxe:ComboBoxEdit>
<Grid Grid.Column="0" Grid.Row="12" Grid.ColumnSpan="5" Visibility="{Binding RecurrenceVisualController.EnableRecurrence, Converter={StaticResource BoolVisibilityConverter}}" >
<StackPanel >
<Grid x:Name="SerienGrid" Grid.Column="0" Grid.Row="17" Grid.ColumnSpan="5" Visibility="{Binding RecurrenceVisualController.EnableRecurrence, Converter={StaticResource BoolVisibilityConverter}}" >
<StackPanel>
<dx:GroupFrame Header="Serienmuster" Margin="3">
<StackPanel>
<dxsch:DailyRecurrenceControl Visibility="{Binding RecurrenceVisualController.IsDailyRecurrence, Converter={dxschint:BoolToVisibilityConverter}}"
@@ -363,11 +423,11 @@
<!-- Endregion -->
<!-- Region Privater Termin -->
<CheckBox Grid.Column="0" Grid.Row="13" Margin="3" Content="Privater Termin" IsChecked="{Binding Controller.IsPrivate}" />
<CheckBox x:Name="IsPrivateCheckBox" Grid.Column="0" Grid.Row="18" Margin="3" Content="Privater Termin" IsChecked="{Binding Controller.IsPrivate}" />
<!-- Endregion -->
<!-- Region Buttons -->
<UniformGrid Grid.Column="0" Grid.Row="14" Grid.ColumnSpan="5" Columns="3" Rows="1" HorizontalAlignment="Right">
<UniformGrid Grid.Column="0" Grid.Row="19" Grid.ColumnSpan="5" Columns="3" Rows="1" HorizontalAlignment="Right">
<Button Margin="3" Click="OkButtonClick" x:Name="OkButton" Content="OK" Height="25" Width="80" />
<Button Margin="3" Click="CancelButtonClick" Content="Abbrechen" Height="25" Width="80" />
<!--<Button Margin="3" Click="button_CreatZeiterfassung_Click" x:Name="ZeiterfassButton" Content="Zeiterfassung" Height="25" Width="80" />-->

View File

@@ -15,6 +15,7 @@ using BeWo.ServiceProxy;
using BeWo.View.Search;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
@@ -30,6 +31,8 @@ namespace BeWo.Scheduler.View
{
public bool IsInCustomerViewMode { get; set; }
private readonly bool IsInTaskViewMode;
private List<ValueListEntryDC> _Categories;
public List<ValueListEntryDC> Categories
{
@@ -102,10 +105,19 @@ namespace BeWo.Scheduler.View
}
}
public SchedulerAppointmentEditForm(SchedulerAppointmentListVM vm, SchedulerControl schedulerControl, Appointment appointment, IEnumerable<CompactEmployeeDC> employees, IEnumerable<CompactCustomerDC> customers, Dictionary<ValueListEntryDC, List<ResourceDC>> categoriesToResources) : base(schedulerControl, appointment)
private ObservableCollection<CompactSupportConceptDC> _SelectedSupportConcepts;
public ObservableCollection<CompactSupportConceptDC> SelectedSupportConcepts
{
get => _SelectedSupportConcepts ?? (_SelectedSupportConcepts = new ObservableCollection<CompactSupportConceptDC>(NewSchedulerAppointmentFormController.SupportConceptList ?? new List<CompactSupportConceptDC>()));
}
public SchedulerAppointmentEditForm(SchedulerAppointmentListVM vm, SchedulerControl schedulerControl, Appointment appointment, IEnumerable<CompactEmployeeDC> employees, IEnumerable<CompactCustomerDC> customers, Dictionary<ValueListEntryDC, List<ResourceDC>> categoriesToResources, bool pIsInTaskViewMode) : base(schedulerControl, appointment)
{
ViewModel = vm;
IsInTaskViewMode = pIsInTaskViewMode;
InitializeComponent();
EdtRecurrenceType.Visibility = ShouldShowRecurrence ? Visibility.Visible : Visibility.Collapsed;
@@ -184,7 +196,43 @@ namespace BeWo.Scheduler.View
}
}
if(allowedToChange)
if(IsInTaskViewMode)
{
BetreffLabel.Content = "Titel";
StartDate.Visibility = Visibility.Collapsed;
StartTime.Visibility = Visibility.Collapsed;
StartLabel.Visibility = Visibility.Collapsed;
EndDate.Visibility = Visibility.Collapsed;
EndTime.Visibility = Visibility.Collapsed;
EndLabel.Visibility = Visibility.Collapsed;
AllDay.Visibility = Visibility.Collapsed;
OrtLabel.Visibility = Visibility.Collapsed;
Ort.Visibility = Visibility.Collapsed;
SerienLabel.Visibility = Visibility.Collapsed;
EdtRecurrenceType.Visibility = Visibility.Collapsed;
SerienGrid.Visibility = Visibility.Collapsed;
IsPrivateCheckBox.Visibility = Visibility.Collapsed;
NoticeLabel.Visibility = Visibility.Collapsed;
Notice.Visibility = Visibility.Collapsed;
DueDateLabel.Visibility = Visibility.Visible;
DueDate.Visibility = Visibility.Visible;
DueDateTime.Visibility = Visibility.Visible;
TaskDescriptionLabel.Visibility = Visibility.Visible;
TaskDescription.Visibility = Visibility.Visible;
if (!Controller.IsNewAppointment)
{
NoticeLabel.Visibility = Visibility.Visible;
Notice.Visibility = Visibility.Visible;
CompletedDateLabel.Visibility = Visibility.Visible;
CompletedDate.Visibility = Visibility.Visible;
}
}
if(allowedToChange)
{
return;
}
@@ -204,6 +252,7 @@ namespace BeWo.Scheduler.View
public string CountSelectedEmployees => $"{SelectedEmployees.Count} Mitarbeiter ausgewählt";
public string CountSelectedResources => $"{SelectedResources.Count} Resourcen ausgewählt";
public string CountSelectedCustomers => $"{SelectedCustomers.Count} Klienten ausgewählt";
public string CountSelectedSupportConcepts => $"{SelectedSupportConcepts.Count} Hilfepläne ausgewählt";
public override AppointmentFormController CreateFormController(SchedulerControl schedulerControl, Appointment appointment)
{
@@ -254,101 +303,116 @@ namespace BeWo.Scheduler.View
private void OkButtonClick(object sender, RoutedEventArgs e)
{
try
{
var isWeeklyRecurrence = RecurrenceVisualController.IsWeeklyRecurrence;
var weekDays = WeeklyRecurrenceControl.WeekDays;
try
{
var isWeeklyRecurrence = RecurrenceVisualController.IsWeeklyRecurrence;
var weekDays = WeeklyRecurrenceControl.WeekDays;
if(isWeeklyRecurrence && weekDays == 0)
{
MessageBox.Show("Bei einem sich wöchentlich wiederholenden Termin muss mindestens ein Wochentag ausgewählt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
Controller.Storage.BeginUpdate();
if (isWeeklyRecurrence && weekDays == 0)
{
MessageBox.Show("Bei einem sich wöchentlich wiederholenden Termin muss mindestens ein Wochentag ausgewählt sein!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Warning);
ViewModel.NewVM.EmployeeList = NewSchedulerAppointmentFormController.EmployeeList;
return;
}
var employees = NewSchedulerAppointmentFormController.EmployeeList;
var customers = NewSchedulerAppointmentFormController.CustomerList;
var resources = NewSchedulerAppointmentFormController.ResourceList;
var originator = NewSchedulerAppointmentFormController.Originator;
var isPrivate = NewSchedulerAppointmentFormController.IsPrivate;
ViewModel.NewVM.AllDay = !Appointment.AllDay;
ViewModel.NewVM.IsPrivate = isPrivate;
ViewModel.NewVM.ResourceList = resources;
ViewModel.NewVM.CustomerList = customers;
ViewModel.NewVM.Originator = originator;
Controller.Storage.BeginUpdate();
NewSchedulerView.IgnoreChangeEvents = true;
Appointment.CustomFields["IsPrivate"] = isPrivate;
Appointment.CustomFields["ResourceList"] = resources;
Appointment.CustomFields["CustomerList"] = customers;
Appointment.CustomFields["Originator"] = originator;
Appointment.CustomFields["EmployeeList"] = employees;
NewSchedulerView.IgnoreChangeEvents = false;
var employees = NewSchedulerAppointmentFormController.EmployeeList;
var customers = NewSchedulerAppointmentFormController.CustomerList;
var resources = NewSchedulerAppointmentFormController.ResourceList;
var originator = NewSchedulerAppointmentFormController.Originator;
var isPrivate = NewSchedulerAppointmentFormController.IsPrivate;
var isTask = NewSchedulerAppointmentFormController.IsTask;
var taskDescription = NewSchedulerAppointmentFormController.TaskDescription;
var dueDate = NewSchedulerAppointmentFormController.DueDate;
var completedDate = NewSchedulerAppointmentFormController.CompletedDate;
var completedNotice = Appointment.Description;
// Änderung an den CustomFields lösen das NewSchedulerStorage_AppointmentsChanged-Event aus
ViewModel.NewVM.AllDay = !Appointment.AllDay;
ViewModel.NewVM.IsPrivate = isPrivate;
ViewModel.NewVM.ResourceList = resources;
ViewModel.NewVM.CustomerList = customers;
ViewModel.NewVM.EmployeeList = employees;
ViewModel.NewVM.Originator = originator;
ViewModel.NewVM.IsTask = isTask;
ViewModel.NewVM.TaskDescription = taskDescription;
ViewModel.NewVM.DueDate = dueDate;
ViewModel.NewVM.CompletedDate = completedDate;
ViewModel.NewVM.CompletedNotice = completedNotice;
var employeeOids = new List<long>();
var customerOids = new List<long>();
var overlaps = false;
NewSchedulerView.IgnoreChangeEvents = true;
Appointment.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)] = isPrivate;
Appointment.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)] = resources;
Appointment.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)] = customers;
Appointment.CustomFields[nameof(SchedulerAppointmentVM.Originator)] = originator;
Appointment.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)] = employees;
Appointment.CustomFields[nameof(SchedulerAppointmentVM.IsTask)] = isTask;
Appointment.CustomFields[nameof(SchedulerAppointmentVM.TaskDescription)] = taskDescription;
Appointment.CustomFields[nameof(SchedulerAppointmentVM.DueDate)] = dueDate;
Appointment.CustomFields[nameof(SchedulerAppointmentVM.CompletedDate)] = completedDate;
Appointment.CustomFields[nameof(SchedulerAppointmentVM.CompletedNotice)] = completedNotice;
NewSchedulerView.IgnoreChangeEvents = false;
foreach (var emp in employees)
{
employeeOids.AddIfNotIn(emp.Employee.EmployeeOid);
}
// Änderung an den CustomFields lösen das NewSchedulerStorage_AppointmentsChanged-Event aus
foreach (var customer in customers)
{
customerOids.AddIfNotIn(customer.CustomerOid);
}
var employeeOids = new List<long>();
var customerOids = new List<long>();
var overlaps = false;
var item = (SchedulerAppointmentVM) Appointment.GetSourceObject(Control.GetCoreStorage());
foreach (var emp in employees)
{
employeeOids.AddIfNotIn(emp.Employee.EmployeeOid);
}
ServiceFacade.DoResourceServiceSync(definedBelow => overlaps = definedBelow.OverlappingAppointmentsExist(Appointment.Start, Appointment.End, employeeOids, customerOids, resources.Select(res => res.ResourceOid.Value).ToList(), ViewModel.NewVM.Originator.EmployeeOid, item?.CommitToDataContract().SchedulerAppointmentOid, string.Empty, Appointment.RecurrenceIndex));
foreach (var customer in customers)
{
customerOids.AddIfNotIn(customer.CustomerOid);
}
if(overlaps)
{
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 item = (SchedulerAppointmentVM) Appointment.GetSourceObject(Control.GetCoreStorage());
if(erg.Equals(MessageBoxResult.No))
{
return;
}
}
ServiceFacade.DoResourceServiceSync(definedBelow => overlaps = definedBelow.OverlappingAppointmentsExist(Appointment.Start, Appointment.End, employeeOids, customerOids, resources.Select(res => res.ResourceOid.Value).ToList(), ViewModel.NewVM.Originator.EmployeeOid, item?.CommitToDataContract().SchedulerAppointmentOid, string.Empty, Appointment.RecurrenceIndex));
ViewModel.ShouldLockOverlappingAppointmentCheck = true;
if (overlaps)
{
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);
if(Appointment.RecurrenceInfo != null)
{
ViewModel.ApplyChangesToChangedOccurencyCustomFields(employees, customers, resources, originator, isPrivate, Appointment.RecurrenceIndex.ToString(), new Guid(Appointment.RecurrenceInfo.Id.ToString()));
}
if (erg.Equals(MessageBoxResult.No))
{
return;
}
}
if(Appointment.IsOccurrence && item == null)
{
((List<Employee2SchedulerAppointmentDC>)Appointment.CustomFields["EmployeeList"]).ForEach(each =>
{
each.Employee2SchedulerAppointmentOid = null;
each.Employee2SchedulerAppointmentVersion = null;
each.SchedulerAppointmentOid = null;
each.IsPChanged = false;
each.IsPC_CheckedTs = null;
});
}
ViewModel.ShouldLockOverlappingAppointmentCheck = true;
ApplyChanges();
if (Appointment.RecurrenceInfo != null)
{
ViewModel.ApplyChangesToChangedOccurencyCustomFields(employees, customers, resources, originator, isPrivate, Appointment.RecurrenceIndex.ToString(), new Guid(Appointment.RecurrenceInfo.Id.ToString()), isTask, taskDescription, completedDate, dueDate, completedNotice);
}
Controller.Storage.EndUpdate();
if (Appointment.IsOccurrence && item == null)
{
((List<Employee2SchedulerAppointmentDC>) Appointment.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)]).ForEach(each =>
{
each.Employee2SchedulerAppointmentOid = null;
each.Employee2SchedulerAppointmentVersion = null;
each.SchedulerAppointmentOid = null;
each.IsPChanged = false;
each.IsPC_CheckedTs = null;
});
}
ViewModel.ShouldLockOverlappingAppointmentCheck = false;
}
catch (Exception exception)
{
MessageBox.Show(exception.Message + "\n" + exception.StackTrace);
}
ApplyChanges();
}
catch (Exception exception)
{
MessageBox.Show(exception.Message + "\n" + exception.StackTrace);
}
finally
{
Controller.Storage.EndUpdate();
ViewModel.ShouldLockOverlappingAppointmentCheck = false;
}
}
private void CancelButtonClick(object sender, RoutedEventArgs e)
@@ -456,74 +520,212 @@ namespace BeWo.Scheduler.View
OnPropertyChanged(nameof(CountSelectedCustomers));
}
}
private void SupportConceptsPopUpClick(object sender, RoutedEventArgs e)
{
PopupSupportConcepts.IsOpen = true;
}
private void SupportConceptSelectionControl_ItemSelected(object sender, EventArgs<FlatSupportConceptTreeNodeDC> e)
{
}
}
public class NewSchedulerAppointmentFormController : AppointmentFormController
{
private List<ResourceDC> SourceResourceList
{
get => (List<ResourceDC>)SourceAppointment.CustomFields["ResourceList"];
set => SourceAppointment.CustomFields["ResourceList"] = value;
get => (List<ResourceDC>)SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)];
set => SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)] = value;
}
public List<ResourceDC> ResourceList
{
get => (List<ResourceDC>)EditedAppointmentCopy.CustomFields["ResourceList"];
set => EditedAppointmentCopy.CustomFields["ResourceList"] = value;
get => (List<ResourceDC>)EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)];
set => EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)] = value;
}
private List<Employee2SchedulerAppointmentDC> SourceEmployeeList
{
get => (List<Employee2SchedulerAppointmentDC>)SourceAppointment.CustomFields["EmployeeList"];
set => SourceAppointment.CustomFields["EmployeeList"] = value;
get => (List<Employee2SchedulerAppointmentDC>)SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)];
set => SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)] = value;
}
public List<Employee2SchedulerAppointmentDC> EmployeeList
{
get => (List<Employee2SchedulerAppointmentDC>)EditedAppointmentCopy.CustomFields["EmployeeList"];
set => EditedAppointmentCopy.CustomFields["EmployeeList"] = value;
get => (List<Employee2SchedulerAppointmentDC>)EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)];
set => EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)] = value;
}
private List<CompactCustomerDC> SourceCustomerList
{
get => (List<CompactCustomerDC>)SourceAppointment.CustomFields["CustomerList"];
set => SourceAppointment.CustomFields["CustomerList"] = value;
get => (List<CompactCustomerDC>)SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)];
set => SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)] = value;
}
public List<CompactCustomerDC> CustomerList
{
get => (List<CompactCustomerDC>)EditedAppointmentCopy.CustomFields["CustomerList"];
set => EditedAppointmentCopy.CustomFields["CustomerList"] = value;
get => (List<CompactCustomerDC>)EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)];
set => EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)] = value;
}
private CompactEmployeeDC SourceOriginator
private List<CompactSupportConceptDC> SourceSupportConceptList
{
get => (List<CompactSupportConceptDC>)SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.SupportConceptList)];
set => SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.SupportConceptList)] = value;
}
public List<CompactSupportConceptDC> SupportConceptList
{
get => (List<CompactSupportConceptDC>)EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.SupportConceptList)];
set => EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.SupportConceptList)] = value;
}
private CompactEmployeeDC SourceOriginator
{
get => (CompactEmployeeDC)SourceAppointment.CustomFields["Originator"];
set => SourceAppointment.CustomFields["Originator"] = value;
get => (CompactEmployeeDC)SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.Originator)];
set => SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.Originator)] = value;
}
public CompactEmployeeDC Originator
{
get => (CompactEmployeeDC)EditedAppointmentCopy.CustomFields["Originator"];
set => EditedAppointmentCopy.CustomFields["Originator"] = value;
get => (CompactEmployeeDC)EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.Originator)];
set => EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.Originator)] = value;
}
private bool SourceIsPrivate
{
get => (bool)SourceAppointment.CustomFields["IsPrivate"];
set => SourceAppointment.CustomFields["IsPrivate"] = value;
get => (bool)SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)];
set => SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)] = value;
}
public bool IsPrivate
{
get => (bool)EditedAppointmentCopy.CustomFields["IsPrivate"];
set => EditedAppointmentCopy.CustomFields["IsPrivate"] = value;
get => (bool)EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)];
set => EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)] = value;
}
public override bool IsAppointmentChanged()
private DateTime? SourceDueDate
{
get => (DateTime?) SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.DueDate)];
set => SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.DueDate)] = value;
}
public DateTime? DueDate
{
get => (DateTime?) EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.DueDate)];
set => EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.DueDate)] = value;
}
public DateTime? DisplayDueDateDate
{
get => DueDate?.Date;
set
{
if (value == null)
{
return;
}
var newEnd = new DateTime(value.Value.Year, value.Value.Month, value.Value.Day);
EditedAppointmentCopy.Start = newEnd.AddDays(-1);
EditedAppointmentCopy.End = newEnd;
if (DueDate == null)
{
DueDate = value;
return;
}
DueDate = new DateTime(value.Value.Year, value.Value.Month, value.Value.Day, DueDate.Value.Hour, DueDate.Value.Minute, DueDate.Value.Second);
}
}
public TimeSpan? DisplayDueDateTime
{
get => DueDate?.TimeOfDay;
set
{
if (DueDate != null && value.HasValue)
{
DueDate = DueDate.Value.Date + value.Value;
}
}
}
private DateTime? SourceCompletedDate
{
get => (DateTime?) SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.CompletedDate)];
set => SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.CompletedDate)] = value;
}
public DateTime? CompletedDate
{
get => (DateTime?) EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.CompletedDate)];
set => EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.CompletedDate)] = value;
}
public DateTime? DisplayCompletedDateDate
{
get => CompletedDate?.Date;
set
{
if (CompletedDate == null)
{
CompletedDate = value;
return;
}
if (value != null)
{
CompletedDate = new DateTime(value.Value.Year, value.Value.Month, value.Value.Day, CompletedDate.Value.Hour, CompletedDate.Value.Minute, CompletedDate.Value.Second);
}
}
}
public TimeSpan? DisplayCompletedDateTime
{
get => CompletedDate?.TimeOfDay;
set
{
if (CompletedDate != null && value.HasValue)
{
CompletedDate = CompletedDate.Value.Date + value.Value;
}
}
}
private bool SourceIsTask
{
get => (bool)SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.IsTask)];
set => SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.IsTask)] = value;
}
public bool IsTask
{
get => (bool)EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.IsTask)];
set => EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.IsTask)] = value;
}
private string SourceTaskDescription
{
get => (string) SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.TaskDescription)];
set => SourceAppointment.CustomFields[nameof(SchedulerAppointmentVM.TaskDescription)] = value;
}
public string TaskDescription
{
get => (string) EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.TaskDescription)];
set => EditedAppointmentCopy.CustomFields[nameof(SchedulerAppointmentVM.TaskDescription)] = value;
}
public override bool IsAppointmentChanged()
{
if(base.IsAppointmentChanged())
{
return true;
}
if(SourceResourceList != null && ResourceList != null ||
SourceEmployeeList != null && EmployeeList != null ||
if (SourceResourceList != null && ResourceList != null ||
SourceEmployeeList != null && EmployeeList != null ||
SourceCustomerList != null && CustomerList != null ||
SourceOriginator != null && Originator != null)
{
@@ -535,19 +737,26 @@ namespace BeWo.Scheduler.View
var customerListsAreEqual = SourceCustomerList == null || CustomerList == null || !Equals(SourceCustomerList, CustomerList);
var originatorsAreEqual = SourceOriginator == null || Originator == null || !Equals(SourceOriginator, Originator);
var isPrivatesAreEqual = !Equals(SourceIsPrivate, IsPrivate);
var dueDatesAreEqal = Equals(SourceDueDate, DueDate);
var completedDatesAreEqal = Equals(SourceCompletedDate, CompletedDate);
var taskDescriptionsAreEqual = Equals(SourceTaskDescription, TaskDescription);
return resourceListsAreEqual || employeeListsAreEqual || customerListsAreEqual || originatorsAreEqual || isPrivatesAreEqual;
return resourceListsAreEqual || employeeListsAreEqual || customerListsAreEqual || originatorsAreEqual || isPrivatesAreEqual || dueDatesAreEqal || completedDatesAreEqal || taskDescriptionsAreEqual;
}
public NewSchedulerAppointmentFormController(SchedulerControl control, Appointment apt) : base(control, apt) { }
protected override void ApplyCustomFieldsValues()
{
SourceResourceList = ResourceList;
SourceEmployeeList = EmployeeList;
SourceCustomerList = CustomerList;
SourceOriginator = Originator;
SourceIsPrivate = IsPrivate;
SourceResourceList = ResourceList;
SourceEmployeeList = EmployeeList;
SourceCustomerList = CustomerList;
SourceOriginator = Originator;
SourceIsPrivate = IsPrivate;
SourceDueDate = DueDate;
SourceCompletedDate = CompletedDate;
SourceTaskDescription = TaskDescription;
SourceSupportConceptList = SupportConceptList;
}
}
}

View File

@@ -44,6 +44,11 @@ namespace BeWo.Scheduler.ViewModel
ActiveAppointmentViewModel?.InitNewAppointment(appointment);
}
internal void InitNewTask(Appointment pAppointment, DateTime? pDueDate, IEnumerable<Employee2SchedulerAppointmentDC> pSelectedEmployees, IEnumerable<CompactCustomerDC> pSelectedCustomers, IEnumerable<ResourceDC> pSelectedResources)
{
ActiveAppointmentViewModel?.InitNewTask(pAppointment, pDueDate, pSelectedEmployees, pSelectedCustomers, pSelectedResources);
}
public SchedulerSettings SchedulerSettings { get; set; }
public SchedulerSettings GetActiveSettings()

View File

@@ -26,13 +26,6 @@ namespace BeWo.Scheduler.ViewModel
{
public class SchedulerAppointmentListVM : AbstractDCListMapperVM<SchedulerAppointmentDC, SchedulerAppointmentVM>, ISchedulerViewModel
{
public const string CustomField_EmployeeList = "EmployeeList";
public const string CustomField_CustomerList = "CustomerList";
public const string CustomField_ResourceList = "ResourceList";
public const string CustomField_Originator = "Originator";
public const string CustomField_IsPrivate = "IsPrivate";
public const string CustomField_IsAbsenceTime = "IsAbsenceTime";
public bool ShouldLockOverlappingAppointmentCheck { get; set; }
public SchedulerSettings GetDefaultSchedulerSettings()
@@ -82,8 +75,8 @@ namespace BeWo.Scheduler.ViewModel
e.NewObject = neu;
}
private Dictionary<Guid, Dictionary<string, Dictionary<string, object>>> _ChangedOccurencyCustomFields;
public Dictionary<Guid, Dictionary<string, Dictionary<string, object>>> ChangedOccurencyCustomFields { get; }
private Dictionary<Guid, Dictionary<string, Dictionary<string, object>>> _ChangedOccurenceCustomFields;
public Dictionary<Guid, Dictionary<string, Dictionary<string, object>>> ChangedOccurenceCustomFields { get; }
public List<CompactCustomerDC> AllCustomers => _AllCustomers;
@@ -108,12 +101,17 @@ namespace BeWo.Scheduler.ViewModel
{
foreach (var item in VMList)
{
item.CustomFields.Add(CustomField_EmployeeList, item.EmployeeList);
item.CustomFields.Add(CustomField_CustomerList, item.CustomerList);
item.CustomFields.Add(CustomField_ResourceList, item.ResourceList);
item.CustomFields.Add(CustomField_Originator, item.Originator);
item.CustomFields.Add(CustomField_IsPrivate, item.IsPrivate);
item.CustomFields.Add(CustomField_IsAbsenceTime, item.IsAbsenceTime);
item.CustomFields.Add(nameof(SchedulerAppointmentVM.EmployeeList), item.EmployeeList);
item.CustomFields.Add(nameof(SchedulerAppointmentVM.CustomerList), item.CustomerList);
item.CustomFields.Add(nameof(SchedulerAppointmentVM.ResourceList), item.ResourceList);
item.CustomFields.Add(nameof(SchedulerAppointmentVM.Originator), item.Originator);
item.CustomFields.Add(nameof(SchedulerAppointmentVM.IsPrivate), item.IsPrivate);
item.CustomFields.Add(nameof(SchedulerAppointmentVM.IsAbsenceTime), item.IsAbsenceTime);
item.CustomFields.Add(nameof(SchedulerAppointmentVM.IsTask), item.IsTask);
item.CustomFields.Add(nameof(SchedulerAppointmentVM.DueDate), item.DueDate);
item.CustomFields.Add(nameof(SchedulerAppointmentVM.TaskDescription), item.TaskDescription);
item.CustomFields.Add(nameof(SchedulerAppointmentVM.CompletedDate), item.CompletedDate);
item.CustomFields.Add(nameof(SchedulerAppointmentVM.CompletedNotice), item.CompletedNotice);
item.Id = item.DataContract.SchedulerAppointmentOid;
@@ -264,43 +262,73 @@ namespace BeWo.Scheduler.ViewModel
private void UpdateSchedulerAppointment(Appointment app, SchedulerAppointmentVM vm)
{
vm.EmployeeList = app.CustomFields[CustomField_EmployeeList] as List<Employee2SchedulerAppointmentDC> ?? new List<Employee2SchedulerAppointmentDC>();
vm.CustomerList = app.CustomFields[CustomField_CustomerList] as List<CompactCustomerDC>;
vm.ResourceList = app.CustomFields[CustomField_ResourceList] as List<ResourceDC>;
vm.Originator = app.CustomFields[CustomField_Originator] as CompactEmployeeDC;
vm.IsPrivate = app.CustomFields[CustomField_IsPrivate] != null && (bool) app.CustomFields[CustomField_IsPrivate];
vm.EmployeeList = app.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)] as List<Employee2SchedulerAppointmentDC> ?? new List<Employee2SchedulerAppointmentDC>();
vm.CustomerList = app.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)] as List<CompactCustomerDC>;
vm.ResourceList = app.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)] as List<ResourceDC>;
vm.Originator = app.CustomFields[nameof(SchedulerAppointmentVM.Originator)] as CompactEmployeeDC;
vm.IsPrivate = app.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)] != null && (bool) app.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)];
vm.IsTask = app.CustomFields[nameof(SchedulerAppointmentVM.IsTask)] != null && (bool) app.CustomFields[nameof(SchedulerAppointmentVM.IsTask)];
vm.DueDate = (DateTime?) app.CustomFields[nameof(SchedulerAppointmentVM.DueDate)];
vm.CompletedDate = (DateTime?)app.CustomFields[nameof(SchedulerAppointmentVM.CompletedDate)];
vm.CompletedNotice = app.CustomFields[nameof(SchedulerAppointmentVM.CompletedNotice)]?.ToString();
vm.TaskDescription = app.CustomFields[nameof(SchedulerAppointmentVM.TaskDescription)]?.ToString();
if (!vm.CustomFields.ContainsKey(CustomField_EmployeeList))
if (!vm.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.EmployeeList)))
{
vm.CustomFields.Add(CustomField_EmployeeList, vm.EmployeeList);
vm.CustomFields.Add(nameof(SchedulerAppointmentVM.EmployeeList), vm.EmployeeList);
}
if (!vm.CustomFields.ContainsKey(CustomField_CustomerList))
if (!vm.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.CustomerList)))
{
vm.CustomFields.Add(CustomField_CustomerList, vm.CustomerList);
vm.CustomFields.Add(nameof(SchedulerAppointmentVM.CustomerList), vm.CustomerList);
}
if (!vm.CustomFields.ContainsKey(CustomField_ResourceList))
if (!vm.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.ResourceList)))
{
vm.CustomFields.Add(CustomField_ResourceList, vm.ResourceList);
vm.CustomFields.Add(nameof(SchedulerAppointmentVM.ResourceList), vm.ResourceList);
}
if (!vm.CustomFields.ContainsKey(CustomField_Originator))
if (!vm.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.Originator)))
{
vm.CustomFields.Add(CustomField_Originator, vm.Originator);
vm.CustomFields.Add(nameof(SchedulerAppointmentVM.Originator), vm.Originator);
}
if (!vm.CustomFields.ContainsKey(CustomField_IsPrivate))
if (!vm.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.IsPrivate)))
{
vm.CustomFields.Add(CustomField_IsPrivate, vm.IsPrivate);
vm.CustomFields.Add(nameof(SchedulerAppointmentVM.IsPrivate), vm.IsPrivate);
}
if(!vm.CustomFields.ContainsKey(CustomField_IsAbsenceTime))
if(!vm.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.IsAbsenceTime)))
{
vm.CustomFields.Add(CustomField_IsAbsenceTime, vm.IsAbsenceTime);
vm.CustomFields.Add(nameof(SchedulerAppointmentVM.IsAbsenceTime), vm.IsAbsenceTime);
}
if (vm.CommitToDataContract() != null && vm.CommitToDataContract().SchedulerAppointmentOid.HasValue && vm.EmployeeList != null && vm.EmployeeList.Count > 0)
if (!vm.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.IsTask)))
{
vm.CustomFields.Add(nameof(SchedulerAppointmentVM.IsTask), vm.IsTask);
}
if(!vm.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.TaskDescription)))
{
vm.CustomFields.Add(nameof(SchedulerAppointmentVM.TaskDescription), vm.TaskDescription);
}
if(!vm.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.CompletedDate)))
{
vm.CustomFields.Add(nameof(SchedulerAppointmentVM.CompletedDate), vm.CompletedDate);
}
if(!vm.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.DueDate)))
{
vm.CustomFields.Add(nameof(SchedulerAppointmentVM.DueDate), vm.DueDate);
}
if(!vm.CustomFields.ContainsKey(nameof(SchedulerAppointmentVM.CompletedNotice)))
{
vm.CustomFields.Add(nameof(SchedulerAppointmentVM.CompletedNotice), vm.CompletedNotice);
}
if (vm.CommitToDataContract() != null && vm.CommitToDataContract().SchedulerAppointmentOid.HasValue && vm.EmployeeList != null && vm.EmployeeList.Count > 0)
{
var alt = new SchedulerAppointmentDC();
ServiceFacade.DoResourceServiceSync(s => alt = s.GetSchedulerAppointmentsById(new List<long> {vm.CommitToDataContract().SchedulerAppointmentOid.Value}).First());
@@ -327,16 +355,21 @@ namespace BeWo.Scheduler.ViewModel
var id = new Guid(app.RecurrenceInfo.Id.ToString());
if (_ChangedOccurencyCustomFields.ContainsKey(id) && _ChangedOccurencyCustomFields[id].ContainsKey(index))
if (_ChangedOccurenceCustomFields.ContainsKey(id) && _ChangedOccurenceCustomFields[id].ContainsKey(index))
{
if (app.Type.Equals(AppointmentType.ChangedOccurrence))
{
app.CustomFields[CustomField_EmployeeList] = _ChangedOccurencyCustomFields[id][index][CustomField_EmployeeList];
app.CustomFields[CustomField_CustomerList] = _ChangedOccurencyCustomFields[id][index][CustomField_CustomerList];
app.CustomFields[CustomField_ResourceList] = _ChangedOccurencyCustomFields[id][index][CustomField_ResourceList];
app.CustomFields[CustomField_Originator] = _ChangedOccurencyCustomFields[id][index][CustomField_Originator];
app.CustomFields[CustomField_IsPrivate] = _ChangedOccurencyCustomFields[id][index][CustomField_IsPrivate];
app.CustomFields[CustomField_IsAbsenceTime] = _ChangedOccurencyCustomFields[id][index][CustomField_IsAbsenceTime];
app.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)] = _ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.EmployeeList)];
app.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)] = _ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.CustomerList)];
app.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)] = _ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.ResourceList)];
app.CustomFields[nameof(SchedulerAppointmentVM.Originator)] = _ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.Originator)];
app.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)] = _ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.IsPrivate)];
app.CustomFields[nameof(SchedulerAppointmentVM.IsAbsenceTime)] = _ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.IsAbsenceTime)];
app.CustomFields[nameof(SchedulerAppointmentVM.IsTask)] = _ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.IsTask)];
app.CustomFields[nameof(SchedulerAppointmentVM.TaskDescription)] = _ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.TaskDescription)];
app.CustomFields[nameof(SchedulerAppointmentVM.CompletedDate)] = _ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.CompletedDate)];
app.CustomFields[nameof(SchedulerAppointmentVM.DueDate)] = _ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.DueDate)];
app.CustomFields[nameof(SchedulerAppointmentVM.CompletedNotice)] = _ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.CompletedNotice)];
}
}
}
@@ -357,51 +390,63 @@ namespace BeWo.Scheduler.ViewModel
_GeoeffneterTermin.CustomFields[cf.Name] = cf.Value;
}
if (!appointment.Type.Equals(AppointmentType.ChangedOccurrence))
var isTask = (bool?)_GeoeffneterTermin.CustomFields[nameof(SchedulerAppointmentVM.IsTask)] ?? false;
if (!appointment.Type.Equals(AppointmentType.ChangedOccurrence))
{
return new SchedulerAppointmentEditForm(this, control, appointment, _AllEmployees, _AllCustomers, _Categories2Resources);
return new SchedulerAppointmentEditForm(this, control, appointment, _AllEmployees, _AllCustomers, _Categories2Resources, isTask);
}
var index = appointment.RecurrenceIndex;
var id = new Guid(appointment.RecurrenceInfo.Id.ToString());
if (_ChangedOccurencyCustomFields.ContainsKey(id) && _ChangedOccurencyCustomFields[id].ContainsKey(index.ToString()))
if (_ChangedOccurenceCustomFields.ContainsKey(id) && _ChangedOccurenceCustomFields[id].ContainsKey(index.ToString()))
{
var specialCustomFields = _ChangedOccurencyCustomFields[id][index.ToString()];
var specialCustomFields = _ChangedOccurenceCustomFields[id][index.ToString()];
foreach (var cf in specialCustomFields)
{
appointment.CustomFields[cf.Key] = cf.Value;
appointment.CustomFields[cf.Key] = cf.Value;
_GeoeffneterTermin.CustomFields[cf.Key] = cf.Value;
}
}
return new SchedulerAppointmentEditForm(this, control, appointment, _AllEmployees, _AllCustomers, _Categories2Resources);
return new SchedulerAppointmentEditForm(this, control, appointment, _AllEmployees, _AllCustomers, _Categories2Resources, isTask);
}
public void ApplyChangesToChangedOccurencyCustomFields(List<Employee2SchedulerAppointmentDC> employees, List<CompactCustomerDC> customers, List<ResourceDC> resources, CompactEmployeeDC originator, bool isPrivate, string index, Guid id)
public void ApplyChangesToChangedOccurencyCustomFields(List<Employee2SchedulerAppointmentDC> employees, List<CompactCustomerDC> customers, List<ResourceDC> resources, CompactEmployeeDC originator, bool isPrivate, string index, Guid id, bool isTask, string taskDescription, DateTime? completedDate, DateTime? dueDate, string completedNotice)
{
if (!_ChangedOccurencyCustomFields.ContainsKey(id) || !_ChangedOccurencyCustomFields[id].ContainsKey(index))
if (!_ChangedOccurenceCustomFields.ContainsKey(id) || !_ChangedOccurenceCustomFields[id].ContainsKey(index))
{
return;
}
_ChangedOccurencyCustomFields[id][index][CustomField_EmployeeList] = employees;
_ChangedOccurencyCustomFields[id][index][CustomField_CustomerList] = customers;
_ChangedOccurencyCustomFields[id][index][CustomField_ResourceList] = resources;
_ChangedOccurencyCustomFields[id][index][CustomField_Originator] = originator;
_ChangedOccurencyCustomFields[id][index][CustomField_IsPrivate] = isPrivate;
_ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.EmployeeList)] = employees;
_ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.CustomerList)] = customers;
_ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.ResourceList)] = resources;
_ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.Originator)] = originator;
_ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.IsPrivate)] = isPrivate;
_ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.IsTask)] = isTask;
_ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.TaskDescription)] = taskDescription;
_ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.CompletedDate)] = completedDate;
_ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.DueDate)] = dueDate;
_ChangedOccurenceCustomFields[id][index][nameof(SchedulerAppointmentVM.CompletedNotice)] = completedNotice;
}
public void AddCustomFieldsMapping(SchedulerStorage schedulerStorage)
{
var employeeMapping = new SchedulerCustomFieldMapping(CustomField_EmployeeList, CustomField_EmployeeList);
var customerMapping = new SchedulerCustomFieldMapping(CustomField_CustomerList, CustomField_CustomerList);
var resourceMapping = new SchedulerCustomFieldMapping(CustomField_ResourceList, CustomField_ResourceList);
var originatorMapping = new SchedulerCustomFieldMapping(CustomField_Originator, CustomField_Originator);
var isPrivateMapping = new SchedulerCustomFieldMapping(CustomField_IsPrivate, CustomField_IsPrivate);
var isAbsenceTimeMapping = new SchedulerCustomFieldMapping(CustomField_IsAbsenceTime, CustomField_IsAbsenceTime);
var employeeMapping = new SchedulerCustomFieldMapping(nameof(SchedulerAppointmentVM.EmployeeList), nameof(SchedulerAppointmentVM.EmployeeList));
var customerMapping = new SchedulerCustomFieldMapping(nameof(SchedulerAppointmentVM.CustomerList), nameof(SchedulerAppointmentVM.CustomerList));
var resourceMapping = new SchedulerCustomFieldMapping(nameof(SchedulerAppointmentVM.ResourceList), nameof(SchedulerAppointmentVM.ResourceList));
var originatorMapping = new SchedulerCustomFieldMapping(nameof(SchedulerAppointmentVM.Originator), nameof(SchedulerAppointmentVM.Originator));
var isPrivateMapping = new SchedulerCustomFieldMapping(nameof(SchedulerAppointmentVM.IsPrivate), nameof(SchedulerAppointmentVM.IsPrivate));
var isAbsenceTimeMapping = new SchedulerCustomFieldMapping(nameof(SchedulerAppointmentVM.IsAbsenceTime), nameof(SchedulerAppointmentVM.IsAbsenceTime));
var isTaskMapping = new SchedulerCustomFieldMapping(nameof(SchedulerAppointmentVM.IsTask), nameof(SchedulerAppointmentVM.IsTask));
var completedDateMapping = new SchedulerCustomFieldMapping(nameof(SchedulerAppointmentVM.CompletedDate), nameof(SchedulerAppointmentVM.CompletedDate));
var completedNoticeMapping = new SchedulerCustomFieldMapping(nameof(SchedulerAppointmentVM.CompletedNotice), nameof(SchedulerAppointmentVM.CompletedNotice));
var dueDateMapping = new SchedulerCustomFieldMapping(nameof(SchedulerAppointmentVM.DueDate), nameof(SchedulerAppointmentVM.DueDate));
var taskDescriptionMapping = new SchedulerCustomFieldMapping(nameof(SchedulerAppointmentVM.TaskDescription), nameof(SchedulerAppointmentVM.TaskDescription));
schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(employeeMapping);
schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(customerMapping);
@@ -409,26 +454,53 @@ namespace BeWo.Scheduler.ViewModel
schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(originatorMapping);
schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(isPrivateMapping);
schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(isAbsenceTimeMapping);
schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(isTaskMapping);
schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(dueDateMapping);
schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(taskDescriptionMapping);
schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(completedDateMapping);
schedulerStorage.AppointmentStorage.CustomFieldMappings.Add(completedNoticeMapping);
}
public void InitNewAppointment(Appointment appointment)
{
appointment.CustomFields[CustomField_CustomerList] = new List<CompactCustomerDC>();
appointment.CustomFields[CustomField_EmployeeList] = new List<Employee2SchedulerAppointmentDC>();
appointment.CustomFields[CustomField_ResourceList] = new List<ResourceDC>();
ServiceFacade.DoEmployeeServiceSync(s => appointment.CustomFields[CustomField_Originator] = s.LoadCompactEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value));
appointment.CustomFields[CustomField_IsPrivate] = false;
appointment.CustomFields[CustomField_IsAbsenceTime] = false;
appointment.StatusId = 0;
appointment.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)] = new List<CompactCustomerDC>();
appointment.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)] = new List<Employee2SchedulerAppointmentDC>();
appointment.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)] = new List<ResourceDC>();
ServiceFacade.DoEmployeeServiceSync(s => appointment.CustomFields[nameof(SchedulerAppointmentVM.Originator)] = s.LoadCompactEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value));
appointment.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)] = false;
appointment.CustomFields[nameof(SchedulerAppointmentVM.IsAbsenceTime)] = false;
appointment.StatusId = 0;
appointment.CustomFields[nameof(SchedulerAppointmentVM.IsTask)] = false;
appointment.CustomFields[nameof(SchedulerAppointmentVM.CompletedDate)] = null;
appointment.CustomFields[nameof(SchedulerAppointmentVM.CompletedNotice)] = null;
appointment.CustomFields[nameof(SchedulerAppointmentVM.DueDate)] = null;
appointment.CustomFields[nameof(SchedulerAppointmentVM.TaskDescription)] = null;
}
public bool HideAppointment(string filterCategory, object selectedObject, Appointment appointment, bool showPrivateAppointments, bool showAbsenceTimes)
public void InitNewTask(Appointment pAppointment, DateTime? pDueDate, IEnumerable<Employee2SchedulerAppointmentDC> pSelectedEmployees, IEnumerable<CompactCustomerDC> pSelectedCustomers, IEnumerable<ResourceDC> pSelectedResources)
{
pAppointment.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)] = pSelectedCustomers ?? new List<CompactCustomerDC>();
pAppointment.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)] = pSelectedEmployees ?? new List<Employee2SchedulerAppointmentDC>();
pAppointment.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)] = pSelectedResources ?? new List<ResourceDC>();
pAppointment.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)] = false;
pAppointment.CustomFields[nameof(SchedulerAppointmentVM.IsAbsenceTime)] = false;
pAppointment.CustomFields[nameof(SchedulerAppointmentVM.IsTask)] = true;
pAppointment.CustomFields[nameof(SchedulerAppointmentVM.CompletedDate)] = null;
pAppointment.CustomFields[nameof(SchedulerAppointmentVM.DueDate)] = pDueDate;
pAppointment.CustomFields[nameof(SchedulerAppointmentVM.TaskDescription)] = string.Empty;
ServiceFacade.DoEmployeeServiceSync(s => pAppointment.CustomFields[nameof(SchedulerAppointmentVM.Originator)] = s.LoadCompactEmployee(BeWoApp.LoggedOnEmployee.EmployeeOid.Value));
pAppointment.StatusId = 0;
}
public bool HideAppointment(string filterCategory, object selectedObject, Appointment appointment, bool showPrivateAppointments, bool showAbsenceTimes, bool pShowTasks)
{
if (appointment.CustomFields[CustomField_CustomerList] == null ||
appointment.CustomFields[CustomField_EmployeeList] == null ||
appointment.CustomFields[CustomField_ResourceList] == null ||
appointment.CustomFields[CustomField_IsPrivate] == null ||
appointment.CustomFields[CustomField_IsAbsenceTime] == null)
if (appointment.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)] == null ||
appointment.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)] == null ||
appointment.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)] == null ||
appointment.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)] == null ||
appointment.CustomFields[nameof(SchedulerAppointmentVM.IsAbsenceTime)] == null)
{
return false;
}
@@ -436,17 +508,24 @@ namespace BeWo.Scheduler.ViewModel
var wirdAngezeigt = true; // -> wird standardmäßig angezeigt
var isPrivate = false;
if(appointment.CustomFields[CustomField_IsPrivate] != null)
if(appointment.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)] != null)
{
isPrivate = Convert.ToBoolean(appointment.CustomFields[CustomField_IsPrivate]);
isPrivate = Convert.ToBoolean(appointment.CustomFields[nameof(SchedulerAppointmentVM.IsPrivate)]);
}
var isAbsenceTime = false;
if(appointment.CustomFields[CustomField_IsAbsenceTime] != null)
if(appointment.CustomFields[nameof(SchedulerAppointmentVM.IsAbsenceTime)] != null)
{
isAbsenceTime = Convert.ToBoolean(appointment.CustomFields[CustomField_IsAbsenceTime]);
isAbsenceTime = Convert.ToBoolean(appointment.CustomFields[nameof(SchedulerAppointmentVM.IsAbsenceTime)]);
}
var isTask = false;
if (appointment.CustomFields[nameof(SchedulerAppointmentVM.IsTask)] != null)
{
isTask = Convert.ToBoolean(appointment.CustomFields[nameof(SchedulerAppointmentVM.IsTask)]);
}
// Ist Abwesenheit, es sollen keine privaten Termine angezeigt werden und es sollen keine Abwesenheiten angezeigt werden
if(isAbsenceTime && !showPrivateAppointments && !showAbsenceTimes)
{
return !showAbsenceTimes;
@@ -457,10 +536,15 @@ namespace BeWo.Scheduler.ViewModel
return true;
}
var ersteller = (CompactEmployeeDC)appointment.CustomFields[CustomField_Originator];
var employeeList = (List<Employee2SchedulerAppointmentDC>)appointment.CustomFields[CustomField_EmployeeList];
var customerList = (List<CompactCustomerDC>)appointment.CustomFields[CustomField_CustomerList];
var resourceList = (List<ResourceDC>)appointment.CustomFields[CustomField_ResourceList];
if (!pShowTasks && isTask)
{
return true;
}
var ersteller = (CompactEmployeeDC)appointment.CustomFields[nameof(SchedulerAppointmentVM.Originator)];
var employeeList = (List<Employee2SchedulerAppointmentDC>)appointment.CustomFields[nameof(SchedulerAppointmentVM.EmployeeList)];
var customerList = (List<CompactCustomerDC>)appointment.CustomFields[nameof(SchedulerAppointmentVM.CustomerList)];
var resourceList = (List<ResourceDC>)appointment.CustomFields[nameof(SchedulerAppointmentVM.ResourceList)];
if (isPrivate)
{
@@ -499,7 +583,7 @@ namespace BeWo.Scheduler.ViewModel
break;
case "Ebenen":
var liste = (List<bool>) selectedObject; // mkr
var appEList = employeeList.Where(w => !w.Employee.Equals(appointment.CustomFields[CustomField_Originator])).ToList();
var appEList = employeeList.Where(w => !w.Employee.Equals(appointment.CustomFields[nameof(SchedulerAppointmentVM.Originator)])).ToList();
// Ersteller und Rechte beachten
@@ -529,12 +613,13 @@ namespace BeWo.Scheduler.ViewModel
break;
}
// return false -> Termin wird angezeigt!
return !wirdAngezeigt;
}
public void InitChangedOccurrencyCustomFields(IEnumerable<SchedulerAppointmentDC> appList)
{
_ChangedOccurencyCustomFields = new Dictionary<Guid, Dictionary<string, Dictionary<string, object>>>();
_ChangedOccurenceCustomFields = new Dictionary<Guid, Dictionary<string, Dictionary<string, object>>>();
foreach (var termin in appList)
{
@@ -556,27 +641,32 @@ namespace BeWo.Scheduler.ViewModel
var customFieldCollection =
new Dictionary<string, object>
{
[CustomField_CustomerList] = termin.CustomerList,
[CustomField_EmployeeList] = termin.EmployeeList,
[CustomField_ResourceList] = termin.ResourceList,
[CustomField_Originator] = termin.Originator,
[CustomField_IsPrivate] = termin.IsPrivate,
[CustomField_IsAbsenceTime] = false
[nameof(SchedulerAppointmentVM.CustomerList)] = termin.CustomerList,
[nameof(SchedulerAppointmentVM.EmployeeList)] = termin.EmployeeList,
[nameof(SchedulerAppointmentVM.ResourceList)] = termin.ResourceList,
[nameof(SchedulerAppointmentVM.Originator)] = termin.Originator,
[nameof(SchedulerAppointmentVM.IsPrivate)] = termin.IsPrivate,
[nameof(SchedulerAppointmentVM.IsAbsenceTime)] = false,
[nameof(SchedulerAppointmentVM.IsTask)] = termin.IsTask,
[nameof(SchedulerAppointmentVM.DueDate)] = termin.DueDate,
[nameof(SchedulerAppointmentVM.TaskDescription)] = termin.TaskDescription,
[nameof(SchedulerAppointmentVM.CompletedDate)] = termin.CompletedDate,
[nameof(SchedulerAppointmentVM.CompletedNotice)] = termin.CompletedNotice
};
var id = new Guid(ri.Id.ToString());
if(!_ChangedOccurencyCustomFields.ContainsKey(id))
if(!_ChangedOccurenceCustomFields.ContainsKey(id))
{
_ChangedOccurencyCustomFields.Add(id, new Dictionary<string, Dictionary<string, object>> { { index, customFieldCollection } });
_ChangedOccurenceCustomFields.Add(id, new Dictionary<string, Dictionary<string, object>> { { index, customFieldCollection } });
}
else if(!_ChangedOccurencyCustomFields[id].ContainsKey(index))
else if(!_ChangedOccurenceCustomFields[id].ContainsKey(index))
{
_ChangedOccurencyCustomFields[id].Add(index, customFieldCollection);
_ChangedOccurenceCustomFields[id].Add(index, customFieldCollection);
}
else
{
_ChangedOccurencyCustomFields[id][index] = customFieldCollection;
_ChangedOccurenceCustomFields[id][index] = customFieldCollection;
}
}
}
@@ -621,7 +711,7 @@ namespace BeWo.Scheduler.ViewModel
allEmployeesAreEqual &&
appointmentsAreEqual &&
Equals(Categories2Resources, obj.Categories2Resources) &&
Equals(ChangedOccurencyCustomFields, obj.ChangedOccurencyCustomFields);
Equals(ChangedOccurenceCustomFields, obj.ChangedOccurenceCustomFields);
return areEqual;
}

View File

@@ -13,21 +13,26 @@ namespace BeWo.Scheduler.ViewModel
{
public class SchedulerAppointmentVM : AbstractDCMapperVM<SchedulerAppointmentDC>, IBeWoAppointment
{
public static string PropertyName_Type = "Type";
public static string PropertyName_Start = "Start";
public static string PropertyName_End = "End";
public static string PropertyName_AllDay = "AllDay";
public static string PropertyName_Subject = "Subject";
public static string PropertyName_Location = "Location";
public static string PropertyName_Status = "Status";
public static string PropertyName_RecurrenceInfo = "RecurrenceInfo";
public static string PropertyName_Description = "Description";
public static string PropertyName_EmployeeList = "EmployeeList";
public static string PropertyName_CustomerList = "CustomerList";
public static string PropertyName_ResourceList = "ResourceList";
public static string PropertyName_IsPrivate = "IsPrivate";
public static string PropertyName_Originator = "Originator";
public static string PropertyName_IsAbsenceTime = "IsAbsenceTime";
public static string PropertyName_Type = "Type";
public static string PropertyName_Start = "Start";
public static string PropertyName_End = "End";
public static string PropertyName_AllDay = "AllDay";
public static string PropertyName_Subject = "Subject";
public static string PropertyName_Location = "Location";
public static string PropertyName_Status = "Status";
public static string PropertyName_RecurrenceInfo = "RecurrenceInfo";
public static string PropertyName_Description = "Description";
public static string PropertyName_EmployeeList = "EmployeeList";
public static string PropertyName_CustomerList = "CustomerList";
public static string PropertyName_ResourceList = "ResourceList";
public static string PropertyName_IsPrivate = "IsPrivate";
public static string PropertyName_Originator = "Originator";
public static string PropertyName_IsAbsenceTime = "IsAbsenceTime";
public static string PropertyName_IsTask = nameof(IsTask);
public static string PropertyName_DueDate = nameof(DueDate);
public static string PropertyName_CompletedDate = nameof(CompletedDate);
public static string PropertyName_CompletedNotice = nameof(CompletedNotice);
public static string PropertyName_TaskDescription = nameof(TaskDescription);
private bool _allDay;
private string _description;
@@ -43,9 +48,15 @@ namespace BeWo.Scheduler.ViewModel
private List<Employee2SchedulerAppointmentDC> _employeeList;
private List<CompactCustomerDC> _customerList;
private List<ResourceDC> _resourceList;
private List<CompactSupportConceptDC> _supportConceptList;
private CompactEmployeeDC _originator;
private bool _isTask;
private string _taskDescription;
private string _completedNotice;
private DateTime? _completedDate;
private DateTime? _dueDate;
public object Id { get; set; }
public object Id { get; set; }
public int LabelId { get; set; }
public Dictionary<string, object> CustomFields
{
@@ -59,11 +70,16 @@ namespace BeWo.Scheduler.ViewModel
_customFields = value;
EmployeeList = (List<Employee2SchedulerAppointmentDC>) value["EmployeeList"];
CustomerList = (List<CompactCustomerDC>) value["CustomerList"];
ResourceList = (List<ResourceDC>) value["ResourceList"];
Originator = (CompactEmployeeDC) value["Originator"];
IsPrivate = (bool) value["IsPrivate"];
EmployeeList = (List<Employee2SchedulerAppointmentDC>) value[nameof(EmployeeList)];
CustomerList = (List<CompactCustomerDC>) value[nameof(CustomerList)];
ResourceList = (List<ResourceDC>) value[nameof(ResourceList)];
Originator = (CompactEmployeeDC) value[nameof(Originator)];
IsPrivate = (bool) value[nameof(IsPrivate)];
IsTask = (bool) value[nameof(IsTask)];
DueDate = (DateTime?) value[nameof(DueDate)];
TaskDescription = value[nameof(TaskDescription)]?.ToString();
CompletedDate = (DateTime?) value[nameof(CompletedDate)];
CompletedNotice = value[nameof(CompletedNotice)]?.ToString();
}
}
@@ -201,7 +217,9 @@ namespace BeWo.Scheduler.ViewModel
}
}
public string RecurrenceInfo
public bool IsTeilnahmeBestaetigung { get; }
public string RecurrenceInfo
{
get => _recurrenceInfo;
set
@@ -301,7 +319,27 @@ namespace BeWo.Scheduler.ViewModel
}
}
public bool IsPrivate
public List<CompactSupportConceptDC> SupportConceptList
{
get => _supportConceptList ?? (SupportConceptList = new List<CompactSupportConceptDC>());
set
{
if(AreDifferent(_supportConceptList, value))
{
_supportConceptList = value;
if(IsAbsenceTime)
{
return;
}
StoreDirtyInformation(AreDifferent(DataContract.SupportConceptList, value), nameof(SupportConceptList));
FirePropertyChanged(nameof(SupportConceptList));
}
}
}
public bool IsPrivate
{
get => _isPrivate;
set
@@ -347,7 +385,115 @@ namespace BeWo.Scheduler.ViewModel
public virtual bool IsAbsenceTime { get; }
public SchedulerAppointmentVM(SchedulerAppointmentDC pDC) : base(pDC, pDC.SchedulerAppointmentOid == null) {}
public bool IsTask
{
get => _isTask;
set
{
if (AreDifferent(_isTask, value))
{
_isTask = value;
if (IsAbsenceTime)
{
return;
}
StoreDirtyInformation(AreDifferent(DataContract.IsTask, value), nameof(IsTask));
FirePropertyChanged(nameof(IsTask));
}
}
}
public string TaskDescription
{
get => _taskDescription;
set
{
if(AreDifferent(_taskDescription, value))
{
_taskDescription = value;
if(IsAbsenceTime)
{
return;
}
StoreDirtyInformation(AreDifferent(DataContract.TaskDescription, value), nameof(TaskDescription));
FirePropertyChanged(nameof(TaskDescription));
}
}
}
public string CompletedNotice
{
get => _completedNotice;
set
{
if(AreDifferent(_completedNotice, value))
{
_completedNotice = value;
if(IsAbsenceTime)
{
return;
}
StoreDirtyInformation(AreDifferent(DataContract.CompletedNotice, value), nameof(CompletedNotice));
FirePropertyChanged(nameof(CompletedNotice));
}
}
}
public DateTime? CompletedDate
{
get => _completedDate;
set
{
if(AreDifferent(_completedDate, value))
{
_completedDate = value;
if(IsAbsenceTime)
{
return;
}
StoreDirtyInformation(AreDifferent(DataContract.CompletedDate, value), nameof(CompletedDate));
FirePropertyChanged(nameof(CompletedDate));
}
}
}
public DateTime? DueDate
{
get => _dueDate;
set
{
if(AreDifferent(_dueDate, value))
{
_dueDate = value;
if(IsAbsenceTime)
{
return;
}
StoreDirtyInformation(AreDifferent(DataContract.DueDate, value), nameof(DueDate));
FirePropertyChanged(nameof(DueDate));
}
}
}
public SchedulerAppointmentVM(SchedulerAppointmentDC pDC) : base(pDC, pDC.SchedulerAppointmentOid == null)
{
IsTeilnahmeBestaetigung = pDC.IsTeilnahmeBestaetigung;
}
public SchedulerAppointmentVM(bool pAllDay, string pSubject, DateTime pStart, DateTime pEnd, CompactEmployeeDC pOriginator)
{
@@ -366,51 +512,69 @@ namespace BeWo.Scheduler.ViewModel
{
CustomFields = new Dictionary<string, object>
{
{"EmployeeList", EmployeeList},
{"CustomerList", CustomerList},
{"ResourceList", ResourceList},
{"Originator", Originator},
{"IsPrivate", IsPrivate},
{PropertyName_IsAbsenceTime, IsAbsenceTime}
{nameof(EmployeeList), EmployeeList},
{nameof(CustomerList), CustomerList},
{nameof(ResourceList), ResourceList},
{nameof(Originator), Originator},
{nameof(IsPrivate), IsPrivate},
{nameof(IsAbsenceTime), IsAbsenceTime},
{nameof(IsTask), IsTask},
{nameof(DueDate), DueDate},
{nameof(TaskDescription), TaskDescription},
{nameof(CompletedNotice), CompletedNotice},
{nameof(CompletedDate), CompletedDate},
{nameof(SupportConceptList), SupportConceptList}
};
}
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;
_employeeList = pDataContract.EmployeeList;
_resourceList = pDataContract.ResourceList;
_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;
_employeeList = pDataContract.EmployeeList;
_resourceList = pDataContract.ResourceList;
_isTask = pDataContract.IsTask;
_taskDescription = pDataContract.TaskDescription;
_completedNotice = pDataContract.CompletedNotice;
_completedDate = pDataContract.CompletedDate;
_dueDate = pDataContract.DueDate;
_supportConceptList = pDataContract.SupportConceptList;
}
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;
pDataContract.ResourceList = _resourceList;
return pDataContract;
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;
pDataContract.ResourceList = _resourceList;
pDataContract.IsTask = _isTask;
pDataContract.TaskDescription = _taskDescription;
pDataContract.CompletedNotice = _completedNotice;
pDataContract.CompletedDate = _completedDate;
pDataContract.DueDate = _dueDate;
pDataContract.SupportConceptList = _supportConceptList;
return pDataContract;
}
public override bool Equals(object pObj)
@@ -424,7 +588,7 @@ namespace BeWo.Scheduler.ViewModel
var customFieldsAreEqual = false;
if (CustomFields.Count == obj.CustomFields.Count)
if(CustomFields.Count == obj.CustomFields.Count)
{
for (var i = 0; i < CustomFields.Count; i++)
{
@@ -450,17 +614,54 @@ namespace BeWo.Scheduler.ViewModel
break;
case 3:
var originator1 = (CompactEmployeeDC) CustomFields.ElementAt(i).Value;
var objOriginator1 = (CompactEmployeeDC) CustomFields.ElementAt(i).Value;
var objOriginator1 = (CompactEmployeeDC) obj.CustomFields.ElementAt(i).Value;
customFieldsAreEqual = originator1 == null && objOriginator1 == null || originator1 != null && originator1.Equals(objOriginator1);
break;
case 4:
var isPrivate1 = Convert.ToBoolean(CustomFields.ElementAt(i).Value);
var objIsPrivate1 = Convert.ToBoolean(CustomFields.ElementAt(i).Value);
var objIsPrivate1 = Convert.ToBoolean(obj.CustomFields.ElementAt(i).Value);
customFieldsAreEqual = isPrivate1 == objIsPrivate1;
break;
}
case 6:
var isTask1 = Convert.ToBoolean(CustomFields.ElementAt(i).Value);
var objIsTask1 = Convert.ToBoolean(obj.CustomFields.ElementAt(i).Value);
customFieldsAreEqual = isTask1 == objIsTask1;
break;
case 7:
var dueDate1 = (DateTime?)CustomFields.ElementAt(i).Value;
var objDueDate1 = (DateTime?)obj.CustomFields.ElementAt(i).Value;
customFieldsAreEqual = Equals(dueDate1, objDueDate1);
break;
case 8:
var taskDescription1 = CustomFields.ElementAt(i).Value?.ToString();
var objTaskDescription1 = obj.CustomFields.ElementAt(i).Value?.ToString();
customFieldsAreEqual = Equals(taskDescription1, objTaskDescription1);
break;
case 9:
var completedDate1 = (DateTime?)CustomFields.ElementAt(i).Value;
var objCompletedDate1 = (DateTime?)obj.CustomFields.ElementAt(i).Value;
customFieldsAreEqual = Equals(completedDate1, objCompletedDate1);
break;
case 10:
var completedNotice1 = CustomFields.ElementAt(i).Value?.ToString();
var objCompletedNotice1 = obj.CustomFields.ElementAt(i).Value?.ToString();
customFieldsAreEqual = Equals(completedNotice1, objCompletedNotice1);
break;
case 11:
var supportConceptList1 = (List<CompactSupportConceptDC>)CustomFields.ElementAt(i).Value;
var objSupportConceptList1 = (List<CompactSupportConceptDC>)obj.CustomFields.ElementAt(i).Value;
customFieldsAreEqual = supportConceptList1 == null && objSupportConceptList1 == null || supportConceptList1 != null && supportConceptList1.AreEqual(objSupportConceptList1);
break;
}
}
}
@@ -470,6 +671,11 @@ namespace BeWo.Scheduler.ViewModel
IsPrivate == obj.IsPrivate &&
IsDirty == obj.IsDirty &&
IsNew == obj.IsNew &&
IsTask == obj.IsTask &&
TaskDescription == obj.TaskDescription &&
Equals(CompletedDate, obj.CompletedDate) &&
Equals(DueDate, obj.DueDate) &&
Equals(CompletedNotice, obj.CompletedNotice) &&
customFieldsAreEqual &&
CustomerList.AreEqual(obj.CustomerList) &&
Equals(Description, obj.Description) &&

File diff suppressed because it is too large Load Diff

View File

@@ -3555,7 +3555,7 @@
</Setter>
</Style>
<!--################################ Minimize Button Style ######################################-->
<!-- ################################ Minimize Button Style ###################################### -->
<Style x:Key="MinimizeButtonStyle" TargetType="{x:Type Button}">
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="0" />
@@ -3726,7 +3726,7 @@
</Setter>
</Style>
<!--#################################################### MinimizeButton Style #####################################################-->
<!-- #################################################### MinimizeButton Style ##################################################### -->
<Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}">
<Setter Property="MinWidth" Value="0" />

View File

@@ -1,8 +1,4 @@
using System;
using System.Windows;
using System.Windows.Media.Animation;
using BeWo.Scheduler.View;
using BeWo.Scheduler.View;
namespace BeWo.View.Master
{

View File

@@ -3,6 +3,7 @@
<PropertyGroup>
<NameOfLastUsedPublishProfile>Test</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>

View File

@@ -15,7 +15,7 @@
<AssemblyName>BeWoPlanerMobil</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress>
<UseIISExpress>false</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
@@ -80,6 +80,7 @@
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
@@ -156,8 +157,10 @@
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\AbstractBaseController.cs" />
<Compile Include="Controllers\ChatController.cs" />
<Compile Include="Util\GoalTreeItem.cs" />
<Compile Include="Controllers\LoginController.cs" />
<Compile Include="Controllers\MainController.cs" />
<Compile Include="Util\RecurrenceInformation.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
@@ -172,7 +175,12 @@
<DependentUpon>TestWebService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="Util\JSONCustomer.cs" />
<Compile Include="Util\MobileUtils.cs" />
<Compile Include="Util\ServiceRecord2Validation.cs" />
<Compile Include="Util\TextbausteinDisplayItem.cs" />
<Compile Include="Util\Umfeldsperson.cs" />
<Compile Include="Util\ValidationResult.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\BeWoMobileStyle.css" />
@@ -191,6 +199,7 @@
<Content Include="Content\images\pfeilRechts.svg" />
<Content Include="Content\images\plus.svg" />
<Content Include="Content\images\spinner.png" />
<Content Include="Content\images\statistik-disabled.svg" />
<Content Include="Content\images\statistik-orange.svg" />
<Content Include="Content\images\toggle-icon-d-disabled.svg" />
<Content Include="Content\images\toggle-icon-d.svg" />
@@ -208,7 +217,10 @@
<Content Include="Scripts\localServiceRecord.js" />
<Content Include="Scripts\mainView.js" />
<Content Include="Scripts\modernizr-2.8.3.js" />
<Content Include="Scripts\serviceRecordValidation.js" />
<Content Include="Scripts\statistics.js" />
<Content Include="Scripts\textbausteine.js" />
<Content Include="Scripts\unterschrift.js" />
<Content Include="Scripts\utils.js" />
<Content Include="TestWebService.asmx" />
<Content Include="Web.config">

View File

@@ -8,6 +8,7 @@
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>

View File

@@ -16,6 +16,11 @@ table {
margin: 1em auto;
}
button {
-webkit-border-radius: 0;
border-radius: 0;
}
hr {
border: 0;
height: 0;
@@ -42,6 +47,12 @@ body {
height: 100%;
}
pre {
font-family: "Microsoft Sans Serif", Arial, sans-serif;
white-space: pre-line;
word-wrap: normal;
}
a, a:active, a:visited, a:hover {
color: #555;
}
@@ -152,6 +163,12 @@ span {
background-color: #f4f4f4;
}
.toggle-btn:disabled {
background-image: url("images/toggle-icon-d-disabled.svg");
background-repeat: no-repeat;
background-position: 99.5% center;
}
.toggle-btn-div {
margin-top: .2em;
margin-bottom: 0;
@@ -380,19 +397,19 @@ ul {
right:0;
}
#popupDiv, #errorPopupDiv,#SuccessPopupDiv,#AendernPopupDiv {
width:90%;
height: 20%;
background-color: #ffffff;
border: 1px solid #FF5A00;
display: none;
margin: auto;
position: absolute;
#popupDiv, #errorPopupDiv, #SuccessPopupDiv, #AendernPopupDiv, #validationPopupDiv {
width: 90%;
height: 20%;
background-color: #ffffff;
border: 1px solid #FF5A00;
display: none;
margin: auto;
position: absolute;
z-index: 900;
top: 0;
left: 0;
bottom: 0;
right: 0;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.popupBtn{
@@ -438,8 +455,8 @@ textarea {
margin-top: 1em;
}
#umfeldContainer {
display: none;
#umfeldContainer, #kommentarContainer {
display: none;
}
.contentTd {
@@ -675,81 +692,10 @@ input[type="checkbox"] {
background-size: contain;
}
article.infobox section {
position: absolute;
display: table-row;
width: 100%;
background-color: #ffffff;
top: 30px;
}
article.infobox section textarea:focus {
border-color: #FF5A00;
}
article.infobox section h2 {
position: absolute;
left: 0;
top: -30px;
width: 25%;
height: 29px;
font-size: 12px;
font-weight: normal;
margin: 0;
background-color: rgba(0, 0, 0, 0.1);
border-radius: 0 0 0 0;
border: double #ffffff;
border-width: 1px 1px 0 1px;
z-index: 0;
word-wrap: break-word;
border-color: rgba(0, 0, 0, 0.1);
}
article.infobox section:nth-child(2) h2{
left: 25%;
z-index: 1;
}
article.infobox section:nth-child(3) h2{
left: 50%;
z-index:2;
}
article.infobox section:nth-child(4) h2{
left: 75%;
z-index: 3;
}
article.infobox section:nth-child(5) h2{
left: 90%;
z-index: 4;
}
article.infobox section h2 a {
display: block;
margin: 5px 0 0 0;
text-align: center;
text-decoration: none;
color:#000000;
}
article.infobox section:target, article.infobox section:target h2 {
color: #000000;
z-index: 1;
background-color: #FFFFFF;
border-color:#FF5A00;
}
article.infobox section:target h2 a {
color: #000000;
border-color:#FF5A00;
}
.documentationTextArea {
height: 60px;
display: none;
margin-top: 0;
}
.removeButton {
@@ -763,12 +709,6 @@ article.infobox section:target h2 a {
float: right;
}
.dropdownlist-for {}
.date-input-css {}
.select-container {}
.text-module-popup-div-background {
display: none;
position: absolute;
@@ -807,3 +747,141 @@ article.infobox section:target h2 a {
margin-top: -5px;
padding: .5em;
}
.see-thru-popup-container {
display: none;
position: absolute;
width: 100%;
height: 100%;
z-index: 899;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: #bbbbbb;
opacity: 0;
overflow: hidden;
}
.group-booking-popup-div {
display: none;
position: absolute;
background-color: #ffffff;
border: 1px solid #FF5A00;
margin: 0 8px;
z-index: 900;
padding: 0;
left: 0;
right: 0;
overflow-y: scroll;
}
#groupBookingOpenPopupBtn, #groupBookingOpenEmployeeSelectionPopupBtn {
text-align: left;
background-image: url('images/toggle-icon-d.svg');
background-repeat: no-repeat;
background-position: 99.5% center;
margin-bottom: .25em;
margin-top: .25em;
}
#groupBookingOpenPopupBtn {
margin-bottom: 1em;
margin-top: .5em;
}
.group-booking-tab {
overflow: hidden;
}
.group-booking-tab button {
float: left;
border: none;
outline: none;
width: 50%;
background-color: #e6e6e6;
font-size: 13px;
color: #555;
padding: 10px 20px;
}
.group-booking-tab button.active {
background-color: #ff5a00;
color: white;
}
.tab-content {
display: none;
overflow-y: auto;
overflow-x: hidden;
}
.collapsible-group-booking {
margin: 0;
padding: 0;
display: none;
}
.tab-content table {
width: 100%;
margin: 0;
padding: 0;
}
.group-booking-text-cell {
font-size: 13px;
padding-left: .5em;
}
.tab-content table tr:nth-child(even) {
background-color: #f0f0f0;
}
#employeeCollapsible, #groupBookingCollapsible {
overflow-y: auto;
}
#employeePopupDiv, #groupBookingPopupDiv {
overflow-y: hidden;
}
/* Neue Dokumentationstabs */
.doku-tab {
overflow: hidden;
margin-bottom: 0;
word-wrap: break-word;
}
.doku-tab-link {
display: none;
padding: 10px 20px;
float: left;
border: none;
outline: none;
background-color: #e5e5e5;
width: 20%;
font-size: 13px;
color: #555555;
}
.doku-tab-link.active {
background-color: #ff5a00;
color: white;
}
.doku-tab-link:disabled {
background-color: #e5e5e5;
color: #555555;
}
.doku-tab-content {
display: none;
}
#validationPopupDiv {
height: auto;
z-index: 9999;
padding: 0 1.5em;
}

View File

@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
width="14px"
height="14px"
viewBox="0 0 14 14"
style="enable-background:new 0 0 14 14;"
xml:space="preserve"
inkscape:version="0.91 r13725"
sodipodi:docname="statistik-orange.svg"><metadata
id="metadata39"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
id="defs37" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1057"
id="namedview35"
showgrid="false"
inkscape:zoom="32"
inkscape:cx="3.9267392"
inkscape:cy="6.9730709"
inkscape:window-x="1592"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><g
id="g5" /><g
id="g7" /><g
id="g9" /><g
id="g11" /><g
id="g13" /><g
id="g15" /><g
id="g17" /><g
id="g19" /><g
id="g21" /><g
id="g23" /><g
id="g25" /><g
id="g27" /><g
id="g29" /><g
id="g31" /><g
id="g33" /><path
style="fill:none;fill-rule:evenodd;stroke:#bbbbbb;stroke-width:1.03948033px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 1.5197402,0.5 0,13"
id="path4166"
inkscape:connector-curvature="0" /><path
style="fill:none;fill-rule:evenodd;stroke:#bbbbbb;stroke-width:1.03948033px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 0.5,12.48026 13,0"
id="path4166-9"
inkscape:connector-curvature="0" /><path
style="fill:none;fill-rule:evenodd;stroke:#bbbbbb;stroke-width:1.02814114px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 2.8851064,11.052589 5.9647075,8.122223 8.2826869,9.5874061 9.6403606,5.5971203 13.11733,2.9473211"
id="path4183"
inkscape:connector-curvature="0" /></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -102,8 +102,10 @@ namespace BeWoPlanerMobil.Models
public static bool IsEmployeeSelectionVisible => MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreationForOtherEmployees) || MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreationForOtherTeamMember);
//public static bool IsTextbausteineVisible => MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineAlleAnsehen) || MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineNurEigeneAnsehen);
public static bool IsTextbausteineVisible = false;
public static bool IsTextbausteineVisible => MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineAlleAnsehen) || MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineNurEigeneAnsehen);
//public static bool IsTextbausteineVisible = false;
public static bool HasRightForGroupBookings => MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking);
public bool ShowDistanceField { get; set; }
@@ -150,29 +152,7 @@ namespace BeWoPlanerMobil.Models
}
}
public IEnumerable<SelectListItem> SelectedSupportConceptListItemsForGroupBooking
{
get
{
var selectedSCs = new List<SelectListItem>();
if(SelectedSupportConcepts != null)
{
foreach(var sc in SelectedSupportConcepts.OrderBy(sc => sc.Customer.LastName))
{
selectedSCs.AddRange(sc.CostBearerRelations.Where(w => ShowExpiredSupportConcepts || w.EndDate == null || w.EndDate.Value >= DateTime.Now).Select(cb => new SelectListItem
{
Value = cb.CostBearer2SupportConceptOid.ToString(),
Text = $"{sc.Customer.LastNameFirstName} | {cb.StartDate?.ToShortDateString().Remove(6, 2) ?? string.Empty}-{cb.EndDate?.ToShortDateString().Remove(6, 2) ?? string.Empty} {cb.CostBearer.Name}"
}));
}
}
return selectedSCs;
}
}
public IEnumerable<SelectListItem> ServiceCategoryListItems
public IEnumerable<SelectListItem> ServiceCategoryListItems
{
get
{
@@ -187,48 +167,18 @@ namespace BeWoPlanerMobil.Models
{
get
{
var result = new List<SelectListItem> { new SelectListItem {Value = "-1:0", Text = "" }};
var result = new List<SelectListItem>();
foreach(var item in GroupsOfPeople)
foreach(var group in GroupsOfPeople)
{
var relOids = "";
for(var i = 0; i < item.SupportConceptList.Count; i++)
{
relOids += item.SupportConceptList.ElementAt(i).CostBearerRelOids.First().ToString();
if(i != item.SupportConceptList.Count - 1)
{
relOids += ",";
}
}
result.Add(new SelectListItem { Value = $"{item.GroupOfPeopleOid.Value}:{relOids}", Text = item.Name });
result.Add(new SelectListItem { Value = $"{group.GroupOfPeopleOid.Value}", Text = group.Name });
}
return result;
}
}
[Display(Name = "Textbaustein")]
public long? SelectedTextbausteinOid { get; set; }
public IEnumerable<SelectListItem> TextbausteinListItems
{
get
{
var result = new List<SelectListItem>();
if (Textbausteine != null)
{
result.AddRange(Textbausteine.Select(item => new SelectListItem { Value = item.TextModuleOid.Value.ToString(), Text = item.Name }).ToList());
}
return result;
}
}
public List<CompactCustomerDC> Customers { get; set; }
public List<CompactCustomerDC> Customers { get; set; }
public List<CompactEmployeeDC> Employees { get; set; }
@@ -253,15 +203,14 @@ namespace BeWoPlanerMobil.Models
public static List<CompactEmployeeDC> AllEmployees { get; set; }
[Display(Name = "Mitarbeiter")]
public long? SelectedEmployeeOid { get; set; }
public long? SelectedEmployeeOid => SelectedEmployee?.EmployeeOid;
public CompactEmployeeDC SelectedEmployee { get; set; }
public CompactEmployeeDC SelectedEmployee { get; set; }
public List<GroupOfPeopleDC> GroupsOfPeople { get; set; }
public List<GroupOfPeopleDC> GroupsOfPeople { get; set; } = new List<GroupOfPeopleDC>();
public List<long> SelectedGroupOfPeopleOids { get; set; } = new List<long>();
[Display(Name = "Gruppen")]
public string SelectedGroupInfo { get; set; }
public IEnumerable<SelectListItem> EmployeeListItems
{
get
@@ -294,16 +243,17 @@ namespace BeWoPlanerMobil.Models
public List<SupportConceptDC> SelectedSupportConcepts { get; set; } = new List<SupportConceptDC>();
public List<CompactEmployeeDC> SelectedEmployees { get; set; } = new List<CompactEmployeeDC>();
public List<long> SelectedCostbearerRelOids { get; set; } = new List<long>();
public List<long> SelectedCostbearer2SupportConceptOids { get; set; } = new List<long>();
public List<CompactEmployeeDC> SelectedEmployees { get; set; } = new List<CompactEmployeeDC>();
[Display(Name = "Gruppenbuchung")]
public bool IsInGroupBookingMode
{
get => _IsInGroupBookingMode;
get => _IsInGroupBookingMode;
//get => false;
set
set
{
_IsInGroupBookingMode = value;
@@ -333,5 +283,8 @@ namespace BeWoPlanerMobil.Models
return result;
}
public bool IsServiceRecordNoticeMandatory { get; set; } = true;
}
}

View File

@@ -252,8 +252,8 @@ function LoadOnly(i, x) {
var serviceRecord = localStorage.getItem("Zeitdaten");
var appointment = localStorage.getItem("Kalenderdaten");
if(serviceRecord != null || appointment != null) {
if(serviceRecord != null && i === 1) {
if(serviceRecord !== null || appointment !== null) {
if(serviceRecord !== null && i === 1) {
if(serviceRecord.startTime !== "" && serviceRecord.endTime !== "" && serviceRecord.duration !== "" && serviceRecord.notice !== "" && serviceRecord.supportConceptIndex !== "" && serviceRecord.date !== "") {
writeFatalErrorMessage("Es ist ein nicht gespeicherter Eintrag vorhanden. Dieser wird nun an den Server gesendet.");
@@ -265,8 +265,8 @@ function LoadOnly(i, x) {
}
}
if(kalenderdata != null && x === 2) {
if (appointment != null && appointment.isValid()) {
if(kalenderdata !== null && x === 2) {
if (appointment !== null && appointment.isValid()) {
writeFatalErrorMessage("Es ist ein nicht gespeicherter Kalendereintrag vorhanden. Dieser wird nun an den Server gesendet.", 1);
setTimeout(function() {
@@ -278,3 +278,18 @@ function LoadOnly(i, x) {
}
}
}
function nextDayButtonClick() {
var nextdatum = new Date($("#KalenderDatum").val() + "T00:00:00Z");
nextdatum.setDate((nextdatum.getDate() + 1));
$("#KalenderDatum").val(toDateStringYearMonthDay(nextdatum));
var newtoday = getDateStringWithLeadingZeros(nextdatum);
$("#KalenderDatumFormat").val(newtoday);
loadAppointments(newtoday);
}

View File

@@ -1,4 +1,12 @@
function isInGroupBookingMode() {
function selectGroupBookingForEditing(serviceRecordOid) {
hideSanduhr();
setGroupEditingFlag(true);
$("#editGroupServiceRecord_" + serviceRecordOid).submit();
}
function isInGroupBookingMode() {
return $("#changeBookingModeCheckBox").is(":checked");
}
@@ -6,90 +14,11 @@ function isInEditingMode() {
return $("#versteckt").val() === "Speichern";
}
function initGroupBookingForm() {
var isChecked = isInGroupBookingMode();
var hide = "none";
var show = "block";
$("#selectSCForm").css("display", isChecked ? hide : show);
$("#gruppenbuchungsContainer").css("display", isChecked ? show : hide);
$("#singleSCEmployeeSelectionContainer").css("display", isChecked ? hide : show);
}
function removeSupportConceptFromList(pSelectedSupportConceptOid, event) {
$('[name="elementToBeRemoved"]').val(pSelectedSupportConceptOid);
showSanduhr();
event.form.submit();
}
function addEmployeeToGruppenbuchung(event) {
var selectedEmployeeOid = $("#groupBookingEmployeesDropDown").find(":selected").val();
if($('#employee_tr_' + selectedEmployeeOid).length === 0) {
showSanduhr();
event.form.submit();
}
}
function removeEmployeeFromList(pEmployeeOid, event) {
$('[name="employeeToRemove"]').val(pEmployeeOid);
showSanduhr();
event.form.submit();
}
function addSupportConceptToGroupBooking(event) {
var scToAddOid = $($("#multiScDropDown")).find(":selected").val();
if($('#supportconcept_tr_' + scToAddOid).length === 0) {
showSanduhr();
event.form.submit();
}
}
function selectGroupBookingForEditing(serviceRecordOid) {
hideSanduhr();
setGroupEditingFlag(true);
$('#editGroupServiceRecord_' + serviceRecordOid).submit();
}
function addSupportConceptGroupToGroupBooking(event) {
var groupOidToScOids = $($("#groupDropDown")).find(":selected").val();
var supportConceptOids = groupOidToScOids.split(":")[1].split(",");
var shouldSubmitForm = false;
for(var i = 0; i < supportConceptOids.length; i++) {
var isSelected = $('#supportconcept_tr_' + supportConceptOids[i]).length !== 0;
console.log('support concept oid: ' + supportConceptOids[i] + '; is already selected: ' + isSelected);
if(supportConceptOids[i] !== "0" && $('#supportconcept_tr_' + supportConceptOids[i]).length === 0) {
shouldSubmitForm = true;
break;
}
}
if(shouldSubmitForm) {
showSanduhr();
event.form.submit();
}
}
var flagData = {};
function setGroupEditingFlag(flag) {
var obj = {
flag: flag
}
};
flagData.obj = obj;
@@ -107,3 +36,143 @@ function getGroupEditingFlag() {
return flagData.obj || {};
}
function hideGroupBookingPopup() {
var btn = $("#groupBookingOpenPopupBtn");
var container = $("#groupBookingPopupDivContainer");
var popup = $("#groupBookingPopupDiv");
var collapsible = $("#groupBookingCollapsible");
var rightContent = $("#rightContent");
var leftContent = $("#leftContent");
container.hide();
popup.hide();
collapsible.hide();
rightContent.hide();
leftContent.hide();
btn.css("background-image", "url('../Content/images/toggle-icon-d.svg')");
}
function openGroupBookingDiv() {
var btn = $("#groupBookingOpenPopupBtn");
var container = $("#groupBookingPopupDivContainer");
var collapsible = $("#groupBookingCollapsible");
if (container.css("display") === "block") {
hideGroupBookingPopup();
return;
}
var popup = $("#groupBookingPopupDiv");
container.show();
popup.show();
btn.css("background-image", "url('../Content/images/toggle-icon-u.svg')");
var top = btn.offset().top;
var outerHeight = btn.outerHeight();
var sum = top + outerHeight;
popup.css("top", parseInt(sum) + "px");
popup.css("width", (btn.innerWidth() - 2) + "px");
popup.css("max-width", (btn.innerWidth() - 2) + "px");
collapsible.show();
openGroupBookingTab(true);
}
function openGroupBookingTab(isSupportConceptTab) {
var leftBtn = $("#leftBtn");
var rightBtn = $("#rightBtn");
var leftContent = $("#leftContent");
var rightContent = $("#rightContent");
leftContent.css("max-height", ($(window).height() / 2) + "px");
rightContent.css("max-height", ($(window).height() / 2) + "px");
if (isSupportConceptTab) {
leftBtn.addClass("active");
rightBtn.removeClass("active");
leftContent.show();
rightContent.hide();
} else {
rightBtn.addClass("active");
leftBtn.removeClass("active");
rightContent.show();
leftContent.hide();
}
}
function addSupportConcepts() {
hideGroupBookingPopup();
showSanduhr();
$("#groupBookingSupportConceptSelectionForm").submit();
}
function openEmployeePopup() {
var container = $("#employeePopupContainer");
if (container.css("display") === "block") {
hideEmployeePopup();
return;
}
var btn = $("#groupBookingOpenEmployeeSelectionPopupBtn");
var collapsible = $("#employeeCollapsible");
var popup = $("#employeePopupDiv");
container.show();
popup.show();
btn.css("background-image", "url('../Content/images/toggle-icon-u.svg')");
var top = btn.offset().top;
var outerHeight = btn.outerHeight();
var sum = top + outerHeight;
popup.css("top", parseInt(sum) + "px");
popup.css("width", (btn.innerWidth() - 2) + "px");
popup.css("max-width", (btn.innerWidth() - 2) + "px");
collapsible.height(($(window).height() / 2) + "px");
collapsible.show();
}
function hideEmployeePopup() {
var container = $("#employeePopupContainer");
if (container.css("display") === "none") {
return;
}
var btn = $("#groupBookingOpenEmployeeSelectionPopupBtn");
var collapsible = $("#employeeCollapsible");
var popup = $("#employeePopupDiv");
container.hide();
popup.hide();
collapsible.hide();
btn.css("background-image", "url('../Content/images/toggle-icon-d.svg')");
}
function addEmployees() {
hideEmployeePopup();
showSanduhr();
$("#groupBookingEmployeeSelectionForm").submit();
}

View File

@@ -1,22 +1,17 @@
var isEnddateSet;
var numberOfDocumentationTypes;
var canvasWidth;
$(document).ready(function() {
if(!$("#zeiterfassung").length) {
startBeWoMobile();
});
function startBeWoMobile() {
if (!$("#zeiterfassung").length) {
return;
}
toggleErrorPopup2("errorPopupDiv2");
$("#leistungen_select,#kategorien_select,#recordLoader_select,#textbausteine_select").prop("disabled", false);
initGroupBookingForm();
toggleSelectClassesForElement("#kategorien_select", "#kategorien-select-container");
toggleSelectClassesForElement("#leistungen_select", "#leistungen-select-container");
toggleSelectClassesForElement("#recordLoader_select", "#record-loader-select-container");
toggleSelectClassesForElement("#textbausteine_select", "#textbausteine-select-container");
initializeDocumentationTextareas();
checkEndDate();
@@ -52,22 +47,38 @@ $(document).ready(function() {
ErfolgteSpx();
var count = 0;
if (typeof vm !== "undefined") {
count = vm.vorname.getSubscriptionsCount();
}
vm = new KlientenVM();
ko.applyBindings(vm);
if (count === 0) {
ko.applyBindings(vm);
}
var documentWidth = $(document).width();
canvasWidth = documentWidth * scaleFactor;
$("#sketchpad").prop("width", canvasWidth);
loadSettingsAccordingToBWP();
}
var scaleFactor = .8;
$(window).resize(function() {
var documentWidth = $(document).width();
if(canvasWidth !== (documentWidth * scaleFactor) && $("#sketchpad").css("display") === "inline") {
$("#sketchpad").prop("width", documentWidth * scaleFactor);
}
});
function initBeWoMobile(actionPath) {
try {
$("#recordLoader_select, #kategorien_select, #leistungen_select, #textbausteine_select").prop("disabled", true);
toggleSelectClassesForElement("#kategorien_select", "#kategorien-select-container");
toggleSelectClassesForElement("#leistungen_select", "#leistungen-select-container");
toggleSelectClassesForElement("#recordLoader_select", "#record-loader-select-container");
toggleSelectClassesForElement("#textbausteine_select", "#textbausteine-select-container");
var selectedServiceCategory = $($("#scDropDown")).find(":selected").val();
var selectedServiceCategory = $("#scDropDown").find(":selected").val();
if(isInGroupBookingMode() && isInEditingMode()) {
if(getGroupEditingFlag().flag === false) {
@@ -79,16 +90,46 @@ function initBeWoMobile(actionPath) {
setGroupEditingFlag(false);
}
var shouldActivateForm = isInGroupBookingMode() ? $("#gruppenbuchungsSupportConceptTable tr").length > 0 : selectedServiceCategory !== "-1";
var shouldActivateForm = isInGroupBookingMode() ? $("#leftContent input:checked").length > 0 : selectedServiceCategory !== "-1";
if(shouldActivateForm) {
if (shouldActivateForm) {
$("#recordLoader_select").prop("disabled", false);
activateInput("#record-loader-select-container");
$("#kategorien_select").prop("disabled", false);
activateInput("#kategorien-select-container");
$("#leistungen_select").prop("disabled", false);
activateInput("#leistungen-select-container");
$("#textbausteine_select").prop("disabled", false);
activateInput("#textbausteine-select-container");
activateInput("#employee-select-container");
$("#statistik-button").prop("disabled", false);
$("#statistik-button").css("background-image", "url('../Content/images/statistik-orange.svg')");
activateForm(actionPath);
if(!isInEditingMode()) {
if (!isInEditingMode()) {
$("#datum_textbox").val(getDateStringWithLeadingZeros(new Date()));
}
} else {
$("#statistik-button").prop("disabled", true);
$("#statistik-button").css("background-image", "url('../Content/images/statistik-disabled.svg')");
$("#recordLoader_select").prop("disabled", true);
disableInput("#record-loader-select-container");
$("#kategorien_select").prop("disabled", true);
disableInput("#kategorien-select-container");
$("#leistungen_select").prop("disabled", true);
disableInput("#leistungen-select-container");
$("#textbausteine_select").prop("disabled", true);
disableInput("#textbausteine-select-container");
}
$(".not-required-input").on("click blur change focus",
@@ -136,14 +177,16 @@ function initBeWoMobile(actionPath) {
}
});
var supportConceptTableHasEntries = $("#gruppenbuchungsSupportConceptTable").has("td").length;
var employeesTableHasEntries = $("#gruppenbuchungsEmployeeTable").has("td").length;
var supportConceptTableHasEntries = $("#leftContent input:checked").length;
var employeesTableHasEntries = $("#employeeCollapsible input:checked").length;
if(isInGroupBookingMode()) {
$("#anlegenEditierenBtn").prop("disabled", (supportConceptTableHasEntries === 0 || employeesTableHasEntries === 0));
if (isInGroupBookingMode()) {
var value = supportConceptTableHasEntries > 0 && employeesTableHasEntries > 0 ? false : true;
$("#anlegenEditierenBtn").prop("disabled", value);
}
} catch(err) {
console.log('Fehler: ' + err.message);
console.log("Fehler: " + err.message);
}
}
@@ -159,6 +202,16 @@ function toggleSelectClassesForElement(elementIdentifier, parentElement) {
}
}
function activateInput(parentElement) {
$(parentElement).removeClass("disabled-select-container");
$(parentElement).addClass("styled-select-div");
}
function disableInput(parentElement) {
$(parentElement).removeClass("styled-select-div");
$(parentElement).addClass("disabled-select-container");
}
function toggleErrorPopup2(errorMessage) {
var isDisplayNone = $("#errorPopupDiv2").css("display") === "none";
var displayValue = isDisplayNone ? "block" : "none";
@@ -225,43 +278,63 @@ function loadSettingsAccordingToBWP() {
}
function initializeDocumentationTextareas() {
$.ajax({
type: "GET",
url: CheckDokuReiterUrl,
success: function (json) {
var documentationTypes = $.parseJSON(json);
numberOfDocumentationTypes = documentationTypes.length;
makeAjaxCall(
"GET",
CheckDokuReiterUrl,
function (json) {
var dokuTypes = $.parseJSON(json);
if(numberOfDocumentationTypes === 0) {
$("#tddokureiter").css("display", "none");
numberOfDocumentationTypes = dokuTypes.length;
var tabWidth = 100 / numberOfDocumentationTypes;
$(".doku-tab-link").css("width", tabWidth + "%");
if (numberOfDocumentationTypes === 0) {
$("#tddokureiter").hide();
$("#trnormalDoku").css("display", "table-row");
window.focusedDokuTextarea = $("#notiz_textbox");
} else {
window.focusedDokuTextarea = $("#notiz_textbox1");
}
if(numberOfDocumentationTypes === 1) {
$("#tddokureiter").css("display", "none");
if (numberOfDocumentationTypes === 1) {
$("#tddokureiter").hide();
$("#trnormalDoku").css("display", "table-row");
$("#trnormalDokuLabel").text(documentationTypes[0].TypeDescription);
$("#trnormalDokuLabel").text(dokuTypes[0].TypeDescription);
}
if(numberOfDocumentationTypes > 1) {
for(var i = 0; i < numberOfDocumentationTypes; i++) {
if (numberOfDocumentationTypes > 1) {
var height = 0;
for (var i = 0; i < numberOfDocumentationTypes; i++) {
var idNumber = i + 1;
$('#DokName' + idNumber).text(documentationTypes[i].TypeDescription);
$('#Dokumentation' + idNumber).css("display", "block");
var dokuTab = $("#doku-name-" + idNumber);
dokuTab.html(dokuTypes[i].TypeDescription);
dokuTab.show();
var outerHeight = dokuTab.outerHeight();
if (outerHeight > height) {
height = outerHeight;
}
}
$(".doku-tab-link").css("height", height + "px");
}
if(numberOfDocumentationTypes > 0) {
focusOnTab(1);
if (numberOfDocumentationTypes > 0) {
focusOnDoku(1);
}
}
});
},
null,
null
);
}
// Formulardaten im Browser speichern, um nach einem erneuten Laden der Seite (z.B. beim Hinzufügen von Hilfeplänen bzw. Gruppen oder Mitarbeitern) die Daten wiederherzustellen.
var savedEditFormValues = {};
$(document).on("change", ".edit-form-input",
@@ -270,6 +343,8 @@ $(document).on("change", ".edit-form-input",
});
function saveFormValuesLocally() {
console.log("Speichere Eingaben als Objekt im Browser...");
var recordObject = {
category: $("#kategorien_select").val(),
serviceDescription: $("#leistungen_select").val(),

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,155 @@
var isValidRecord = true;
function validateServiceRecordBeforeSubmit() {
var hasDokutext = false;
if (window.isServiceRecordNoticeMandatory) {
if (window.numberOfDocumentationTypes < 2) {
hasDokutext = !isEmptyOrSpaces($("#notiz_textbox").val());
} else {
for (var q = 0; q < window.numberOfDocumentationTypes; q++) {
hasDokutext = !isEmptyOrSpaces($("#notiz_textbox" + (q + 1)).val());
if (hasDokutext) {
break;
}
}
}
if (!hasDokutext) {
hideSanduhr();
var fehlertext;
if (window.numberOfDocumentationTypes > 1) {
fehlertext = "Es muss mindestens ein Dokumentationstextfeld ausgefüllt sein!";
} else {
fehlertext = "Das Dokumentationstextfeld darf nicht leer sein!";
}
toggleErrorPopup(fehlertext);
return;
}
}
var dateStr = $("#datum_textbox").val();
var startStr = $("#start_textbox").val();
var endStr = $("#ende_textbox").val();
var x = getDateObj(true);
var y;
if ($("#enddatum_textbox").val() !== "") {
y = getEndDateObj();
} else {
y = getDateObj(false);
}
var vonDatum = getDateTimeStringWithLeadingZeros(x);
var bisDatum = getDateTimeStringWithLeadingZeros(y);
makeAjaxCall("POST", window.checkRightsUrl, validationOnSuccess, { von: vonDatum, bis: bisDatum, inEditMode: $("#anlegenEditierenBtn").val() === "Speichern", dateString: dateStr, startString: startStr, endString: endStr });
}
function validationOnSuccess(json) {
$("#URLSave").val(dataURL);
$("#TimeStampSave").val(newday);
if (json === "SessionTimeout") {
window.location.href = redirectLink;
return;
}
if (json === "StartGreaterEnd") {
hideSanduhr();
writeFatalErrorMessage("Die Startzeit darf nicht größer als die Endzeit sein!");
return;
}
var meldungen = $.parseJSON(json);
kannTrotzdemGespeichertWerden = meldungen.KannTrotzdemGespeichertWerden;
if (meldungen.Message === null) {
submitCreationForm();
return;
}
showValidationPopup(meldungen.Message);
}
var kannTrotzdemGespeichertWerden = false;
function submitCreationForm() {
hideValidationPopup();
if (kannTrotzdemGespeichertWerden) {
$(".modalWrapper").show();
$(".warte-animation").show();
$("#createSRForm").submit();
} else {
$(".warte-animation").hide();
}
}
function showValidationPopup(validationMessage) {
$(".warte-animation").hide();
var popupDiv = $("#validationPopupDiv");
popupDiv.show();
$("#validationPopupText").html(validationMessage);
var t = $("#validationPopupTitle").outerHeight();
var u = $("#validationPopupText").outerHeight();
var v = $("#validationBtn1").outerHeight();
var w = $("#validationBtn2").outerHeight();
var x = $("#validationResultList").outerHeight();
var h = t + u + v + w + w + x;
popupDiv.css("height", h + "px");
popupDiv.css("top", window.pageYOffset + window.innerHeight / 2 - h / 2);
popupDiv.css("margin-top", "0");
}
function hideValidationPopup() {
$(".warte-animation").hide();
var popupDiv = $("#validationPopupDiv");
popupDiv.hide();
$(".modalWrapper").hide();
popupDiv.css("margin-top", "auto");
}
function toggleValidationPopup(validationMessage) {
$(".warte-animation").hide();
var popupDiv = $("#validationPopupDiv");
if (validationMessage !== null && validationMessage !== undefined && validationMessage.length > 0) {
popupDiv.toggle();
}
if (popupDiv.css("display") === "block" && validationMessage !== null && validationMessage !== undefined && validationMessage.length > 0) {
$("#validationPopupText").html(validationMessage);
var t = $("#validationPopupTitle").outerHeight();
var u = $("#validationPopupText").outerHeight();
var v = $("#validationBtn1").outerHeight();
var w = $("#validationBtn2").outerHeight();
var x = $("#validationResultList").outerHeight();
var h = t + u + v + w + w + x;
popupDiv.css("height", h + "px");
popupDiv.css("top", window.pageYOffset + window.innerHeight / 2 - h / 2);
popupDiv.css("margin-top", "0");
} else {
$(".modalWrapper").hide();
popupDiv.css("margin-top", "auto");
}
}

View File

@@ -0,0 +1,110 @@
function loadTextbausteineForServiceCategory(serviceCategoryOid) {
makeAjaxCall("GET", loadTextbausteineForCategoryUrl, loadTextbausteineForCategoryOnSuccess, { pServiceCategoryOid: serviceCategoryOid }, null);
}
function loadTextbausteineForCategoryOnSuccess(json) {
if (json === null) {
return;
}
buildTextModuleTree(json);
}
var collapsibleHtml2;
var textModules = new Array();
var allTextModules = new Array();
function buildTextModuleTree(jsonString) {
try {
if (jsonString.length === 0) {
return;
}
textModules = $.parseJSON(jsonString);
$("#kollabierbar2").empty();
collapsibleHtml2 = "";
$.each(textModules, function (index) {
buildTreeRecursively(textModules[index]);
});
$("#kollabierbar2").append(collapsibleHtml2);
} catch (exception) {
console.log("Fehler(BuildCollapsibleSet2): " + exception.message);
}
}
function buildTreeRecursively(textmodule) {
allTextModules[textmodule.Oid] = textmodule;
if (textmodule.IsParent) {
collapsibleHtml2 += '<input onclick="toggleOnclick(this);" type="button" class="toggle-btn" value="' + textmodule.Name + '" style="font-weight: bold;" />';
collapsibleHtml2 += '<div style="display: none; margin-right: 0; padding-right: 0;" class="kollabierbar">';
} else {
collapsibleHtml2 += '<div style="display: block; padding-top: .1em;"><input type="button" style="width: 100%; text-align: left;" onclick="setTextModule(' + textmodule.Oid + ')" value="' + textmodule.Name + '" /></div>';
}
$.each(textmodule.Children,
function (index) {
buildTreeRecursively(textmodule.Children[index]);
}
);
if (textmodule.IsParent) {
collapsibleHtml2 += "</div>";
}
}
function setTextModule(moduleOid) {
if (window.focusedDokuTextarea === null) {
if ($("#trnormalDoku").css("display") !== "none") {
window.focusedDokuTextarea = $("#notiz_textbox");
} else {
window.focusedDokuTextarea = $("#notiz_textbox1");
}
}
window.focusedDokuTextarea.val(window.focusedDokuTextarea.val() + allTextModules[moduleOid].Text);
hideTextModulePopup();
}
function setTextbaustein() {
var selectedTextbausteinOid = $("#textbausteine_select").find(":selected").val();
if (selectedTextbausteinOid > 0) {
makeAjaxCall("GET", loadCompleteTextbausteinByOidUrl, loadTextbausteinContentOnSuccess, { pTextbausteinOid: selectedTextbausteinOid }, null);
}
}
function loadTextbausteinContentOnSuccess(textbausteintext) {
if (focusedDokuTextarea !== null) {
var cursorPosition = focusedDokuTextarea.prop("selectionStart");
var v = focusedDokuTextarea.val();
var textBefore = v.substring(0, cursorPosition);
var textAfter = v.substring(cursorPosition, v.length);
focusedDokuTextarea.val(textBefore + textbausteintext + textAfter);
} else {
console.log("focusedDokuTextarea ist null!");
}
}
function showTextModulesPopup() {
$("#kollabierbar2").show();
$("#textModulePopupDivContainer").show();
$("#textModulePopupDivContainer").css("height", $("body").css("height"));
$("#textModulePopupDiv").show();
var destination = $("#textModulesTr").offset();
var outerHeight = $("#textModulePopupDiv").outerHeight();
$("#textModulePopupDiv").css({ top: destination.top - outerHeight });
}
function hideTextModulePopup() {
$("#textModulePopupDivContainer").hide();
$("#textModulePopupDiv").hide();
$("#kollabierbar2").hide();
}

View File

@@ -0,0 +1,229 @@
var canvas, ctx;
var mouseX, mouseY, mouseDown = 0;
var lastpositionx = 0;
var lastpositiony = 0;
var newpositionx = 0;
var newpositiony = 0;
var minuswert = -20;
var maxwert = 20;
var posix = 0;
var posiy = 0;
var r, g, b = 0;
var a = 255;
var date;
var dataURL = "";
var blob, newday;
function loadUnterschriftFeldFunktion() {
function drawDot(ctx, x, y, size) {
ctx.fillStyle = "rgba(" + r + "," + g + "," + b + "," + (a / 255) + ")";
if (lastpositionx !== 0) {
ctx.beginPath();
ctx.arc(x, y, size, 1, Math.PI * 0.25, true);
newpositionx = x;
newpositiony = y;
posix = newpositionx - lastpositionx;
posiy = newpositiony - lastpositiony;
if (posiy > minuswert && posix > minuswert && posiy < maxwert && posix < maxwert) {
ctx.lineTo(lastpositionx + 2, lastpositiony + 2);
ctx.lineWidth = 2;
ctx.lineCap = "butt";
ctx.lineJoin = "round";
ctx.stroke();
lastpositionx = x;
lastpositiony = y;
} else {
lastpositionx = 0;
lastpositiony = 0;
}
ctx.closePath();
ctx.fill();
} else {
ctx.beginPath();
ctx.arc(x, y, size, 1, Math.PI * 0.25, true);
ctx.closePath();
ctx.fill();
lastpositionx = x;
lastpositiony = y;
}
}
function sketchpadMouseDown() {
mouseDown = 1;
drawDot(ctx, mouseX, mouseY, 3);
}
function sketchpadMouseUp() {
mouseDown = 0;
}
function sketchpadMouseMove(e) {
getMousePos(e);
if (mouseDown === 1) {
drawDot(ctx, mouseX, mouseY, 3);
}
}
function getMousePos(e) {
if (!e) {
e = event;
}
if (e.offsetX) {
mouseX = e.offsetX;
mouseY = e.offsetY;
}
else if (e.layerX) {
mouseX = e.layerX;
mouseY = e.layerY;
}
}
function sketchpadTouchStart() {
getTouchPos();
drawDot(ctx, touchX, touchY, 3);
event.preventDefault();
}
function sketchpadTouchMove(e) {
getTouchPos(e);
drawDot(ctx, touchX, touchY, 3);
event.preventDefault();
}
function getTouchPos(e) {
if (!e) {
e = event;
}
if (e.touches) {
if (e.touches.length === 1) {
var touch = e.touches[0];
touchX = touch.pageX - touch.target.offsetLeft;
touchY = touch.pageY - touch.target.offsetTop;
}
}
}
function init() {
canvas = document.getElementById("sketchpad");
if (canvas.getContext) {
ctx = canvas.getContext("2d");
}
if (ctx) {
canvas.addEventListener("mousedown", sketchpadMouseDown, false);
canvas.addEventListener("mousemove", sketchpadMouseMove, false);
window.addEventListener("mouseup", sketchpadMouseUp, false);
canvas.addEventListener("touchstart", sketchpadTouchStart, false);
canvas.addEventListener("touchmove", sketchpadTouchMove, false);
}
}
init();
}
function showUnterschrift(serviceRecordOid, zahl) {
$("#customersDropDown").val($("#customersDropDown option").eq(0).val());
$("#zeiterfassung").hide();
$("#KalenderNavigation").hide();
$("#Kalender").hide();
$("#klienten").hide();
$("#colorRibbon").css("background-color", "#04b4d0");
$("#UnterschriftBereich").show();
$("#Statistics").hide();
$("#SupportStatistik").hide();
if (zahl === 1) {
serviceRecordOid = document.getElementById("ServiceRecordOIDSave").value;
toggleSuccessPopup("");
loadUnterschriftFeldFunktion();
preloadData(serviceRecordOid);
} else {
loadUnterschriftFeldFunktion();
preloadData(serviceRecordOid);
}
}
function backToZeiterfassung() {
$("#customersDropDown").val($("#customersDropDown option").eq(0).val());
$("#zeiterfassung").show();
$("#KalenderNavigation").hide();
$("#Kalender").hide();
$("#klienten").hide();
$("#colorRibbon").css("background-color", "#c80000");
$("#UnterschriftBereich").hide();
$("#Statistics").hide();
$("#SupportStatistik").hide();
loescheUnterschrift(canvas, ctx);
}
function speichereUnterschrift() {
date = new Date();
dataURL = canvas.toDataURL();
blob = new Blob([dataURL], { type: "URL/String" });
lastpositionx = 0;
lastpositiony = 0;
var dd = date.getDate();
var mm = date.getMonth() + 1;
var yyyy = date.getFullYear();
var hh = date.getHours();
var Min = date.getMinutes();
var Sec = date.getSeconds();
var ddStr = dd < 10 ? "0" + dd : dd;
var mmStr = mm < 10 ? "0" + mm : mm;
var hhStr = hh < 10 ? "0" + hh : hh;
var MnStr = Min < 10 ? "0" + Min : Min;
var ScStr = Sec < 10 ? "0" + Sec : Sec;
newday = "";
newday = ddStr + "." + mmStr + "." + yyyy + " " + hhStr + ":" + MnStr + ":" + ScStr;
var serviceRecordOid = $("#SaveRecordOID").val();
$.ajax({
type: "POST",
url: window.setSelectedUnterschriftUrl,
data: { blob: dataURL, zeitstempel: newday, ServiceRecord: serviceRecordOid },
success: function () {
loescheUnterschrift(canvas, ctx);
backToZeiterfassung();
toggleSuccessPopup("Die Unterschrift wurde erfolgreich gespeichert.", 2);
},
error: function () {
toggleSuccessPopup("Ein Fehler ist aufgetreten. Bitte wenden Sie sich an den Support", 3);
}
});
}
function loescheUnterschrift(canvas, ctx) {
ctx.clearRect(0, 0, canvas.width, canvas.height);
lastpositionx = 0;
lastpositiony = 0;
}
function preloadData(serviceRecordOid) {
initSignatureInfo(serviceRecordOid);
}

View File

@@ -9,7 +9,6 @@
});
}
function removeElementFromArray(pArray, pKey) {
var newArray = {};
@@ -77,3 +76,6 @@ function isElementInArray(array, element) {
}
}
function isEmptyOrSpaces(str) {
return str === null || str === undefined || str.match(/^ *$/) !== null;
}

View File

@@ -0,0 +1,13 @@
using System.Collections.Generic;
namespace BeWoPlanerMobil.Util
{
public class GoalTreeItem
{
public string Header { get; set; }
public bool IsLeaf { get; set; }
public List<GoalTreeItem> Children { get; set; }
public long? ParentOid { get; set; }
public long? ValueListEntryOid { get; set; }
}
}

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using BS.Shared;
using BS.Shared.DataContracts;
namespace BeWoPlanerMobil.Util
{
public class JSONCustomer
{
public string Vorname { get; set; }
public string Nachname { get; set; }
public string Geburtstag { get; set; }
public string Geschlecht { get; set; }
public string Adresszusatz { get; set; }
public string Strasse { get; set; }
public string Postleitzahl { get; set; }
public string Ort { get; set; }
public string RechnungsadresseName { get; set; }
public string RechnungsadresseStrasse { get; set; }
public string RechnungsadressePostleitzahl { get; set; }
public string RechnungsadresseOrt { get; set; }
public string EMail { get; set; }
public string Fax { get; set; }
public string Telefon { get; set; }
public string Handy { get; set; }
public string Kommentar { get; set; }
public List<Umfeldsperson> Umfeldpersonen { get; set; }
public JSONCustomer(CustomerDC init)
{
Vorname = init.FirstName;
Nachname = init.LastName;
Geburtstag = init.DateOfBirth?.ToShortDateString() ?? String.Empty;
Geschlecht = init.Sex == Sex.Male ? "Männlich" : "Weiblich";
Adresszusatz = init.AddressLine1;
Strasse = init.Street;
Postleitzahl = init.PostalCode;
Ort = init.Town;
RechnungsadresseName = init.InvoiceAddressLine1;
RechnungsadresseStrasse = init.InvoiceAddressStreet;
RechnungsadressePostleitzahl = init.InvoiceAddressPostalCode;
RechnungsadresseOrt = init.InvoiceAddressTown;
Kommentar = init.Notice;
foreach (var iContactDC in init.ContactInformations)
{
switch (iContactDC.ContactType)
{
case ContactType.business_Mail:
EMail = iContactDC.ContactValue;
break;
case ContactType.business_Fax:
Fax = iContactDC.ContactValue;
break;
case ContactType.business_Phone:
Telefon = iContactDC.ContactValue;
break;
case ContactType.business_MobilePhone:
Handy = iContactDC.ContactValue;
break;
}
}
Umfeldpersonen = new List<Umfeldsperson>();
foreach (var rel in init.EnvironmentPersons)
{
Umfeldpersonen.Add(new Umfeldsperson(rel));
}
}
}
}

View File

@@ -1,13 +1,185 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using BeWoPlanerMobil.Models;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.UI;
using Newtonsoft.Json;
using static System.Int32;
using static System.String;
namespace BeWoPlanerMobil.Util
{
public class MobileUtils
{
public static DateTime ConvertTimeStringToDateTime(string timeString)
{
var dt = DateTime.Now.Date;
if (IsNullOrEmpty(timeString))
{
timeString = "0000";
}
var numberString = Regex.Replace(timeString, "[^0-9]", "");
if (numberString.Length < 3)
{
if (numberString.Length < 2)
{
numberString = "0" + numberString;
}
while (numberString.Length < 4)
{
numberString = numberString + "0";
}
}
else
{
while (numberString.Length < 4)
{
numberString = "0" + numberString;
}
}
if (numberString.Length > 4)
{
numberString = numberString.Substring(0, 4);
}
var hours = Convert.ToInt32(numberString.Substring(0, 2));
var minutes = Convert.ToInt32(numberString.Substring(2, 2));
dt = dt.AddHours(hours);
dt = dt.AddMinutes(minutes);
return dt;
}
public static DateTime[] ConvertRecordTimes(string start, string ende, DateTime datum, int dauer)
{
var result = new DateTime[2];
var startDate = datum.Date;
var endDate = datum.Date;
var dateTemp = ConvertTimeStringToDateTime(start);
startDate = startDate.AddHours(dateTemp.Hour).AddMinutes(dateTemp.Minute);
dateTemp = ConvertTimeStringToDateTime(ende);
endDate = endDate.AddHours(dateTemp.Hour).AddMinutes(dateTemp.Minute);
if (IsNullOrEmpty(start) && !IsNullOrEmpty(ende))
{
startDate = endDate.AddMinutes(-1 * dauer);
}
if (IsNullOrEmpty(ende) && !IsNullOrEmpty(start))
{
endDate = startDate.AddMinutes(dauer);
}
if (endDate < startDate)
{
endDate = startDate;
}
result[0] = startDate;
result[1] = endDate;
return result;
}
public static DateTime[] ConvertRecordTimesWithEndDate(string start, string ende, DateTime datum, DateTime enddatum, int dauer)
{
var result = new DateTime[2];
var startDate = datum;
var endDate = enddatum;
var h = 0;
var m = 0;
var dateStartTime = ConvertTimeStringToDateTime(start);
startDate = startDate.AddHours(dateStartTime.Hour).AddMinutes(dateStartTime.Minute);
var dateEndTime = ConvertTimeStringToDateTime(ende);
endDate = endDate.AddHours(dateEndTime.Hour).AddMinutes(dateEndTime.Minute);
endDate = endDate.AddHours(h);
endDate = endDate.AddMinutes(m);
if (IsNullOrEmpty(start) && !IsNullOrEmpty(ende))
{
startDate = endDate.AddMinutes(-1 * dauer);
}
if (IsNullOrEmpty(ende) && !IsNullOrEmpty(start))
{
endDate = startDate.AddMinutes(dauer);
}
if (endDate < startDate)
{
endDate = startDate;
}
result[0] = startDate;
result[1] = endDate;
return result;
}
public static string SerializeObject(object obj)
{
return JsonConvert.SerializeObject(obj, Formatting.Indented, new JsonSerializerSettings { ContractResolver = new ShouldSerializeContractResolver(), ReferenceLoopHandling = ReferenceLoopHandling.Ignore });
}
public static string GetSettingValue(string settings, string key)
{
if (!IsNullOrEmpty(settings))
{
if (settings.IndexOf(";") == -1 && settings.IndexOf("=") == -1)
{
return settings;
}
var keyValuePairs = settings.Split(';');
return (from pair in keyValuePairs select pair.Split('=') into keyValuePair where keyValuePair.Length == 2 where keyValuePair[0] == key select keyValuePair[1]).FirstOrDefault();
}
return null;
}
public static RecurrenceInformation GetOccurrenceId(string pRecurrenceInfoString)
{
var regex = new Regex("Index=\"[0-9]+\"");
var match = regex.Match(pRecurrenceInfoString);
var recurrenceInfo = new RecurrenceInfo();
recurrenceInfo.FromXml(pRecurrenceInfoString);
var index = 0;
if (!match.Value.IsNullOrEmpty())
{
index = Parse(match.Value.Split('"')[1]);
}
return new RecurrenceInformation(recurrenceInfo.Id.ToString(), index);
}
public static bool IsBillable(long serviceDescriptionOid, List<ServiceDescriptionDC> serviceDescriptions)
{
var description = serviceDescriptions.FirstOrDefault(f => f.ServiceDescriptionOid.Equals(serviceDescriptionOid));
@@ -15,30 +187,30 @@ namespace BeWoPlanerMobil.Util
return description != null && description.Category.IsBillable;
}
internal static decimal? GetDecimalValue(decimal? decValue, int decimalPlaces)
public static decimal? GetDecimalValue(decimal? decValue, int decimalPlaces)
{
return decValue != null ? Math.Round(decValue.Value, decimalPlaces, MidpointRounding.AwayFromZero) : decValue;
}
public static decimal? GetDecimalValueWithMaxDecimal(decimal? decValue, int maxDecimal)
{
if(decValue != null)
if (decValue != null)
{
var decValueStr = decValue.ToString();
decValueStr = decValueStr.Replace(".", ",");
while(decValueStr.Length > 0 && decValueStr.IndexOf(",") > 0 && (decValueStr.EndsWith("0") || decValueStr.EndsWith(",")))
while (decValueStr.Length > 0 && decValueStr.IndexOf(",") > 0 && (decValueStr.EndsWith("0") || decValueStr.EndsWith(",")))
{
decValueStr = decValueStr.Substring(0, decValueStr.Length - 1);
}
var decCount = 0;
if(decValueStr.IndexOf(",") >= 0)
if (decValueStr.IndexOf(",") >= 0)
{
decCount = decValueStr.Length - decValueStr.IndexOf(",") - 1;
}
if(maxDecimal >= 0 && maxDecimal < decCount)
if (maxDecimal >= 0 && maxDecimal < decCount)
{
decCount = maxDecimal;
}
@@ -48,5 +220,159 @@ namespace BeWoPlanerMobil.Util
return decValue;
}
public static JSONCustomer GetJSONCustomer(CustomerDC pCustomer)
{
return new JSONCustomer(pCustomer);
}
public static List<ServiceCategoryModel> CreateServiceCategoryModels(IEnumerable<ServiceDescriptionDC> serviceDescriptions)
{
var catOid2ModelDict = new Dictionary<long, ServiceCategoryModel>();
foreach (var sd in serviceDescriptions)
{
if (!catOid2ModelDict.ContainsKey(sd.Category.ServiceCategoryOid.Value))
{
catOid2ModelDict[sd.Category.ServiceCategoryOid.Value] = new ServiceCategoryModel
{
Name = sd.Category.Name,
IsDefault = sd.Category.IsDefault,
Percentage = sd.Category.Percentage,
Position = sd.Category.Position,
OhneHilfeplan = sd.Category.OhneHilfeplan,
ServiceCategoryOid = sd.Category.ServiceCategoryOid,
ServiceDescriptions = new List<ServiceDescriptionDC>()
};
}
catOid2ModelDict[sd.Category.ServiceCategoryOid.Value].ServiceDescriptions.Add(sd);
}
var list = catOid2ModelDict.Values.ToList();
list.Sort((s1, s2) =>
{
if (s1.IsDefault)
{
return 1;
}
return s1.Position != s2.Position ? s1.Position.CompareTo(s2.Position) : s1.ServiceCategoryOid.Value.CompareTo(s2.ServiceCategoryOid.Value);
});
return list;
}
public static FlatSupportConceptTreeNodeDC CreateFlatSupportConceptItem(CompactSupportConceptDC dc, CompactOrganisationDC orga)
{
var flatNode = new FlatSupportConceptTreeNodeDC();
if (dc != null)
{
var treeNode = new SupportConceptTreeNodeDC {SupportConcept = dc, Customer = dc.Customer};
if (dc.CostBearerList.Count > 0)
{
CompactCostBearerDC cbDC = null;
if (orga != null)
{
foreach (var item in dc.CostBearerList)
{
if (orga.Equals(item.Organisation))
{
cbDC = item;
}
}
}
if (cbDC == null)
cbDC = dc.CostBearerList[0];
var orgDC = new CompactOrganisationDC();
var relDC = new SupportConceptCostBearerRelDC();
orgDC.CostBearerID = cbDC.CostBearerID;
orgDC.CostBearerOid = cbDC.CostBearerOid;
var o = orga ?? cbDC.Organisation;
if (o != null)
{
orgDC.OrganisationOid = o.OrganisationOid;
orgDC.Name = o.Name;
orgDC.ActualHourlyRate = o.ActualHourlyRate;
orgDC.ActualMinuteIntervall = o.ActualMinuteIntervall;
orgDC.ActualRateFactor = o.ActualRateFactor;
orgDC.CostRatePeriods = o.CostRatePeriods;
orgDC.IsCalculatingWithFactor = o.IsCalculatingWithFactor;
}
relDC.ApprovedEndDate = cbDC.ApprovedEndDate;
relDC.ApprovedStartDate = cbDC.ApprovedStartDate;
relDC.CostBearer = orgDC;
relDC.CostBearer2SupportConceptOid = cbDC.CostBearer2SupportConceptOid;
relDC.RequestedEndDate = cbDC.RequestedEndDate;
relDC.RequestedStartDate = cbDC.RequestedStartDate;
relDC.Status = cbDC.SupportConceptStatus;
relDC.SupportConcept = dc;
relDC.AuswahlBezeichnung = cbDC.Bezeichnung;
treeNode.SupportConceptCostBearerRelDC = relDC;
treeNode.CostBearer = orgDC;
}
flatNode.SupportConceptTreeNodeDC = treeNode;
}
return flatNode;
}
public static ServiceRecordDC CloneServiceRecordForGroupBooking(ServiceRecordDC pOriginal)
{
var m = pOriginal;
var clone = new ServiceRecordDC
{
CostBearer = m.CostBearer,
CostBearer2SupportConceptOid = m.CostBearer2SupportConceptOid,
Customer = m.Customer,
Employee = m.Employee,
End = m.End,
Goals = m.Goals,
GroupEmployeeCount = m.GroupEmployeeCount,
GroupOid = m.GroupOid,
SignatureOid = m.SignatureOid,
GroupPersonCount = m.GroupPersonCount,
GroupRoundedDuration = m.GroupRoundedDuration,
InsUser = m.InsUser,
InsertedOn = m.InsertedOn,
Notice = m.Notice,
Notice2 = m.Notice2,
Notice3 = m.Notice3,
Notice4 = m.Notice4,
Notice5 = m.Notice5,
RTFNotice1 = m.RTFNotice1,
RTFNotice2 = m.RTFNotice2,
RTFNotice3 = m.RTFNotice3,
RTFNotice4 = m.RTFNotice4,
RTFNotice5 = m.RTFNotice5,
RoundedDuration = m.RoundedDuration,
ServiceDescription = m.ServiceDescription,
Start = m.Start,
SupportConcept = m.SupportConcept,
ServiceRecordType = m.ServiceRecordType,
DistanceInMeter = m.DistanceInMeter,
IP = m.IP,
Relevance = m.Relevance,
IsCreatedInMobileClient = true,
WohnheimbuchungsOid = m.WohnheimbuchungsOid,
DurationInStunden = m.DurationInStunden,
ServiceRecordFormat = m.ServiceRecordFormat
};
return clone;
}
}
}

View File

@@ -0,0 +1,14 @@
namespace BeWoPlanerMobil.Util
{
public class RecurrenceInformation
{
public string PatternId { get; set; }
public int Index { get; set; }
public RecurrenceInformation(string pPatternId, int pIndex)
{
PatternId = pPatternId;
Index = pIndex;
}
}
}

View File

@@ -0,0 +1,20 @@
using System.Collections.Generic;
using BS.Shared.DataContracts;
namespace BeWoPlanerMobil.Util
{
public class ServiceRecord2Validation
{
public ServiceRecordDC ServiceRecord { get; }
public List<ServiceRecordValidationResultDC> ValidationResults { get; }
public string HilfePlanZeitraum { get; }
public ServiceRecord2Validation(ServiceRecordDC pServiceRecord, List<ServiceRecordValidationResultDC> pValidationResults, string pHilfePlanZeitraum)
{
ServiceRecord = pServiceRecord;
ValidationResults = pValidationResults;
HilfePlanZeitraum = pHilfePlanZeitraum;
}
}
}

View File

@@ -0,0 +1,25 @@
using System.Collections.Generic;
namespace BeWoPlanerMobil.Util
{
public class TextbausteinDisplayItem
{
public string Name { get; set; }
public long Oid { get; set; }
public long? ParentOid { get; set; }
public bool IsParent { get; set; }
public string Text { get; set; }
public List<TextbausteinDisplayItem> Children { get; set; }
public TextbausteinDisplayItem(long pOid, string pName, long? pParentOid, bool pIsParent, string pText)
{
Oid = pOid;
Name = pName;
ParentOid = pParentOid;
IsParent = pIsParent;
Text = pText;
Children = new List<TextbausteinDisplayItem>();
}
}
}

View File

@@ -0,0 +1,34 @@
using BS.Shared.DataContracts;
namespace BeWoPlanerMobil.Util
{
public class Umfeldsperson
{
public string Vorname { get; set; }
public string Nachname { get; set; }
public string StrNameNr { get; set; }
public string PLZOrt { get; set; }
public string TelNr { get; set; }
public string Mobil { get; set; }
public string EMail { get; set; }
public string Fax { get; set; }
public string Rolle { get; set; }
public string Titel { get; set; }
public Umfeldsperson(CustomerPersonRelationDC umfeldspersonDC)
{
var person = umfeldspersonDC.Person;
Rolle = person.Function ?? "";
Vorname = person.FirstName ?? "";
Nachname = person.LastName ?? "";
StrNameNr = person.Street ?? "";
PLZOrt = $"{person.PostalCode} {person.Town}" ?? "";
TelNr = person.Communication1 ?? "";
Mobil = person.Communication2 ?? "";
EMail = person.Communication3 ?? "";
Fax = person.Communication4 ?? "";
Titel = person.Title ?? "";
}
}
}

View File

@@ -0,0 +1,8 @@
namespace BeWoPlanerMobil.Util
{
public class ValidationResult
{
public bool KannTrotzdemGespeichertWerden { get; set; } = true;
public string Message { get; set; }
}
}

View File

@@ -1,9 +1,9 @@
@using BeWoPlanerMobil.Models;
@using BeWoPlanerMobil.Util
@using BeWoPlanerMobil.Util;
@model MainModel
@{
ViewBag.Title = "Main";
ViewBag.Title = "BeWoPlaner Mobil";
}
<div class="header-div">
@@ -39,26 +39,53 @@
<div id="zeiterfassung">
<div class="margin-div" style="overflow: hidden;">
@using(Html.BeginForm("SetShowOnlyOwnSupportConcepts", "Main", FormMethod.Post))
{
@Html.CheckBoxFor(m => m.ShowOnlyOwnSupportConcepts, new {onchange = "showSanduhr();this.form.submit();", id = "ShowOnlyOwnSupportConceptsCheckBox"})
@Html.LabelFor(m => m.ShowOnlyOwnSupportConcepts, new {id = "LabelForShowOnlyOwnSupporConceptsCB"})
@Html.CheckBoxFor(m => m.ShowOnlyOwnSupportConcepts, new { onchange = "showSanduhr();this.form.submit();", id = "ShowOnlyOwnSupportConceptsCheckBox" })
@Html.LabelFor(m => m.ShowOnlyOwnSupportConcepts, new { id = "LabelForShowOnlyOwnSupporConceptsCB", onclick ="alert('test');" })
}
@using(Html.BeginForm("SetShowExpiredSupportConcepts", "Main", FormMethod.Post))
{
@Html.CheckBoxFor(m => m.ShowExpiredSupportConcepts, new {onchange = "showSanduhr();this.form.submit();", id = "ShowExpiredSupportConceptsCheckBox"})
@Html.LabelFor(m => m.ShowExpiredSupportConcepts, new {id = "LabelForShowExpiredSupportConceptsCB"})
@Html.CheckBoxFor(m => m.ShowExpiredSupportConcepts, new { onchange = "showSanduhr();this.form.submit();", id = "ShowExpiredSupportConceptsCheckBox" })
@Html.LabelFor(m => m.ShowExpiredSupportConcepts, new { id = "LabelForShowExpiredSupportConceptsCB" })
}
@using(Html.BeginForm("SetGroupBookingMode", "Main", FormMethod.Post, new { style = "display: none;"}))
@* , new { style = "display: none;"} *@
@{
var shouldShowGroupBookingForm = "display: none";
if(MainModel.HasRightForGroupBookings)
{
@Html.CheckBoxFor(m => m.IsInGroupBookingMode, new {onchange = "showSanduhr();this.form.submit();", id = "changeBookingModeCheckBox"})
@Html.LabelFor(m => m.IsInGroupBookingMode, new {id = "labelForChangeBookingModeCheckBox"})
shouldShowGroupBookingForm = "display: block";
}
@using(Html.BeginForm("SelectSupportConcept", "Main", FormMethod.Post, new {id = "selectSCForm"}))
}
@using(Html.BeginForm("SetGroupBookingMode", "Main", FormMethod.Post, new { id = "groupBookingForm", style = shouldShowGroupBookingForm }))
{
@Html.CheckBoxFor(m => m.IsInGroupBookingMode, new { onchange = "showSanduhr();this.form.submit();", id = "changeBookingModeCheckBox" })
@Html.LabelFor(m => m.IsInGroupBookingMode, new { id = "labelForChangeBookingModeCheckBox" })
}
<input id="groupBookingOpenPopupBtn" type="button" value="Hilfepläne und Gruppen" onclick="openGroupBookingDiv()" style="display: @if (Model.IsInGroupBookingMode)
{
@Html.Raw("block")
}
else
{
@Html.Raw("none")
};" />
<input id="groupBookingOpenEmployeeSelectionPopupBtn" type="button" value="Mitarbeiter" onclick="openEmployeePopup()" style="display: @if (Model.IsInGroupBookingMode) { @Html.Raw("block") } else { @Html.Raw("none") };" />
@{
var shouldShowSingleBookingElements = "display: block";
if(Model.IsInGroupBookingMode)
{
shouldShowSingleBookingElements = "display: none";
}
}
@using(Html.BeginForm("SelectSupportConcept", "Main", FormMethod.Post, new { id = "selectSCForm", style = shouldShowSingleBookingElements }))
{
<table>
<tr>
@@ -66,342 +93,201 @@
<div class="combobox-label-parent" id="sc-dropdown-container">
@Html.LabelFor(m => m.CostBearer2SupportConceptOid)
<div class="styled-select-div">
@Html.DropDownListFor(m => m.CostBearer2SupportConceptOid, Model.SupportConceptListItems, new {onchange = "showSanduhr();$('#serviceRecords').empty();this.form.submit();", id = "scDropDown", @class = "dropdownlist-for", style = "display:block;"})
@Html.DropDownListFor(m => m.CostBearer2SupportConceptOid, Model.SupportConceptListItems, new { onchange = "showSanduhr();$('#serviceRecords').empty();this.form.submit();", id = "scDropDown", @class = "dropdownlist-for", style = "display:block;" })
</div>
</div>
</td>
<td id="statistik-button-td">
<input type="button" id="statistik-button" onclick="showStatistics()"/>
<input type="button" id="statistik-button" onclick="showStatistics()" disabled />
</td>
</tr>
</table>
}
<div id="gruppenbuchungsContainer" style="display: none;">
<table>
<tr>
@using(Html.BeginForm("SelectSupportConceptForGroupBooking", "Main", FormMethod.Post))
{
<td>
<div class="combobox-label-parent" id="multi-sc-dropdown-container">
@Html.LabelFor(m => m.CostBearer2SupportConceptOid)
<div class="styled-select-div">
@Html.DropDownListFor(m => m.CostBearer2SupportConceptOid, Model.SupporConceptListItemsForGroupBooking, new {id = "multiScDropDown", @class = "dropdownlist-for", style = "display:block;"})
</div>
</div>
</td>
<td class="gruppenbuchungsCheckboxContainer">
<input type="button" id="add-sc-button" onclick="addSupportConceptToGroupBooking(this)"/>
</td>
}
</tr>
</table>
<table>
<tr>
@using(Html.BeginForm("SelectSupportConceptGroup", "Main", FormMethod.Post))
{
<td>
<div class="combobox-label-parent" id="sc-group-dropdown-container">
@Html.LabelFor(m => m.SelectedGroupInfo)
<div class="styled-select-div">
@Html.DropDownListFor(m => m.SelectedGroupInfo, Model.GroupOfPeopleListItems, new {id="groupDropDown", @class="dropdownlist-for", style="display:block;"})
</div>
</div>
</td>
<td class="gruppenbuchungsCheckboxContainer">
<input type="button" id="add-sc-group-button" onclick="addSupportConceptGroupToGroupBooking(this)" />
</td>
}
</tr>
</table>
<div class="collapsible-container">
<input type="button" id="showSelectedSCsButton" class="toggle-btn" value="Ausgewählte Hilfepläne @Html.Raw("(" + Model.SelectedSupportConcepts.Count + ")")"/>
<div style="display: none;" class="kollabierbar" id="kollabierbar3">
@using(Html.BeginForm("RemoveSupportConceptFromGruppenbuchung", "Main", FormMethod.Post))
{
<input type="hidden" name="elementToBeRemoved"/>
<table id="gruppenbuchungsSupportConceptTable">
@foreach(var sc in Model.SelectedSupportConceptListItemsForGroupBooking)
{
<tr id="supportconcept_tr_@(sc.Value)">
<td>@(sc.Text)</td>
<td><input type="button" class="removeButton" onclick="removeSupportConceptFromList(@(sc.Value), this)"/></td>
</tr>
}
</table>
}
</div>
</div>
<table>
<tr>
@using(Html.BeginForm("SelectEmployeeForGroupBooking", "Main", FormMethod.Post))
{
<td>
<div class="combobox-label-parent" style="@{ if(!MainModel.IsEmployeeSelectionVisible) { @Html.Raw("display: none;") }}">
@Html.LabelFor(m => m.SelectedEmployeeOid)
<div class="styled-select-div">
@Html.DropDownListFor(m => m.SelectedEmployeeOid, Model.EmployeeListItems, new {id = "groupBookingEmployeesDropDown", @class = "dropdownlist-for"})
</div>
</div>
</td>
<td class="gruppenbuchungsCheckboxContainer">
<input type="button" id="add-employee-button" onclick="addEmployeeToGruppenbuchung(this)" />
</td>
}
</tr>
</table>
<div class="collapsible-container">
<input type="button" id="showSelectedEmployeesButton" class="toggle-btn" value="Ausgewählte Mitarbeiter @Html.Raw("(" + Model.SelectedEmployees.Count + ")")"/>
<div style="display: none;" class="kollabierbar" id="kollabierbar4">
@using(Html.BeginForm("RemoveEmployeeFromGruppenbuchung", "Main", FormMethod.Post))
{
<input type="hidden" name="employeeToRemove" />
<table id="gruppenbuchungsEmployeeTable">
@foreach(var employee in Model.SelectedEmployees)
{
<tr id="employee_tr_@(employee.EmployeeOid)">
<td>@(employee.DetailDescription)</td>
<td><input type="button" class="removeButton" onclick="removeEmployeeFromList(@(employee.EmployeeOid), this)"/></td>
</tr>
}
</table>
}
</div>
</div>
</div>
<div class="combobox-label-parent" style="@{ if(!MainModel.IsEmployeeSelectionVisible) { @Html.Raw("display: none;") }}" id="singleSCEmployeeSelectionContainer">
<div class="combobox-label-parent" style="@{ if(!MainModel.IsEmployeeSelectionVisible || Model.IsInGroupBookingMode) { @Html.Raw("display: none;") }}" id="singleSCEmployeeSelectionContainer">
@Html.LabelFor(m => m.SelectedEmployeeOid)
<div class="styled-select-div">
@Html.DropDownListFor(m => m.SelectedEmployeeOid, Model.EmployeeListItems, new { onchange = "setSelectedEmployee()", id = "employeesDropDown", @class = "dropdownlist-for" })
<div class="disabled-select-container" id="employee-select-container">
@Html.DropDownListFor(m => m.SelectedEmployeeOid, Model.EmployeeListItems, new { onchange = "setSelectedEmployee()", id = "employeesDropDown", @class = "dropdownlist-for", disabled = "true" })
</div>
</div>
<div @{if(!MainModel.IsAllowedToCreateOrEditRecord) { @Html.Raw("style='height: 0; overflow: hidden; position: absolute;'") }}>
<input type="hidden" id="isInEditModeIndicator" value="@(Model.IsInEditingMode ? Html.Raw("true") : Html.Raw("false"))" />
@using(Html.BeginForm("CreateServiceRecord", "Main", FormMethod.Post, new {id = "createSRForm"}))
{
<table>
<tr @{
if(Model.SelectedSupportConcept == null || Model.SelectedSupportConcept.Goals.Count == 0 || Model.IsInGroupBookingMode)
{
@Html.Raw("style='display: none;'")
}
else
{
@Html.Raw("style='display: table-row;'")
}
}>
<td colspan="2">
<div class="collapsible-container">
<input type="button" id="kollabier-btn1" class="toggle-btn" value="Ziele" disabled/>
<div id="kollabierbar1" style="display: none;" class="kollabierbar">
<div @{if(!MainModel.IsAllowedToCreateOrEditRecord) { @Html.Raw("style='height: 0; overflow: hidden; position: absolute;'") }}>
<input type="hidden" id="isInEditModeIndicator" value="@(Model.IsInEditingMode ? Html.Raw("true") : Html.Raw("false"))" />
@using(Html.BeginForm("CreateServiceRecord", "Main", FormMethod.Post, new { id = "createSRForm" }))
{
<table>
<tr @{ if(Model.SelectedSupportConcept == null || Model.SelectedSupportConcept.Goals.Count == 0 || Model.IsInGroupBookingMode) { @Html.Raw("style='display: none;'") } else { @Html.Raw("style='display: table-row;'") } }>
<td colspan="2">
<div class="collapsible-container">
<input type="button" id="kollabier-btn1" class="toggle-btn" value="Ziele" disabled />
<div id="kollabierbar1" style="display: none;" class="kollabierbar">
</div>
</div>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="combobox-label-parent cell-content">
@Html.LabelFor(m => m.SelectedServiceCategoryConceptOid)
<div class="styled-select-div select-container" id="kategorien-select-container">
@Html.DropDownListFor(m => m.SelectedServiceCategoryConceptOid, Model.ServiceCategoryListItems, new {onchange = "loadServiceDescriptions();", id = "kategorien_select", required = "required", @class = "dropdownlist-for edit-form-input" })<!--ErfolgteSpx(); Speichern local-->
</td>
</tr>
<tr>
<td colspan="2">
<div class="combobox-label-parent cell-content">
@Html.LabelFor(m => m.SelectedServiceCategoryConceptOid)
<div class="styled-select-div select-container" id="kategorien-select-container">
@Html.DropDownListFor(m => m.SelectedServiceCategoryConceptOid, Model.ServiceCategoryListItems, new { onchange = "loadServiceDescriptions();", id = "kategorien_select", required = "required", @class = "dropdownlist-for edit-form-input" })<!--ErfolgteSpx(); Speichern local-->
</div>
</div>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="combobox-label-parent cell-content">
<label for="leistungen_select">Leistung</label>
<div class="styled-select-div" id="leistungen-select-container">
<select class="dropdownlist-for edit-form-input" id="leistungen_select" onchange="setServiceDescription()" name="Leistungen" required></select>
</td>
</tr>
<tr>
<td colspan="2">
<div class="combobox-label-parent cell-content">
<label for="leistungen_select">Leistung</label>
<div class="styled-select-div" id="leistungen-select-container">
<select class="dropdownlist-for edit-form-input" id="leistungen_select" onchange="setServiceDescription()" name="Leistungen" required></select>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="input-wrapper cell-content">
<input type="text" id="datum_textbox" name="Datum" class="date-input-css floating-label-input" required disabled @{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Start != null)
{
@Html.Raw("value='" + Model.SelectedServiceRecord.Start.Value.ToString("dd.MM.yyyy") + "'")
}}/>
<label class="floating-label" for="datum_textbox">Startdatum</label>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="input-wrapper cell-content" id="EndDate_div" style="display: none">
<input type="text" id="enddatum_textbox" name="Enddatum" class="date-input-css floating-label-input edit-form-input" required disabled onchange="actualDurationWithEndDate()" @{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.End != null)
{
@Html.Raw("value='" + Model.SelectedServiceRecord.End.Value.ToString("dd.MM.yyyy") + "'")
}}/>
<label class="floating-label" for="enddatum_textbox">Enddatum</label>
</div>
</td>
</tr>
<tr id="zeiterfassungsErrorTableRow">
<td colspan="2" id="zeiterfassungsErrorTableCell">
<h4 id="zeiterfassungsErrorDisplay" class="error-text"></h4>
</td>
</tr>
<tr>
<td>
<div class="input-wrapper cell-content" id="start-cell">
<input class="not-required-input edit-form-input" type="text" id="start_textbox" name="Start" disabled @{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Start != null)
{
@Html.Raw("value=\"" + Model.SelectedServiceRecord.Start.Value.ToString("HH:mm") + "\"")
}}/>
<label for="start_textbox">Von</label>
</div>
</td>
<td>
<div class="input-wrapper cell-content" id="end-cell">
<input class="not-required-input edit-form-input" type="text" id="ende_textbox" name="Ende" disabled @{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.End != null)
{
@Html.Raw("value=\"" + Model.SelectedServiceRecord.End.Value.ToString("HH:mm") + "\"")
}}/>
<label for="ende_textbox">Bis</label>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="input-wrapper cell-content">
<input class="not-required-input edit-form-input" type="text" id="duration_textbox" name="Dauer" disabled @{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.GroupRoundedDuration != null)
{
@Html.Raw("value=\"" + Model.SelectedServiceRecord.GroupRoundedDuration.Value.ToString("###0.#") + "\"")
}}/>
<label for="duration_textbox">Dauer</label>
</div>
</td>
</tr>
<tr @{
if(!Model.ShowDistanceField)
{
@Html.Raw("style='display: none;'")
}}>
<td colspan="2">
<div class="input-wrapper cell-content">
<input class="not-required-input edit-form-input" type="number" id="distance_textbox" name="Distanz" disabled @{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.DistanceInMeter != null)
{
@Html.Raw("value=\"" + Model.SelectedServiceRecord.DistanceInMeter + "\"")
}}/>
<label for="distance_textbox">Gefahrene Kilometer</label>
</div>
</td>
</tr>
<tr id="textModulesTr" @(MainModel.IsTextbausteineVisible ? Html.Raw("style='display: table-row;'") : Html.Raw("style='display: none;'"))>
<td colspan="2">
<input type="button" id="kollabier-btn2" class="toggle-btn" value="Textbausteine" onclick="showTextModulesPopup()" disabled />
</td>
</tr>
<tr id="trnormalDoku" style="display: none;">
<td colspan="2">
<div class="input-wrapper cell-content" id="divtrnormalDoku">
<textarea class="floating-label-input edit-form-input" id="notiz_textbox" name="Dokumentation6" required disabled>@{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null)
{
@Html.Raw(Model.SelectedServiceRecord.Notice)
}}</textarea>
<label class="floating-label" for="notiz_textbox" id="trnormalDokuLabel">Dokumentation</label>
</div>
</td>
</tr>
<tr>
<td colspan="2" id="tddokureiter">
<div class="input-wrapper cell-content" style="height: 90px;">
<article class="infobox">
<section id="Dokumentation1" style="display: none;">
<h2><a href="#Dokumentation1" onfocus="focusOnTab(1);" id="DokName1">Dok1</a>
</h2>
<textarea class="documentationTextArea edit-form-input" id="notiz_textbox1" name="Dokumentation" disabled>@{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Notice != null)
{
@Html.Raw(Model.SelectedServiceRecord.Notice)
}}</textarea>
</section>
<section id="Dokumentation2" style="display: none;">
<h2><a href="#Dokumentation2" onfocus="focusOnTab(2);" id="DokName2">Dok2</a>
</h2>
<textarea class="documentationTextArea edit-form-input" id="notiz_textbox2" name="Dokumentation2" disabled>@{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Notice2 != null)
{
@Html.Raw(Model.SelectedServiceRecord.Notice2)
}}</textarea>
</section>
<section id="Dokumentation3" style="display: none;">
<h2><a href="#Dokumentation3" onfocus="focusOnTab(3);" id="DokName3">Dok3</a>
</h2>
<textarea class="documentationTextArea edit-form-input" id="notiz_textbox3" name="Dokumentation3" disabled>@{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Notice3 != null)
{
@Html.Raw(Model.SelectedServiceRecord.Notice3)
}}</textarea>
</section>
<section id="Dokumentation4" style="display: none;">
<h2><a href="#Dokumentation4" onfocus="focusOnTab(4);" id="DokName4">Dok4</a>
</h2>
<textarea class="documentationTextArea edit-form-input" id="notiz_textbox4" name="Dokumentation4" disabled>@{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Notice4 != null)
{
@Html.Raw(Model.SelectedServiceRecord.Notice4)
}}</textarea>
</section>
<section id="Dokumentation5" style="display: none;">
<h2><a href="#Dokumentation5" onfocus="focusOnTab(5);" id="DokName5">Dok5</a>
</h2>
<textarea class="documentationTextArea edit-form-input" id="notiz_textbox5" name="Dokumentation5" disabled>@{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Notice5 != null)
{
@Html.Raw(Model.SelectedServiceRecord.Notice5)
}}</textarea>
</section>
</article>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<div class="input-wrapper cell-content">
<input type="text" id="datum_textbox" name="Datum" class="date-input-css floating-label-input" required disabled @{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Start != null) { @Html.Raw("value='" + Model.SelectedServiceRecord.Start.Value.ToString("dd.MM.yyyy") + "'") }} />
<label class="floating-label" for="datum_textbox">Startdatum</label>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="input-wrapper cell-content" id="EndDate_div" style="display: none">
<input type="text" id="enddatum_textbox" name="Enddatum" class="date-input-css floating-label-input edit-form-input" required disabled onchange="actualDurationWithEndDate()" @{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.End != null) { @Html.Raw("value='" + Model.SelectedServiceRecord.End.Value.ToString("dd.MM.yyyy") + "'") }} />
<label class="floating-label" for="enddatum_textbox">Enddatum</label>
</div>
</td>
</tr>
<tr id="zeiterfassungsErrorTableRow">
<td colspan="2" id="zeiterfassungsErrorTableCell">
<h4 id="zeiterfassungsErrorDisplay" class="error-text"></h4>
</td>
</tr>
<tr>
<td>
<div class="input-wrapper cell-content" id="start-cell">
<input class="not-required-input edit-form-input" type="text" id="start_textbox" name="Start" disabled @{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Start != null) { @Html.Raw("value=\"" + Model.SelectedServiceRecord.Start.Value.ToString("HH:mm") + "\"") }} />
<label for="start_textbox">Von</label>
</div>
</td>
<td>
<div class="input-wrapper cell-content" id="end-cell">
<input class="not-required-input edit-form-input" type="text" id="ende_textbox" name="Ende" disabled @{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.End != null) { @Html.Raw("value=\"" + Model.SelectedServiceRecord.End.Value.ToString("HH:mm") + "\"") }} />
<label for="ende_textbox">Bis</label>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="input-wrapper cell-content">
<input class="not-required-input edit-form-input" type="text" id="duration_textbox" name="Dauer" disabled @{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.GroupRoundedDuration != null) { @Html.Raw("value=\"" + Model.SelectedServiceRecord.GroupRoundedDuration.Value.ToString("###0.#") + "\"") }} />
<label for="duration_textbox">Dauer</label>
</div>
</td>
</tr>
<tr @{ if(!Model.ShowDistanceField) { @Html.Raw("style='display: none;'") }}>
<td colspan="2">
<div class="input-wrapper cell-content">
<input class="not-required-input edit-form-input" type="number" id="distance_textbox" name="Distanz" disabled @{if(Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.DistanceInMeter != null) { @Html.Raw("value=\"" + Model.SelectedServiceRecord.DistanceInMeter + "\"") }} />
<label for="distance_textbox">Gefahrene Kilometer</label>
</div>
</td>
</tr>
<tr id="textModulesTr" @(MainModel.IsTextbausteineVisible ? Html.Raw("style='display: table-row;'") : Html.Raw("style='display: none;'"))>
<td colspan="2">
<input type="button" id="kollabier-btn2" class="toggle-btn" value="Textbausteine" onclick="showTextModulesPopup()" disabled />
</td>
</tr>
<tr id="trnormalDoku" style="display: none;">
<td colspan="2">
<div class="input-wrapper cell-content" id="divtrnormalDoku">
<textarea class="floating-label-input edit-form-input" id="notiz_textbox" name="Dokumentation6" required disabled>@{if (Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null){@Html.Raw(Model.SelectedServiceRecord.Notice)}}</textarea>
<label class="floating-label" for="notiz_textbox" id="trnormalDokuLabel">Dokumentation</label>
</div>
</td>
</tr>
<tr>
<td colspan="2" id="tddokureiter">
<div class="input-wrapper cell-content">
<div class="doku-tab">
<button class="doku-tab-link" id="doku-name-1" onclick="focusOnDoku(1)" disabled></button>
<button class="doku-tab-link" id="doku-name-2" onclick="focusOnDoku(2)" disabled></button>
<button class="doku-tab-link" id="doku-name-3" onclick="focusOnDoku(3)" disabled></button>
<button class="doku-tab-link" id="doku-name-4" onclick="focusOnDoku(4)" disabled></button>
<button class="doku-tab-link" id="doku-name-5" onclick="focusOnDoku(5)" disabled></button>
</div>
<table style="width: auto; float: right;">
<tr>
<td>
<input type="text" style="display: none" id="GeoLocSaveXCOOR" name="GeoLocSaveXCOOR"/>
</td>
<td>
<input type="text" style="display: none" id="GeoLocSaveYCOOR" name="GeoLocSaveYCOOR"/>
</td>
<td>
<input type="text" style="display: none" id="TimeStampSave" name="TimeStampSave"/>
</td>
<td>
<input type="text" style="display: none" id="URLSave" name="URLSave"/>
</td>
<td class="an-ie-angepasste-tabelle">
<input type="button" value="Abbrechen" class="anlegen-btn" id="abbrechenBtn" onclick="resetRecordForm();" disabled/>
</td>
<td class="an-ie-angepasste-tabelle">
<input type="hidden" id="versteckt" name="versteckt" @(MainModel.IsOnlyAllowedToEdit || Model.IsInGroupBookingMode && Model.IsInEditingMode ? Html.Raw("value=\"Speichern\"") : Html.Raw("value=\"Anlegen\""))/>
<input type="button" @(MainModel.IsOnlyAllowedToEdit || Model.IsInGroupBookingMode && Model.IsInEditingMode ? Html.Raw("value=\"Speichern\"") : Html.Raw("value=\"Anlegen\"")) class="anlegen-btn" name="anlegenEditierenBtn" id="anlegenEditierenBtn" onclick="saveCreateServicerecod();" disabled/>
</td>
</tr>
</table>
}
</div>
<div class="doku-tab-content" id="doku-tab-content-1">
<textarea class="documentationTextArea edit-form-input" id="notiz_textbox1" name="Dokumentation" disabled>@{if (Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Notice != null){@Html.Raw(Model.SelectedServiceRecord.Notice)}}</textarea>
</div>
<div class="doku-tab-content" id="doku-tab-content-2">
<textarea class="documentationTextArea edit-form-input" id="notiz_textbox2" name="Dokumentation2" disabled>@{if (Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Notice2 != null){@Html.Raw(Model.SelectedServiceRecord.Notice2)}}</textarea>
</div>
<div class="doku-tab-content" id="doku-tab-content-3">
<textarea class="documentationTextArea edit-form-input" id="notiz_textbox3" name="Dokumentation3" disabled>@{if (Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Notice3 != null){@Html.Raw(Model.SelectedServiceRecord.Notice3)}}</textarea>
</div>
<div class="doku-tab-content" id="doku-tab-content-4">
<textarea class="documentationTextArea edit-form-input" id="notiz_textbox4" name="Dokumentation4" disabled>@{if (Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Notice4 != null){@Html.Raw(Model.SelectedServiceRecord.Notice4)}}</textarea>
</div>
<div class="doku-tab-content" id="doku-tab-content-5">
<textarea class="documentationTextArea edit-form-input" id="notiz_textbox5" name="Dokumentation5" disabled>@{if (Model.IsInEditingMode && Model.IsInGroupBookingMode && Model.SelectedServiceRecord != null && Model.SelectedServiceRecord.Notice5 != null){@Html.Raw(Model.SelectedServiceRecord.Notice5)}}</textarea>
</div>
</div>
</td>
</tr>
</table>
<table style="width: auto; float: right;">
<tr>
<td>
<input type="text" style="display: none" id="GeoLocSaveXCOOR" name="GeoLocSaveXCOOR" />
</td>
<td>
<input type="text" style="display: none" id="GeoLocSaveYCOOR" name="GeoLocSaveYCOOR" />
</td>
<td>
<input type="text" style="display: none" id="TimeStampSave" name="TimeStampSave" />
</td>
<td>
<input type="text" style="display: none" id="URLSave" name="URLSave" />
</td>
<td class="an-ie-angepasste-tabelle">
<input type="button" value="Abbrechen" class="anlegen-btn" id="abbrechenBtn" onclick="resetRecordForm();" disabled />
</td>
<td class="an-ie-angepasste-tabelle">
<input type="hidden" id="versteckt" name="versteckt" @(MainModel.IsOnlyAllowedToEdit || Model.IsInGroupBookingMode && Model.IsInEditingMode ? Html.Raw("value=\"Speichern\"") : Html.Raw("value=\"Anlegen\"")) />
<input type="button" @(MainModel.IsOnlyAllowedToEdit || Model.IsInGroupBookingMode && Model.IsInEditingMode ? Html.Raw("value=\"Speichern\"") : Html.Raw("value=\"Anlegen\"")) class="anlegen-btn" name="anlegenEditierenBtn" id="anlegenEditierenBtn" onclick="saveCreateServicerecod();" disabled />
</td>
</tr>
</table>
}
</div>
<input value="@Model.SaveSignature.ToString()" type="hidden" id="SaveSignature" />
<input type="hidden" id="Leistung" />
@using (Html.BeginForm("LoadServiceRecords", "Main", FormMethod.Post, new { id = "selectSCForm2" }))
@{
var shouldShowServiceRecordList = "display: block";
if(Model.IsInGroupBookingMode && !Model.IsInEditingMode)
{
shouldShowServiceRecordList = "display: none";
}
}
@using(Html.BeginForm("LoadServiceRecords", "Main", FormMethod.Post, new { id = "selectSCForm2", style = shouldShowServiceRecordList }))
{
<div class="combobox-label-parent" id="recordLoader_select_container" style="min-width: 120px">
<div class="styled-select-div" id="record-loader-select-container">
<select class="dropdownlist-for" id="recordLoader_select" onchange="showSanduhr();$('#serviceRecords').empty();this.form.submit();" name="Records">
<div class="disabled-select-container" id="record-loader-select-container">
<select class="dropdownlist-for" id="recordLoader_select" onchange="showSanduhr();$('#serviceRecords').empty();this.form.submit();" name="Records" disabled>
<option value="-1"></option>
<option value="7" @{if (Model.Zeitraum == 7) { @Html.Raw("selected") }}>Letzte 7 Tage</option>
<option value="30" @{if (Model.Zeitraum == 30) { @Html.Raw("selected") }}>Letzte 30 Tage</option>
<option value="90" @{if (Model.Zeitraum == 90) { @Html.Raw("selected") }}>Letzte 90 Tage</option>
<option value="0" @{if (Model.Zeitraum == 0) { @Html.Raw("selected") }}>Alle</option>
<option value="7" @{if(Model.Zeitraum == 7) { @Html.Raw("selected") }}>Letzte 7 Tage</option>
<option value="30" @{if(Model.Zeitraum == 30) { @Html.Raw("selected") }}>Letzte 30 Tage</option>
<option value="90" @{if(Model.Zeitraum == 90) { @Html.Raw("selected") }}>Letzte 90 Tage</option>
<option value="0" @{if(Model.Zeitraum == 0) { @Html.Raw("selected") }}>Alle</option>
</select>
</div>
</div>
@@ -410,22 +296,29 @@
<hr />
<div class="margin-div" id="serviceRecords">
<div class="margin-div" id="serviceRecords" style="@shouldShowServiceRecordList">
@foreach(var record in Model.ServiceRecords)
{
<div class="collapsible-container">
<input type="button" class="toggle-btn" value="@{
if (record.Start.Value.Second == 0)
{
if(record.Start.Value.Date != record.End.Value.Date) {
@(record.Start.Value.ToString("dd.MM.yyyy") + " "+ record.Start.Value.ToString(" HH:mm") + " - " + record.End.Value.ToString("dd.MM.yyyy") + " " + record.End.Value.ToString("HH:mm"))
<input type="button" class="toggle-btn" value="@{
var gruppenInfo = "";
if (record.GroupOid != null)
{
gruppenInfo += " Gruppe (" + record.GroupPersonCount + " Teilnehmer, " + record.GroupEmployeeCount + " Betreuer) Dauer: " + (record.End.Value - record.Start.Value).TotalMinutes;
}
if (record.Start.Value.Second == 0)
{
if(record.Start.Value.Date != record.End.Value.Date) {
@(record.Start.Value.ToString("dd.MM.yyyy") + " "+ record.Start.Value.ToString(" HH:mm") + " - " + record.End.Value.ToString("dd.MM.yyyy") + " " + record.End.Value.ToString("HH:mm") + (record.GroupOid != null ? gruppenInfo : ""))
} else {
@(record.Start.Value.ToString("dd.MM.yyyy") + " " + record.Start.Value.ToString(" HH:mm") + " - " + record.End.Value.ToString("HH:mm"))
@(record.Start.Value.ToString("dd.MM.yyyy") + " " + record.Start.Value.ToString(" HH:mm") + " - " + record.End.Value.ToString("HH:mm") + (record.GroupOid != null ? gruppenInfo : ""))
}
}
else
{
@(record.Start.Value.ToShortDateString())
@(record.Start.Value.ToShortDateString() + (record.GroupOid != null ? gruppenInfo : ""))
}
}" @(record.GroupOid != null ? Html.Raw("style=\"background-color: #FDC784;\"") : Html.Raw("")) />
<div style="display: none;" @(record.GroupOid != null ? Html.Raw("class=\"kollabierbarGruppenbuchung\"") : Html.Raw("class=\"kollabierbar\""))>
@@ -652,6 +545,7 @@
<div id="popupBtnDiv" class="center-aligned-text-element">
@using (Html.BeginForm("DeleteServiceRecord", "Main", FormMethod.Post, new { id = "deletionForm" }))
{
<input type="hidden" name="serviceRecordOidHolder" id="oidHolder" />
<input type="button" class="popupBtn" value="OK" onclick="submitDeletionForm()" />
<input type="button" class="popupBtn" value="Abbrechen" onclick="togglePopup()" />
}
@@ -691,6 +585,81 @@
</div>
</div>
<div id="groupBookingPopupDivContainer" class="see-thru-popup-container" onclick="hideGroupBookingPopup()"></div>
<div id="groupBookingPopupDiv" class="group-booking-popup-div">
<div id="groupBookingCollapsible" class="collapsible-group-booking">
<div class="group-booking-tab">
<button id="leftBtn" class="tab-links" onclick="openGroupBookingTab(true)">Hilfepläne</button>
<button id="rightBtn" class="tab-links" onclick="openGroupBookingTab(false)">Gruppen</button>
</div>
@using(Html.BeginForm("AddSupportConceptsToGroupBooking", "Main", FormMethod.Post, new { id = "groupBookingSupportConceptSelectionForm" }))
{
var i = 0;
var j = 0;
<div id="leftContent" class="tab-content">
<table>
@foreach(var hp in Model.SupporConceptListItemsForGroupBooking)
{
<tr>
<td style="width: 1px; white-space: nowrap;">
<input type="checkbox" value="@hp.Value" name="costbearer2supportconcept_@i"
@if(Model.SelectedCostbearerRelOids.Contains(long.Parse(hp.Value))) { @Html.Raw("checked=\"checked\"") } />
</td>
<td class="group-booking-text-cell">
@hp.Text
</td>
</tr>
i++;
}
</table>
</div>
<div id="rightContent" class="tab-content">
<table>
@foreach(var gruppe in Model.GroupOfPeopleListItems)
{
<tr>
<td style="width: 1px; white-space: nowrap;">
<input type="checkbox" value="@gruppe.Value" name="group_@j"
@if(Model.SelectedGroupOfPeopleOids.Contains(long.Parse(gruppe.Value))) { @Html.Raw("checked=\"checked\"") } />
</td>
<td class="group-booking-text-cell">
@gruppe.Text
</td>
</tr>
j++;
}
</table>
</div>
}
</div>
<input type="button" onclick="addSupportConcepts()" value="Hinzufügen" />
</div>
<div id="employeePopupContainer" class="see-thru-popup-container" onclick="hideEmployeePopup()"></div>
<div id="employeePopupDiv" class="group-booking-popup-div">
<div id="employeeCollapsible" class="collapsible-group-booking">
@using(Html.BeginForm("AddEmployeesToGroupBooking", "Main", FormMethod.Post, new { id = "groupBookingEmployeeSelectionForm" }))
{
var i = 0;
<table id="groupBookingEmployeeTable">
@foreach(var ma in Model.EmployeeListItems)
{
<tr>
<td style="width: 1px; white-space: nowrap;">
<input type="checkbox" value="@ma.Value" name="employee_@i" @if(Model.SelectedEmployees.Any(a => long.Parse(ma.Value).Equals(a.EmployeeOid))) { @Html.Raw("checked=\"checked\"") } />
</td>
<td class="group-booking-text-cell">
@ma.Text
</td>
</tr>
i++;
}
</table>
}
</div>
<input type="button" onclick="addEmployees()" value="Hinzufügen" />
</div>
<div id="klienten">
<div class="combobox-label-parent">
@Html.LabelFor(m => m.SelectedCustomerOid)
@@ -796,36 +765,42 @@
</tr>
</table>
</div>
<!--############################################## Wohnheim gedöns #####################################################################################
<div class="eigenschaftsdiv" id="WohnheimContainer">
<h4>Wohnheim zugehörigkeit</h4>
<hr />
<table class="width-inheriting-table">
<tr>
<td class="customer-td">Name:</td>
<td class="contentTd" >a</td><!--data-bind="text: WohnheimName"
</tr>
<tr>
<td class="customer-td">Strasse:</td>
<td class="contentTd" >e</td>
</tr>
<tr>
<td class="customer-td">Postleitzahl:</td>
<td class="contentTd" >i</td>
</tr>
<tr>
<td class="customer-td">Ort:</td>
<td class="contentTd" >o</td>
</tr>
<tr>
<td class="customer-td">Bemerkung:</td>
<td class="contentTd" data-bind="text: WohnheimName" >u</td>
</tr>
</table>
</div>-->
<!--############################################## Wohnheim gedöns #####################################################################################
<div class="eigenschaftsdiv" id="WohnheimContainer">
<h4>Wohnheim zugehörigkeit</h4>
<hr />
<table class="width-inheriting-table">
<tr>
<td class="customer-td">Name:</td>
<td class="contentTd" >a</td><!--data-bind="text: WohnheimName"
</tr>
<tr>
<td class="customer-td">Strasse:</td>
<td class="contentTd" >e</td>
</tr>
<tr>
<td class="customer-td">Postleitzahl:</td>
<td class="contentTd" >i</td>
</tr>
<tr>
<td class="customer-td">Ort:</td>
<td class="contentTd" >o</td>
</tr>
<tr>
<td class="customer-td">Bemerkung:</td>
<td class="contentTd" data-bind="text: WohnheimName" >u</td>
</tr>
</table>
</div>-->
</div>
<div style="padding-right: 1em;" id="kommentarContainer">
<h4 style="display: inline; color: #AB4A07;">Kommentar</h4>
<hr />
<pre data-bind="text: kommentar"></pre>
</div>
<div style="padding-right: 1em;" id="umfeldContainer">
<h4 style="display: inline; color: #AB4A07;">Umfeld</h4>
<hr />
@@ -835,46 +810,47 @@
<div style="display: none;" class="kollabierbar">
<table class="width-inheriting-table">
<tbody>
<tr class="testklasse">
<td class="customer-td">Rolle:</td>
<td class="contentTd" data-bind="text: umfrolle"></td>
</tr>
<tr class="testklasse">
<td class="customer-td">Adresse:</td>
<td class="contentTd" data-bind="text: umfstrnr"></td>
</tr>
<tr class="testklasse">
<td class="customer-td"></td>
<td class="contentTd" data-bind="text: umfplzort"></td>
</tr>
<tr class="testklasse">
<td class="customer-td">Tel.:</td>
<td class="contentTd">
<a style="color: black" data-bind="attr: { href: umftelnr, title: nurtelnr }, text: nurtelnr"></a>
</td>
</tr>
<tr class="testklasse">
<td class="customer-td">Mobil:</td>
<td class="contentTd">
<a style="color: black" data-bind="attr: { href: umfmobil, title: nurmobil }, text: nurmobil"></a>
</td>
</tr>
<tr class="testklasse">
<td class="customer-td">E-Mail</td>
<td class="contentTd">
<a style="color: black" data-bind="attr: { href: umfemail, title: nuremail }, text: nuremail"></a>
</td>
</tr>
<tr class="testklasse">
<td class="customer-td">Fax:</td>
<td class="contentTd" data-bind="text: umffax"></td>
</tr>
<tr class="testklasse">
<td class="customer-td">Rolle:</td>
<td class="contentTd" data-bind="text: umfrolle"></td>
</tr>
<tr class="testklasse">
<td class="customer-td">Adresse:</td>
<td class="contentTd" data-bind="text: umfstrnr"></td>
</tr>
<tr class="testklasse">
<td class="customer-td"></td>
<td class="contentTd" data-bind="text: umfplzort"></td>
</tr>
<tr class="testklasse">
<td class="customer-td">Tel.:</td>
<td class="contentTd">
<a style="color: black" data-bind="attr: { href: umftelnr, title: nurtelnr }, text: nurtelnr"></a>
</td>
</tr>
<tr class="testklasse">
<td class="customer-td">Mobil:</td>
<td class="contentTd">
<a style="color: black" data-bind="attr: { href: umfmobil, title: nurmobil }, text: nurmobil"></a>
</td>
</tr>
<tr class="testklasse">
<td class="customer-td">E-Mail</td>
<td class="contentTd">
<a style="color: black" data-bind="attr: { href: umfemail, title: nuremail }, text: nuremail"></a>
</td>
</tr>
<tr class="testklasse">
<td class="customer-td">Fax:</td>
<td class="contentTd" data-bind="text: umffax"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="Kalender">
@@ -961,6 +937,15 @@
</div>
</div>
<div id="validationPopupDiv">
<h4 id="validationPopupTitle" class="center-aligned-text-element" style="padding-top: 0;">Validierung</h4>
<p id="validationPopupText" class="center-aligned-text-element"></p>
<div id="validationPopupBtnDiv" class="center-aligned-text-element" style="margin: 0; padding: 0;">
<input type="button" id="validationBtn1" class="popupBtn" value="OK" onclick="submitCreationForm()" />
<input type="button" id="validationBtn2" class="popupBtn" value="Abbrechen" onclick="hideValidationPopup()" />
</div>
</div>
<input value="@Html.Raw("false")" id="AenderePopupDivSchalter" type="hidden" />
<div id="UnterschriftBereich" style="display: none" align="center">
@@ -973,14 +958,17 @@
<input class="floating-label-input" id="UnterschriftDatum" readonly name="Datum/Uhrzeit" />
<input id="SaveRecordOID" readonly name="OID" style="display: none" />
<p id="Geologie"></p>
<input type="button" style="width: 100px;" onclick="loescheUnterschrift(canvas, ctx)" value="Neu" />
<input type="button" style="width: 100px;" onclick="speichereUnterschrift()" value="Speichern" />
<input type="button" style="width: 100px;" onclick="backToZeiterfassung()" value="Abbrechen" />
</div>
<div>
<canvas id="sketchpad" height="150" style="cursor: default; border-color: black" width="325"></canvas>
<canvas id="sketchpad" height="150" style="cursor: default; border-color: black; margin-top: 1em;" width="325"></canvas>
</div>
<p id="Geologie"></p>
<input type="button" style="width: 100px;" onclick="loescheUnterschrift(canvas, ctx)" value="Neu" />
<input type="button" style="width: 100px;" onclick="speichereUnterschrift()" value="Speichern" />
<input type="button" style="width: 100px;" onclick="backToZeiterfassung()" value="Abbrechen" />
</div>
<div id="SupportStatistik" style="display: none" align="center" >
@@ -1041,14 +1029,15 @@
SetSaveSignatureUrl = '@Url.Action("SetSaveSignature")';
loadTextbausteineForCategoryUrl = '@Url.Action("LoadTextbausteineForServiceCategory")';
loadCompleteTextbausteinByOidUrl = '@Url.Action("LoadCompleteTextbausteinByOid")';
addSupportConceptForGruppenbuchungUrl = '@Url.Action("AddSupportConceptToGruppenbuchung")';
addEmployeeForGruppenbuchungUrl = '@Url.Action("AddEmployeeToGruppenbuchung")';
removeSupportConceptFromGruppenbuchungUrl = '@Url.Action("RemoveSupportConceptFromGruppenbuchung")';
removeEmployeeFromGruppenbuchungUrl = '@Url.Action("RemoveEmployeeFromGruppenbuchung")';
setGroupbookinModeUrl = '@Url.Action("SetGroupBookingMode")';
setSelectedGroupServiceRecordUrl = '@Url.Action("SetSelectedGroupServiceRecord")';
resetEditingModeUrl = '@Url.Action("ResetEditingMode")';
loadCategoryAndDescriptionUrl = '@Url.Action("LoadCategoryAndDescription")';
addEmployeesToGroupBookingUrl = '@Url.Action("AddEmployeesToGroupBooking")';
resetGroupBookingModeViaGETUrl = '@Url.Action("ResetGroupBookingModeViaGET")';
var isServiceRecordNoticeMandatory = '@(Model.IsServiceRecordNoticeMandatory)'.toLowerCase() === "true";
focusedDokuTextarea = null;

View File

@@ -18,12 +18,15 @@
<script src="~/Scripts/datepicker.js?v=1.2"></script>
<script src="~/Scripts/initialization.js?v=1.2"></script>
<script src="~/Scripts/calendar.js?v=1.2"></script>
<script src="~/Scripts/statistics.js?v=1.2"></script>
<script src="~/Scripts/statistics.js"></script>
<script src="~/Scripts/gruppenbuchung.js?v=1.2"></script>
<script src="~/Scripts/dateHelper.js?v=1.2"></script>
<script src="~/Scripts/Chart.min.js?v=1.2"></script>
<script src="https://ajax.aspnetcdn.com/ajax/knockout/knockout-3.0.0.js"></script>
<script>$(function () { $(".date-input-css").datepicker(); })</script>
<script src="~/Scripts/textbausteine.js?v=1.0"></script>
<script src="~/Scripts/serviceRecordValidation.js?v=1.0"></script>
<script src="~/Scripts/unterschrift.js?v=1.0"></script>
</head>
<body>
@RenderBody()

View File

@@ -119,7 +119,7 @@
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
<!--<add key="MultitenancyPath" value="D:\Projects\BeWo\Host\Multitenancy\"/>-->
<add key="MultitenancyPath" value="D:\Projects\beyondSoft\BeWoPlaner\BeWo\Host\Multitenancy\"/>
<add key="MultitenancyPath" value="C:\Users\Lyndon\Documents\beyondSoft\BeWo\Host\Multitenancy\"/>
<add key="LicenseInfoUrl" value="https://support.bewoplaner.de/api/getlicensecount.php?k=[TENANT]" />
<add key="LicenseOrderUrl" value="https://support.bewoplaner.de/lizenzbestellung/?k=[TENANT]" />
<add key="LicenseCancellationUrl" value="https://support.bewoplaner.de/api/licencecancellation.php?k=[TENANT]" />

View File

@@ -17,12 +17,16 @@ using NHibernate.SqlCommand;
using BS.Shared.Core;
using BS.Shared;
using BS.Shared.DataContracts;
using static System.String;
using Login = BeWo.Data.Entities.Login;
namespace BeWo.Data.Access
{
public class SearchDAO : AbstractBaseDAO
{
private static Regex RecurrenceIdRegex = new Regex("(Id=\\\"[a-z0-9-]+\\\")");
public IEnumerable<ValueListEntry> FindValueListEntry(ValueListEntryType pType)
{
return CreateCriteria<ValueListEntry>().Add(Restrictions.Eq(ValueListEntry.PropertyName_Type, pType)).AddOrder(Order.Asc(ValueListEntry.PropertyName_Value)).List<ValueListEntry>();
@@ -45,7 +49,7 @@ namespace BeWo.Data.Access
public virtual Employee FindEmployeeByFullname(string pFullname)
{
var q = Session.CreateSQLQuery(string.Format("SELECT Oid FROM Person WHERE CONCAT_WS(' ', FirstName, LastName) LIKE '%{0}%'", pFullname));
var q = Session.CreateSQLQuery(Format("SELECT Oid FROM Person WHERE CONCAT_WS(' ', FirstName, LastName) LIKE '%{0}%'", pFullname));
var x = q.List<long>();
return x.Count > 0 ? DAOFactory.GenericDAO.GetByID<Employee>(x.First()) : null;
@@ -63,7 +67,7 @@ namespace BeWo.Data.Access
public virtual Wohnheim FindWohnheimByFullname(string pWohnheimName)
{
var q = Session.CreateSQLQuery(string.Format("SELECT Oid FROM Wohnheim WHERE CONCAT_WS(' ', WohnheimName) LIKE '%{0}%'", pWohnheimName));
var q = Session.CreateSQLQuery(Format("SELECT Oid FROM Wohnheim WHERE CONCAT_WS(' ', WohnheimName) LIKE '%{0}%'", pWohnheimName));
var x = q.List<long>();
return x.Count > 0 ? DAOFactory.GenericDAO.GetByID<Wohnheim>(x.First()) : null;
@@ -411,7 +415,7 @@ namespace BeWo.Data.Access
lCriteria = lCriteria.CreateCriteria(SupportConcept.PropertyName_Customer, JoinType.InnerJoin);
if (!String.IsNullOrEmpty(pCustomerReferenceNumber))
if (!IsNullOrEmpty(pCustomerReferenceNumber))
lCriteria.Add(Restrictions.Eq(Customer.PropertyName_ReferenceNumber, pCustomerReferenceNumber));
if (!Utils.AreAllNullOrEmpty(pCustomerFirstName, pCustomerLastName))
@@ -1437,40 +1441,124 @@ namespace BeWo.Data.Access
public IEnumerable<SchedulerAppointment> GetAllActiveAppointmentsForEmployeeInInterval2(DateTime start, DateTime end, List<long> pEmployeeOids)
{
var detachedCriteria = DetachedCriteria.For<Employee2SchedulerAppointment>()
.Add(Restrictions.And(Restrictions.In(Employee2SchedulerAppointment.PropertyName_Employee + ".Oid", pEmployeeOids),
Restrictions.Not(Restrictions.Eq(Employee2SchedulerAppointment.PropertyName_ParticipationAnswer, ParticipationAnswer.Absage))));
detachedCriteria.SetProjection(Projections.Property(Employee2SchedulerAppointment.PropertyName_SchedulerAppointment));
var mainCriteria = CreateRecurrenceCriteria(start, end);
var hasResources = $"{BeWoEntityBase.PropertyName_Oid} IN (SELECT newschappoid FROM resource2newschapp)";
var detachedCriteria2 = DetachedCriteria.For<Employee2SchedulerAppointment>()
var detachedCriteria1 = DetachedCriteria.For<Employee2SchedulerAppointment>()
.Add(Restrictions.In(Employee2SchedulerAppointment.PropertyName_Employee + ".Oid", pEmployeeOids))
.SetProjection(Projections.Property(Employee2SchedulerAppointment.PropertyName_SchedulerAppointment));
var employee2SchedCrit = Subqueries.PropertyIn(BeWoEntityBase.PropertyName_Oid, detachedCriteria1);
var ownAppointmentCriterion = Restrictions.Or(
Restrictions.And(Restrictions.In(Employee2SchedulerAppointment.PropertyName_Employee + ".Oid", pEmployeeOids), Subqueries.PropertyNotIn(BeWoEntityBase.PropertyName_Oid, detachedCriteria2)),
Subqueries.PropertyIn(BeWoEntityBase.PropertyName_Oid, detachedCriteria));
var originatorCrit = Restrictions.In(SchedulerAppointment.PropertyName_Originator, pEmployeeOids);
var detachedCriteria2 = DetachedCriteria.For<Employee2SchedulerAppointment>("e2s2")
.SetProjection(Projections.Property(BeWoEntityBase.PropertyName_Oid))
.Add(Restrictions.EqProperty("e2s2." + Employee2SchedulerAppointment.PropertyName_SchedulerAppointment, "sa.Oid"));
var criteria = CreateRecurrenceCriteria(start, end)
.Add(Restrictions.Or(
Expression.Sql(new SqlString(hasResources)),
ownAppointmentCriterion));
var employee2SchedCrit2 = Subqueries.NotExists(detachedCriteria2);
return criteria.List<SchedulerAppointment>();
var and = Restrictions.And(originatorCrit, employee2SchedCrit2);
ICriterion employeeCriterion = Restrictions.Or(employee2SchedCrit, and);
mainCriteria.Add(employeeCriterion);
var appointments = mainCriteria.List<SchedulerAppointment>();
var exceptionalRecurrenceInfos = appointments.Where(w => w.RecurrenceInfo != null && w.Type == 3).ToList();
var exceptionIds = new List<long>();
var regex = new Regex("(Id=\\\"[a-z0-9-]+\\\")");
foreach(var appointment in exceptionalRecurrenceInfos)
{
var match = regex.Match(appointment.RecurrenceInfo);
if(match.Success)
{
var value = match.Value;
var actualId = value.Split("\"");
if(actualId.Count > 1)
{
var id = actualId[1];
if(!appointments.Any(w => w.RecurrenceInfo != null && w.RecurrenceInfo.Contains(id) && w.Type == 1))
{
exceptionIds.Add(appointment.Oid.Value);
}
}
}
}
var exceptionsToModify = appointments.Where(w => w.Oid.HasValue && exceptionIds.Contains(w.Oid.Value)).ToList();
foreach(var exception in exceptionsToModify)
{
var replacingAppointment = new SchedulerAppointment
{
Oid = exception.Oid.Value * -1,
Version = 1,
Type = 4,
RecurrenceInfo = exception.RecurrenceInfo,
Originator = exception.Originator,
EmployeeList = exception.EmployeeList,
CustomerList = exception.CustomerList,
ResourceList = exception.ResourceList
};
exception.RecurrenceInfo = null;
exception.Type = 0;
appointments.Add(replacingAppointment);
}
var recurrenceIds = new List<string>();
var allExceptionalRecurrenceInfos = appointments.Where(w => w.RecurrenceInfo != null);
foreach(var appointment in allExceptionalRecurrenceInfos)
{
var match = regex.Match(appointment.RecurrenceInfo);
if(match.Success)
{
var value = match.Value;
var actualId = value.Split("\"");
if(actualId.Count > 1)
{
recurrenceIds.AddIfNotIn(actualId[1]);
}
}
}
var changedOrDeletedOccurences = FindAppointmentsByRecurrenceId(recurrenceIds, true);
appointments.AddRangeIfElementsNotIn(changedOrDeletedOccurences);
return appointments;
}
public IEnumerable<long> FilterEmployeesWithAppointments(List<long> pEmployeeOids, DateTime pStartTime, DateTime pEndTime)
{
// Testzeitraum vom 10.08.2015 18:00 bis zum 10.08.2015 18:30
var result = new List<long>();
var appointments = GetAllActiveAppointmentsForEmployeeInInterval2(pStartTime, pEndTime, pEmployeeOids);
var gefilterteTermine = appointments.Where(w => w.EmployeeList.Select(s => s.Employee.Oid.Value).Intersect(pEmployeeOids).Any() || !w.EmployeeList.Select(s => s.Employee.Oid.Value).Intersect(pEmployeeOids).Any() && pEmployeeOids.Contains(w.Originator.Oid.Value));
foreach (var x in gefilterteTermine)
{
result.AddRangeIfElementsNotIn(x.EmployeeList.Select(s => s.Oid.Value));
result.AddIfNotIn(x.Originator.Oid.Value);
}
var employee2SchedulerAppointmentsList = gefilterteTermine.Select(s => s.EmployeeList).ToList();
foreach(var employee2SchedulerAppointments in employee2SchedulerAppointmentsList)
{
foreach(var employee2SchedulerAppointment in employee2SchedulerAppointments)
{
if(employee2SchedulerAppointment.Employee.Oid.HasValue && !result.Contains(employee2SchedulerAppointment.Employee.Oid.Value))
{
result.Add(employee2SchedulerAppointment.Employee.Oid.Value);
}
}
}
foreach(var originator in gefilterteTermine.Select(s => s.Originator))
{
if(originator.Oid.HasValue && !result.Contains(originator.Oid.Value))
{
result.Add(originator.Oid.Value);
}
}
var c = CreateCriteria<AbsenceTime>()
.Add(Restrictions.In(AbsenceTime.PropertyName_EmployeeOid, pEmployeeOids))
@@ -1494,7 +1582,7 @@ namespace BeWo.Data.Access
var abwesenheiten = c.List<AbsenceTime>();
foreach (var abwesenheit in abwesenheiten)
foreach(var abwesenheit in abwesenheiten)
{
result.AddIfNotIn(abwesenheit.EmployeeOid.Value);
}
@@ -1516,7 +1604,7 @@ namespace BeWo.Data.Access
var c = CreateCriteriaIsActive<Wohnheimbuchung>();
c.Add(Restrictions.Eq(Wohnheimbuchung.PropertyName_Buchungsdatum, pBuchungsdatum))
.Add(Restrictions.Eq(String.Format("{0}.Oid", Wohnheimbuchung.PropertyName_Wohnheim), pWohnheimOid));
.Add(Restrictions.Eq(Format("{0}.Oid", Wohnheimbuchung.PropertyName_Wohnheim), pWohnheimOid));
return c.UniqueResult<Wohnheimbuchung>();
}
@@ -1947,7 +2035,7 @@ namespace BeWo.Data.Access
.Add(Restrictions.Eq(ChatMessage.PropertyName_TeamOid, pRecipientOid));
}
if (!string.IsNullOrEmpty(pMessageId))
if (!IsNullOrEmpty(pMessageId))
{
var c1 = CreateCriteriaIsActive<ChatMessage>()
.Add(Restrictions.Eq(ChatMessage.PropertyName_MessageId, pMessageId))
@@ -2185,7 +2273,7 @@ namespace BeWo.Data.Access
public IList<SchedulerAppointment> LoadFilteredAppointments(bool pHasRightToSeeAllEmployeeAppointments, long pEmployeeOid, DateTime pIntervalStart, DateTime pIntervalEnd, List<long> pSelectedEmployees, List<long> pSelectedCustomers, List<long> pSelectedResources, bool pEmployeesOnly, bool pCustomersOnly, bool pResourcesOnly, bool pPrivateAppointmentsOnly, bool pOnlyMyAppointments, bool pIncludeInactiveOnes)
{
var recurrenceBetween = string.Format("'{0:yyyy-MM-dd} 00:00:00' BETWEEN STR_TO_DATE(SUBSTRING({1}, 24, 19), '%m/%d/%Y %H:%i:%s') AND STR_TO_DATE(SUBSTRING({1}, 50, 19), '%m/%d/%Y %H:%i:%s')", pIntervalStart, SchedulerAppointment.PropertyName_RecurrenceInfo);
var recurrenceBetween = Format("'{0:yyyy-MM-dd} 00:00:00' BETWEEN STR_TO_DATE(SUBSTRING({1}, 24, 19), '%m/%d/%Y %H:%i:%s') AND STR_TO_DATE(SUBSTRING({1}, 50, 19), '%m/%d/%Y %H:%i:%s')", pIntervalStart, SchedulerAppointment.PropertyName_RecurrenceInfo);
var criteria = CreateCriteria<SchedulerAppointment>();
@@ -2412,11 +2500,10 @@ namespace BeWo.Data.Access
var exceptionalRecurrenceInfos = appointments.Where(w => w.RecurrenceInfo != null && w.Type == 3).ToList();
var exceptionIds = new List<long>();
var regex = new Regex("(Id=\\\"[a-z0-9-]+\\\")");
foreach(var appointment in exceptionalRecurrenceInfos)
{
var match = regex.Match(appointment.RecurrenceInfo);
var match = RecurrenceIdRegex.Match(appointment.RecurrenceInfo);
if(match.Success)
{
var value = match.Value;
@@ -2433,6 +2520,8 @@ namespace BeWo.Data.Access
}
}
// Serienausnahmen werden als gelöscht markiert und es wird die RecurrenceInfo entfernt.
// Der Type wird auf "normal" gesetzt, damit nicht die ganze Serie angezeigt werden muss, die unter Umständen nichts mit den Filterkriterien zu tun hat.
var exceptionsToModify = appointments.Where(w => w.Oid.HasValue && exceptionIds.Contains(w.Oid.Value)).ToList();
foreach(var exception in exceptionsToModify)
@@ -2454,28 +2543,12 @@ namespace BeWo.Data.Access
appointments.Add(replacingAppointment);
}
// Wenn ein Serientermin bearbeitet wird, sodass er außerhalb des Fetch-Zeitraumes liegt, wird er nicht mehr korrekt angezeigt.
// Deshalb werden hier alle Ausnahmen von den in der appointments-Collection enthaltenen Terminen mitgeladen.
var recurrenceIds = new List<string>();
var allExceptionalRecurrenceInfos = appointments.Where(w => w.RecurrenceInfo != null);
foreach(var appointment in allExceptionalRecurrenceInfos)
{
var match = regex.Match(appointment.RecurrenceInfo);
if(match.Success)
{
var value = match.Value;
var actualId = value.Split("\"");
if(actualId.Count > 1)
{
recurrenceIds.AddIfNotIn(actualId[1]);
}
}
}
var changedOrDeletedOccurences = FindAppointmentsByRecurrenceId(recurrenceIds, true);
var changedOrDeletedOccurences = FindAppointmentsByRecurrenceId(ExtractRecurrenceIdFromRecurrenceInfo(allExceptionalRecurrenceInfos.Select(s => s.RecurrenceInfo).ToList()), true);
appointments.AddRangeIfElementsNotIn(changedOrDeletedOccurences);
@@ -2523,7 +2596,7 @@ namespace BeWo.Data.Access
private ICriteria CreateRecurrenceCriteria(DateTime start, DateTime end, bool pIncludeInactiveOnes = false)
{
var recurrenceBetween = string.Format("'{0:yyyy-MM-dd} 00:00:00' BETWEEN STR_TO_DATE(SUBSTRING({1}, 24, 19), '%m/%d/%Y %H:%i:%s') AND STR_TO_DATE(SUBSTRING({1}, 50, 19), '%m/%d/%Y %H:%i:%s')", start, SchedulerAppointment.PropertyName_RecurrenceInfo);
var recurrenceBetween = Format("'{0:yyyy-MM-dd} 00:00:00' BETWEEN STR_TO_DATE(SUBSTRING({1}, 24, 19), '%m/%d/%Y %H:%i:%s') AND STR_TO_DATE(SUBSTRING({1}, 50, 19), '%m/%d/%Y %H:%i:%s')", start, SchedulerAppointment.PropertyName_RecurrenceInfo);
var recurrenceAfter = $"'{start:yyyy-MM-dd} 00:00:00' > STR_TO_DATE(SUBSTRING({SchedulerAppointment.PropertyName_RecurrenceInfo}, 24, 19), '%m/%d/%Y %H:%i:%s')";
var criteria = CreateCriteria<SchedulerAppointment>("sa");
@@ -2563,12 +2636,23 @@ namespace BeWo.Data.Access
return c.List<SchedulerAppointment>();
}
public IList<SchedulerAppointment> FindAppointmentsByRecurrenecInfo(List<string> pRecurrenceInfos, bool pExcludeRootAppointments = false)
{
if(pRecurrenceInfos == null || pRecurrenceInfos.Count == 0)
{
return new List<SchedulerAppointment>();
}
return FindAppointmentsByRecurrenceId(ExtractRecurrenceIdFromRecurrenceInfo(pRecurrenceInfos), pExcludeRootAppointments);
}
public IList<SchedulerAppointment> FindAppointmentsByRecurrenceId(List<string> pRecurrenceIds, bool pExcludeRootAppointments = false)
{
if (pRecurrenceIds == null || pRecurrenceIds.Count == 0)
{
return new List<SchedulerAppointment>();
}
var criterionList = new List<ICriterion>();
pRecurrenceIds.DoForEach(id =>
@@ -2630,5 +2714,96 @@ namespace BeWo.Data.Access
return q.List();
}
public SchedulerAppointment FindRootAppointmentForException(SchedulerAppointmentDC pAppointment)
{
if(pAppointment?.RecurrenceInfo == null)
{
return null;
}
var match = RecurrenceIdRegex.Match(pAppointment.RecurrenceInfo);
if(match.Success)
{
var value = match.Value;
var actualId = value.Split("\"");
if(actualId.Count > 1)
{
var id = actualId[1];
var criteria = CreateCriteria<SchedulerAppointment>()
.Add(Restrictions.IsNotNull(nameof(SchedulerAppointment.RecurrenceInfo)))
.Add(Restrictions.Like(nameof(SchedulerAppointment.RecurrenceInfo), id, MatchMode.Anywhere))
.Add(Restrictions.Eq(nameof(Appointment.Type), 1));
var resultList = criteria.List<SchedulerAppointment>();
if(resultList == null || resultList.Count == 0)
{
return null;
}
return resultList.First();
}
}
return null;
}
public SchedulerAppointment FindRootAppointmentForException(SchedulerAppointment pAppointment)
{
if(pAppointment?.RecurrenceInfo == null)
{
return null;
}
var match = RecurrenceIdRegex.Match(pAppointment.RecurrenceInfo);
if(match.Success)
{
var value = match.Value;
var actualId = value.Split("\"");
if(actualId.Count > 1)
{
var id = actualId[1];
var criteria = CreateCriteria<SchedulerAppointment>()
.Add(Restrictions.IsNotNull(nameof(SchedulerAppointment.RecurrenceInfo)))
.Add(Restrictions.Like(nameof(SchedulerAppointment.RecurrenceInfo), id, MatchMode.Anywhere))
.Add(Restrictions.Eq(nameof(Appointment.Type), 1));
var resultList = criteria.List<SchedulerAppointment>();
if(resultList == null || resultList.Count == 0)
{
return null;
}
return resultList.First();
}
}
return null;
}
private static List<string> ExtractRecurrenceIdFromRecurrenceInfo(List<string> pRecurrenceInfos)
{
var recurrenceIds = new List<string>();
foreach(var info in pRecurrenceInfos)
{
var match = RecurrenceIdRegex.Match(info);
if(match.Success)
{
var value = match.Value;
var actualId = value.Split("\"");
if(actualId.Count > 1)
{
recurrenceIds.AddIfNotIn(actualId[1]);
}
}
}
return recurrenceIds;
}
}
}

View File

@@ -26,11 +26,18 @@ namespace BeWo.Data.Entities
public static string PropertyName_Notice3 = "Notice3";
public static string PropertyName_Notice4 = "Notice4";
public static string PropertyName_Notice5 = "Notice5";
public static string PropertyName_IsTask = nameof(IsTask);
public static string PropertyName_CompletedNotice = nameof(CompletedNotice);
public static string PropertyName_CompletedDate = nameof(CompletedDate);
public static string PropertyName_TaskDescription = nameof(TaskDescription);
public static string PropertyName_DueDate = nameof(DueDate);
private IList<Employee2SchedulerAppointment> _EmployeeList;
private IList<Customer> _CustomerList;
private IList<Resource> _ResourceList;
private bool _IsPrivate;
private IList<SupportConcept> _SupportConceptList;
private bool _IsPrivate;
private Employee _Originator;
private long? _FormerBookingSequenceOid;
private string _Notice2;
@@ -68,8 +75,8 @@ namespace BeWo.Data.Entities
public virtual string Location { get; set; }
public virtual Employee Originator
{
get { return _Originator; }
set
get => _Originator;
set
{
if (AreDifferent(_Originator, value))
_Originator = value;
@@ -79,9 +86,9 @@ namespace BeWo.Data.Entities
public virtual string ReminderInfo { get; set; }
public virtual IList<Resource> ResourceList
{
get { return _ResourceList ?? (_ResourceList = new List<Resource>()); }
get => _ResourceList ?? (_ResourceList = new List<Resource>());
set
set
{
if (AreDifferent(_ResourceList, value))
_ResourceList = value;
@@ -109,6 +116,12 @@ namespace BeWo.Data.Entities
//DeletedOccurrence = 4
public virtual int Type { get; set; }
public virtual bool IsTask { get; set; }
public virtual string TaskDescription { get; set; }
public virtual string CompletedNotice { get; set; }
public virtual DateTime? CompletedDate { get; set; }
public virtual DateTime? DueDate { get; set; }
public virtual long? FormerBookingSequenceOid
{
get { return _FormerBookingSequenceOid; }
@@ -184,5 +197,17 @@ namespace BeWo.Data.Entities
}
}
public virtual IList<SupportConcept> SupportConceptList
{
get => _SupportConceptList ?? (_SupportConceptList = new List<SupportConcept>());
set
{
if (AreDifferent(_SupportConceptList, value))
{
_SupportConceptList = value;
}
}
}
}
}

View File

@@ -24,6 +24,12 @@
<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" />
<many-to-one name="Originator" column="OriginatorOid" class="BeWo.Data.Entities.Employee, BeWo.Data" cascade="none" />
<bag name="EmployeeList" table="Employee2NewSchApp" generic="true" cascade="none" batch-size="250">
@@ -40,5 +46,10 @@
<key column="NewSchAppOid" />
<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="ResourceOid" class="BeWo.Data.Entities.SupportConcept, BeWo.Data" />
</bag>
</class>
</hibernate-mapping>

View File

@@ -3,6 +3,7 @@
<PropertyGroup>
<NameOfLastUsedPublishProfile>BeWo2.0</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>

View File

@@ -24,7 +24,7 @@
</property>-->
<property name="connection.connection_string">
Server=localhost;Password=root;User ID=root;Initial Catalog=lori
Server=localhost;Password=root;User ID=root;Initial Catalog=caritasaachen
</property>
<property name="dialect">

View File

@@ -0,0 +1,6 @@
ALTER TABLE newschedulerappointment ADD IsTask tinyint(1) DEFAULT NULL;
ALTER TABLE newschedulerappointment ADD TaskDescription mediumtext DEFAULT NULL;
ALTER TABLE newschedulerappointment ADD CompletedDate datetime DEFAULT NULL;
ALTER TABLE newschedulerappointment ADD CompletedNotice mediumtext DEFAULT NULL;
ALTER TABLE newschedulerappointment ADD DueDate datetime DEFAULT NULL;
ALTER TABLE newschedulerappointment ADD FormerTaskOid bigint(19) DEFAULT NULL;

View File

@@ -0,0 +1,33 @@
-- Dieses Skript konvertiert Tasks in NewSchedulerAppointments. Der Originator ist dabei der Employee mit der niedrigsten Oid aus der Tabelle task2employee!
-- Es werden keine Tasks konvertiert, die als DueDate NULL aufweisen!
-- Es handelt sich hier nur um die bereits erledigten Aufgaben, da diese in der Kalenderansicht keinen Zeitstrahl darstellen, sondern ein einzelner, ganztägiger Termin sind.
INSERT INTO newschedulerappointment (Subject, StartDate, EndDate, DueDate, CompletedDate, CompletedNotice, TaskDescription, FormerTaskOid,
IsTask, Status, AllDay, Version, Type, IsPrivate, Tid, IsActive,
OriginatorOid, UdpUser, InsUser, InsTs)
SELECT t.Title, CONCAT(DATE(t.DueDate), ' 00:00:00'), CONCAT(DATE(ADDDATE(t.DueDate, INTERVAL 1 DAY)), ' 00:00:00'), t.DueDate, t.CompletedDate, t.CompletedNotice, t.Description, t.Oid,
1, 0, 1, 1, 0, 0, 91, t.IsActive,
(SELECT EmployeeOid FROM task2employee WHERE TaskOid = t.Oid LIMIT 1), 'System', 'System', NOW()
FROM task t WHERE t.CompletedDate IS NOT NULL AND t.DueDate IS NOT NULL AND t.Oid IN (SELECT TaskOid FROM task2employee);
-- Diese Abfrage ist für Aufgaben, die noch nicht erledigt worden sind
INSERT INTO newschedulerappointment (Subject, StartDate, EndDate, DueDate, CompletedDate, CompletedNotice, TaskDescription, FormerTaskOid,
IsTask, Status, AllDay, Version, Type, IsPrivate, Tid, IsActive,
OriginatorOid, UdpUser, InsUser, InsTs)
SELECT t.Title, CONCAT(DATE(t.InsTs), ' 00:00:00'), CONCAT(DATE(ADDDATE(t.DueDate, INTERVAL 1 DAY)), ' 00:00:00'), t.DueDate, t.CompletedDate, t.CompletedNotice, t.Description, t.Oid,
1, 0, 1, 1, 0, 0, 91, t.IsActive,
(SELECT EmployeeOid FROM task2employee WHERE TaskOid = t.Oid LIMIT 1), 'System', 'System', NOW()
FROM task t WHERE t.CompletedDate IS NULL AND t.DueDate IS NOT NULL AND t.Oid IN (SELECT TaskOid FROM task2employee);
-- Die Mitarbeiter der ursprünglichen Tasks werden mit den neuen Appointments verknüpft
INSERT INTO employee2newschapp (EmployeeOid, NewSchAppOid, IsParticipating, Tid, InsTs, InsUser, UdpUser, Version, IsActive, IsPChanged, IsPC_CheckedTs)
SELECT e2t.EmployeeOid, (SELECT Oid FROM newschedulerappointment WHERE FormerTaskOid = e2t.TaskOid LIMIT 1), 1, 95, NOW(), 'System', 'System', 1, 1, 1, NOW()
FROM task2employee e2t WHERE e2t.TaskOid IN (SELECT FormerTaskOid FROM newschedulerappointment);
-- Die Hilfepläne der ursprünglichen Tasks werden mit den neuen Appointments verknüpft
INSERT INTO supportconcept2newschapp (SupportConceptOid, NewSchAppOid)
SELECT t.SupportConceptOid, (SELECT n.Oid FROM newschedulerappointment n WHERE n.FormerTaskOid IS NOT NULL AND n.FormerTaskOid = t.Oid LIMIT 1)
FROM task t WHERE t.Oid IN (SELECT FormerTaskOid FROM newschedulerappointment);

View File

@@ -0,0 +1,27 @@
CREATE TABLE `supportconcept2newschapp` (
`Oid` bigint(19) NOT NULL AUTO_INCREMENT,
`SupportConceptOid` bigint(19) DEFAULT NULL,
`NewSchAppOid` bigint(19) DEFAULT NULL,
PRIMARY KEY(`Oid`),
KEY `SUPPORTCONCEPT2NEWSCHAPP_SUPPORTCONCEPT_FK` (`SupportConceptOid`),
CONSTRAINT `FK_SUPPORTCONCEPT2NEWSCHAPP_SUPPORTCONCEPT` FOREIGN KEY (`SupportConceptOid`) REFERENCES `supportconcept` (`Oid`) ON DELETE NO ACTION ON UPDATE NO ACTION
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `person2newschapp` (
`Oid` bigint(19) NOT NULL AUTO_INCREMENT,
`PersonOid` bigint(19) DEFAULT NULL,
`NewSchAppOid` bigint(19) DEFAULT NULL,
PRIMARY KEY(`Oid`),
KEY `PERSON2NEWSCHAPP_PERSON_FK` (`PersonOid`),
CONSTRAINT `FK_PERSON2NEWSCHAPP_PERSON` FOREIGN KEY (`PersonOid`) REFERENCES `person` (`Oid`) ON DELETE NO ACTION ON UPDATE NO ACTION
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `organisation2newschapp` (
`Oid` bigint(19) NOT NULL AUTO_INCREMENT,
`OrganisationOid` bigint(19) DEFAULT NULL,
`NewSchAppOid` bigint(19) DEFAULT NULL,
PRIMARY KEY(`Oid`),
KEY `ORGANISATION2NEWSCHAPP_ORGANISATION_FK` (`OrganisationOid`),
CONSTRAINT `FK_ORGANISATION2NEWSCHAPP_ORGANISATION` FOREIGN KEY (`OrganisationOid`) REFERENCES `organisation` (`Oid`) ON DELETE NO ACTION ON UPDATE NO ACTION
)ENGINE=InnoDB DEFAULT CHARSET=latin1;

View File

@@ -88,7 +88,7 @@ namespace ReportingService.ServiceImplementations
return reportObject.EmployeeDetailList
.Where(employeeDetail => employeeDetail.Employee.Oid != null)
.ToDictionary(employeeDetail => MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(employeeDetail.Employee),
employeeDetail => employeeDetail.UeberstundenGesamt == null ? 0 : employeeDetail.UeberstundenGesamt.Value);
employeeDetail => employeeDetail.UeberstundenGesamt ?? 0);
}
private static MemoryStream CreateReportStream(XtraReport pReport)

View File

@@ -33,10 +33,18 @@ namespace BeWo.Service.DCEntityMapper
pDataContract.ResourceList = MapperFactory.ResourceDC_Resource.MapToNewDCs(pEntity.ResourceList);
pDataContract.EmployeeList = MapperFactory.Employee2SchedulerAppointmentDC_Employee2SchedulerAppointment.MapToNewDCs(pEntity.EmployeeList);
pDataContract.IsTask = pEntity.IsTask;
pDataContract.TaskDescription = pEntity.TaskDescription;
pDataContract.CompletedNotice = pEntity.CompletedNotice;
pDataContract.CompletedDate = pEntity.CompletedDate;
pDataContract.DueDate = pEntity.DueDate;
pDataContract.FormerBookingSequenceOid = pEntity.FormerBookingSequenceOid;
if (pEntity.Originator != null)
pDataContract.Originator = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(pEntity.Originator);
{
pDataContract.Originator = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(pEntity.Originator);
}
return pDataContract;
}
@@ -61,8 +69,16 @@ namespace BeWo.Service.DCEntityMapper
pEntity.FormerBookingSequenceOid = pDataContract.FormerBookingSequenceOid;
if (pDataContract.Originator != null)
pEntity.Originator = MapperFactory.CompactEmployeeDC_Employee.MapToNewEntity(pDataContract.Originator);
pEntity.IsTask = pDataContract.IsTask;
pEntity.TaskDescription = pDataContract.TaskDescription;
pEntity.CompletedNotice = pDataContract.CompletedNotice;
pEntity.CompletedDate = pDataContract.CompletedDate;
pEntity.DueDate = pDataContract.DueDate;
if (pDataContract.Originator != null)
{
pEntity.Originator = MapperFactory.CompactEmployeeDC_Employee.MapToNewEntity(pDataContract.Originator);
}
pEntity.IsPrivate = pDataContract.IsPrivate;
@@ -83,7 +99,9 @@ namespace BeWo.Service.DCEntityMapper
protected override bool AreDCAndEntityEqual(SchedulerAppointmentDC pDC, SchedulerAppointment pEntity)
{
if (pDC.SchedulerAppointmentOid == null)
return false;
{
return false;
}
return pDC.SchedulerAppointmentOid == pEntity.Oid;
}

View File

@@ -201,8 +201,8 @@ namespace BeWo.Service.Plugins
public virtual List<ServiceRecordValidationResultDC> ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics, int maxDaysEditServiceRecordsAllowed, IList<long> employeeOids, IList<long> cb2scOids)
{
var result = new List<ServiceRecordValidationResultDC>();
if (!newServiceRecord.Start.HasValue)
if (!newServiceRecord.Start.HasValue)
return result;

View File

@@ -700,5 +700,9 @@ namespace BeWo.Service.ServiceContracts
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<SupportConceptCostBearerRelDC> GetSupportConceptCostBearerRelationsById(IEnumerable<long> relOids);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<CompactSupportConceptDC> LoadCompactSupportConceptsById(IEnumerable<long> pOids);
}
}

View File

@@ -176,5 +176,9 @@ namespace BeWo.Service.ServiceContracts
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<SchedulerAppointmentDC> LoadFilteredAppointments(bool pHasRightToSeeAllEmployeeAppointments, long pEmployeeOid, DateTime pIntervalStart, DateTime pIntervalEnd, List<long> pSelectedEmployees, List<long> pSelectedCustomer, List<long> pSelectedResources, bool pEmployeesOnly, bool pCustomersOnly, bool pResourcesOnly, bool pPrivateAppointmentsOnly, bool pOnlyMyAppointments);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<SchedulerAppointmentDC> LoadFilteredAppointmentsMitAufgaben(bool pHasRightToSeeAllEmployeeAppointments, long pEmployeeOid, DateTime pIntervalStart, DateTime pIntervalEnd, List<long> pSelectedEmployees, List<long> pSelectedCustomer, List<long> pSelectedResources, bool pEmployeesOnly, bool pCustomersOnly, bool pResourcesOnly, bool pPrivateAppointmentsOnly, bool pOnlyMyAppointments, bool pShowTasks);
}
}

View File

@@ -2096,7 +2096,7 @@ namespace BeWo.Service.ServiceImplementations
CustomerInsUser = lOriginal.InsUser,
CustomerOid = Oid ?? lOriginal.Oid,
CustomerUdpUser = lOriginal.UdpUser,
CustomerVersion = lOriginal.Version.Value,
CustomerVersion = lOriginal.Version ?? 0,
DebitorNumber = lOriginal.DebitorNumber,
Diagnosis = lOriginal.Diagnosis,
Environment = lOriginal.Environment,
@@ -3862,6 +3862,19 @@ namespace BeWo.Service.ServiceImplementations
throw Utils.CreateBeWoFaultException(e);
}
}
public List<CompactSupportConceptDC> LoadCompactSupportConceptsById(IEnumerable<long> pOids)
{
try
{
var originals = DAOFactory.GenericDAO.LoadByIDs<SupportConcept>(pOids);
return MapperFactory.CompactSupportConceptDC_SupportConcept.MapToNewDCs(originals);
}
catch (Exception e)
{
throw Utils.CreateBeWoFaultException(e);
}
}
}
internal struct WohnheimbuchungsIntervallStruct

View File

@@ -17,6 +17,7 @@ using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using DevExpress.XtraScheduler;
using static System.String;
using Resource = BeWo.Data.Entities.Resource;
using Utils = BeWo.Service.Core.Utils;
@@ -1067,6 +1068,114 @@ namespace BeWo.Service.ServiceImplementations
}
}
public List<SchedulerAppointmentDC> LoadFilteredAppointmentsMitAufgaben(bool pHasRightToSeeAllEmployeeAppointments, long pEmployeeOid, DateTime pIntervalStart, DateTime pIntervalEnd, List<long> pSelectedEmployees, List<long> pSelectedCustomer, List<long> pSelectedResources, bool pEmployeesOnly, bool pCustomersOnly, bool pResourcesOnly, bool pPrivateAppointmentsOnly, bool pOnlyMyAppointments, bool pShowTasks)
{
try
{
long? ownerOid = null;
//Keine Auswahl getroffen: Nur meine Termine anzeigen
if((pSelectedEmployees == null || pSelectedEmployees.Count == 0) && (pSelectedCustomer == null || pSelectedCustomer.Count == 0) && (pSelectedResources == null || pSelectedResources.Count == 0))
{
ownerOid = pEmployeeOid;
}
//Benutzer hat sich selber selektiert
if(pSelectedEmployees != null && pSelectedEmployees.Exists(e => e == pEmployeeOid))
{
ownerOid = pEmployeeOid;
}
//Man hat nur Customer und/oder Resourcen ausgewählt, dann dürfen die eigenen nicht angezeigt werden
if((pSelectedEmployees == null || pSelectedEmployees.Count == 0) &&
(pSelectedCustomer != null && pSelectedCustomer.Count > 0 ||
pSelectedResources != null && pSelectedResources.Count > 0))
{
ownerOid = null;
}
//Wenn man kein Recht hat alle zu sehen, muss immer auf Owner gefiltert werden
if(!pHasRightToSeeAllEmployeeAppointments)
{
ownerOid = pEmployeeOid;
}
if(!(!pHasRightToSeeAllEmployeeAppointments && pSelectedEmployees != null && pSelectedEmployees.Count == 1 && pSelectedEmployees.Contains(pEmployeeOid)))
{
//Rausnehmen, sonst werden Termine nicht gezeigt, bei denen man Owner ist und kein Employee ausgewählt wurde.
//Wird nicht rausgenommen, wenn man die Termine anderer Mitarbeiter nicht sehen darf und "nur meine Termine" ausgewählt hat.
//Sonst werden die Filter mit and und nicht mit or verknüpft.
pSelectedEmployees?.Remove(pEmployeeOid);
}
if(pPrivateAppointmentsOnly && (pSelectedEmployees == null || pSelectedEmployees.Count == 0) && (pSelectedCustomer == null || pSelectedCustomer.Count == 0) && (pSelectedResources == null || pSelectedResources.Count == 0) && !(pSelectedEmployees == null || pSelectedEmployees.Count == 0) &&
(pSelectedCustomer != null && pSelectedCustomer.Count > 0 ||
pSelectedResources != null && pSelectedResources.Count > 0))
{
ownerOid = pEmployeeOid;
}
var appointments = DAOFactory.SearchDAO.LoadFilteredAppointmentsForEmployee(pHasRightToSeeAllEmployeeAppointments, ownerOid, pIntervalStart, pIntervalEnd, pSelectedEmployees, pSelectedCustomer, pSelectedResources, pEmployeesOnly, pCustomersOnly, pResourcesOnly, pPrivateAppointmentsOnly, pOnlyMyAppointments, false).ToList();
var all = MapperFactory.SchedulerAppointmentDCSchedulerAppointment.MapToNewDCs(appointments).OrderBy(a => a.StartDate).ToList();
var filteredEmployeeOids = new List<long>();
if(ownerOid.HasValue)
{
filteredEmployeeOids.Add(ownerOid.Value);
}
if(pSelectedEmployees != null)
{
foreach(var empOid in pSelectedEmployees)
{
filteredEmployeeOids.Add(empOid);
}
}
var result = FilterAppointments(all, pEmployeeOid, filteredEmployeeOids, pSelectedCustomer, pSelectedResources, pCustomersOnly, pResourcesOnly, pShowTasks);
//Check fehlerhaftes RecurrenceInfos
foreach(var app in result)
{
if(!IsNullOrEmpty(app.RecurrenceInfo))
{
if(app.RecurrenceInfo.Contains("WeekDays=\"0\""))
{
app.RecurrenceInfo = app.RecurrenceInfo.Replace("WeekDays=\"0\"", "WeekDays=\"2\"");
}
}
}
// Ausnahmen immer laden. Entsprechen die Ausnahmen nicht den Filterkriterien, werden sie als gelöscht markiert, um nicht auf dem Client angezeigt zu werden.
var ausnahmen = MapperFactory.SchedulerAppointmentDCSchedulerAppointment.MapToNewDCs(DAOFactory.SearchDAO.FindAppointmentsByRecurrenecInfo(result.Where(w => w.Type == 1).Select(s => s.RecurrenceInfo).ToList(), true));
var demFilterEntsprechendeTermine = FilterAppointments(ausnahmen, pEmployeeOid, filteredEmployeeOids, pSelectedCustomer, pSelectedResources, pCustomersOnly, pResourcesOnly, pShowTasks);
foreach(var appointment in ausnahmen.Where(w => !demFilterEntsprechendeTermine.Contains(w)))
{
var kosmetisch = new SchedulerAppointmentDC
{
SchedulerAppointmentOid = appointment.SchedulerAppointmentOid * -1,
NewSchedulerAppointmentVersion = 1,
Type = 4,
RecurrenceInfo = appointment.RecurrenceInfo,
EmployeeList = appointment.EmployeeList,
CustomerList = appointment.CustomerList,
ResourceList = appointment.ResourceList,
Originator = appointment.Originator
};
result.Add(kosmetisch);
}
return result;
}
catch(Exception e)
{
throw Utils.CreateBeWoFaultException(e);
}
}
public List<SchedulerAppointmentDC> LoadFilteredAppointments(bool pHasRightToSeeAllEmployeeAppointments, long pEmployeeOid, DateTime pIntervalStart, DateTime pIntervalEnd, List<long> pSelectedEmployees, List<long> pSelectedCustomer, List<long> pSelectedResources, bool pEmployeesOnly, bool pCustomersOnly, bool pResourcesOnly, bool pPrivateAppointmentsOnly, bool pOnlyMyAppointments)
{
try
@@ -1078,11 +1187,13 @@ namespace BeWo.Service.ServiceImplementations
{
ownerOid = pEmployeeOid;
}
//Benutzer hat sich selber selektiert
if (pSelectedEmployees != null && pSelectedEmployees.Exists(e => e == pEmployeeOid))
{
ownerOid = pEmployeeOid;
}
//Man hat nur Customer und/oder Resourcen ausgewählt, dann dürfen die eigenen nicht angezeigt werden
if ((pSelectedEmployees == null || pSelectedEmployees.Count == 0) &&
(pSelectedCustomer != null && pSelectedCustomer.Count > 0 ||
@@ -1090,6 +1201,7 @@ namespace BeWo.Service.ServiceImplementations
{
ownerOid = null;
}
//Wenn man kein Recht hat alle zu sehen, muss immer auf Owner gefiltert werden
if (!pHasRightToSeeAllEmployeeAppointments)
{
@@ -1115,7 +1227,7 @@ namespace BeWo.Service.ServiceImplementations
var all = MapperFactory.SchedulerAppointmentDCSchedulerAppointment.MapToNewDCs(appointments).OrderBy(a => a.StartDate).ToList();
List<long> filteredEmployeeOids = new List<long>();
var filteredEmployeeOids = new List<long>();
if (ownerOid.HasValue)
{
filteredEmployeeOids.Add(ownerOid.Value);
@@ -1129,82 +1241,12 @@ namespace BeWo.Service.ServiceImplementations
}
}
List<SchedulerAppointmentDC> result = new List<SchedulerAppointmentDC>();
//Filter alle Termine raus, die vom Ersteller für andere MAs erstellt wurden
foreach (var app in all)
{
bool add = true;
if (app.Originator != null && app.Originator.EmployeeOid == pEmployeeOid)
{
if (app.EmployeeList != null && app.EmployeeList.Count > 0)
{
add = false;
foreach (var emp in app.EmployeeList)
{
if (filteredEmployeeOids.Contains(emp.Employee.EmployeeOid))
{
add = true;
}
}
}
}
//Prüfe Klienten Filter
if (!add)
{
if (app.CustomerList != null && app.CustomerList.Count > 0)
{
if (pCustomersOnly)
{
add = true;
}
else if (pSelectedCustomer != null && pSelectedCustomer.Count > 0)
{
foreach (var cust in app.CustomerList)
{
if (pSelectedCustomer.Contains(cust.CustomerOid))
{
add = true;
}
}
}
}
}
//Prüfe Resourcen Filter
if (!add)
{
if (app.ResourceList != null && app.ResourceList.Count > 0)
{
if (pResourcesOnly)
{
add = true;
}
else if (pSelectedResources != null && pSelectedResources.Count > 0)
{
foreach (var res in app.ResourceList)
{
if (pSelectedResources.Contains(res.ResourceOid.Value))
{
add = true;
}
}
}
}
}
if (add)
{
result.Add(app);
}
}
var result = FilterAppointments(all, pEmployeeOid, filteredEmployeeOids, pSelectedCustomer, pSelectedResources, pCustomersOnly, pResourcesOnly);
//Check fehlerhaftes RecurrenceInfos
foreach (var app in result)
{
if (!String.IsNullOrEmpty(app.RecurrenceInfo))
if (!IsNullOrEmpty(app.RecurrenceInfo))
{
if (app.RecurrenceInfo.Contains("WeekDays=\"0\""))
{
@@ -1212,24 +1254,114 @@ namespace BeWo.Service.ServiceImplementations
}
}
}
return result;
////var appointments = DAOFactory.GenericDAO.GetAll<SchedulerAppointment>();
//var test = MapperFactory.SchedulerAppointmentDCSchedulerAppointment.MapToNewDCs(appointments).OrderBy(a => a.StartDate).ToList();
// Ausnahmen immer laden. Entsprechen die Ausnahmen nicht den Filterkriterien, werden sie als gelöscht markiert, um nicht auf dem Client angezeigt zu werden.
var ausnahmen = MapperFactory.SchedulerAppointmentDCSchedulerAppointment.MapToNewDCs(DAOFactory.SearchDAO.FindAppointmentsByRecurrenecInfo(result.Where(w => w.Type == 1).Select(s => s.RecurrenceInfo).ToList(), true));
var demFilterEntsprechendeTermine = FilterAppointments(ausnahmen, pEmployeeOid, filteredEmployeeOids, pSelectedCustomer, pSelectedResources, pCustomersOnly, pResourcesOnly);
//foreach (var dc in test)
//{
// if (dc.Type == 3)
// {
// dc.RecurrenceInfo = null;
// dc.Type = 0;
// }
//}
//return test;
foreach(var appointment in ausnahmen.Where(w => !demFilterEntsprechendeTermine.Contains(w)))
{
var kosmetisch = new SchedulerAppointmentDC
{
SchedulerAppointmentOid = appointment.SchedulerAppointmentOid * -1,
NewSchedulerAppointmentVersion = 1,
Type = 4,
RecurrenceInfo = appointment.RecurrenceInfo,
EmployeeList = appointment.EmployeeList,
CustomerList = appointment.CustomerList,
ResourceList = appointment.ResourceList,
Originator = appointment.Originator
};
result.Add(kosmetisch);
}
return result;
}
catch(Exception e)
{
throw Utils.CreateBeWoFaultException(e);
}
}
private static List<SchedulerAppointmentDC> FilterAppointments(IEnumerable<SchedulerAppointmentDC> pAppointments, long pEmployeeOid, ICollection<long> pFilteredEmployeeOids, ICollection<long> pSelectedCustomers, ICollection<long> pSelectedResources, bool pCustomersOnly, bool pResourcesOnly, bool pShowTasks = false)
{
var result = new List<SchedulerAppointmentDC>();
foreach(var app in pAppointments)
{
var add = true;
if(app.Originator != null && app.Originator.EmployeeOid == pEmployeeOid)
{
if(app.EmployeeList != null && app.EmployeeList.Count > 0)
{
add = false;
foreach(var emp in app.EmployeeList)
{
if(pFilteredEmployeeOids.Contains(emp.Employee.EmployeeOid))
{
add = true;
}
}
}
}
//Prüfe Klientenfilter
if(!add)
{
if(app.CustomerList != null && app.CustomerList.Count > 0)
{
if(pCustomersOnly)
{
add = true;
}
else if(pSelectedCustomers != null && pSelectedCustomers.Count > 0)
{
foreach(var cust in app.CustomerList)
{
if(pSelectedCustomers.Contains(cust.CustomerOid))
{
add = true;
}
}
}
}
}
//Prüfe Ressourcenfilter
if(!add)
{
if(app.ResourceList != null && app.ResourceList.Count > 0)
{
if(pResourcesOnly)
{
add = true;
}
else if(pSelectedResources != null && pSelectedResources.Count > 0)
{
foreach(var res in app.ResourceList)
{
if(pSelectedResources.Contains(res.ResourceOid.Value))
{
add = true;
}
}
}
}
}
if (app.IsTask && !pShowTasks)
{
add = false;
}
if(add)
{
result.Add(app);
}
}
return result;
}
}
}

View File

@@ -625,6 +625,23 @@ namespace BS.Shared.Core
return result.Trim(pSeperator?.ToCharArray());
}
public static long? ParseObjectToNullableLong(object object2Parse)
{
if(object2Parse == null)
{
return null;
}
var wasSuccessful = long.TryParse(object2Parse.ToString(), out var output);
if(wasSuccessful)
{
return output;
}
return null;
}
}
public struct NullCompareResult

View File

@@ -66,8 +66,29 @@ namespace BS.Shared.DataContracts
[DataMember]
public long? FormerBookingSequenceOid { get; set; }
[DataMember]
public bool IsTeilnahmeBestaetigung { get; set; }
public override bool Equals(object obj)
[DataMember]
public bool IsTask { get; set; }
[DataMember]
public string CompletedNotice { get; set; }
[DataMember]
public string TaskDescription { get; set; }
[DataMember]
public DateTime? CompletedDate { get; set; }
[DataMember]
public DateTime? DueDate { get; set; }
[DataMember]
public List<CompactSupportConceptDC> SupportConceptList { get; set; }
public override bool Equals(object obj)
{
if (!(obj is SchedulerAppointmentDC))
{
@@ -87,7 +108,10 @@ namespace BS.Shared.DataContracts
}
var value = StartDate == y.StartDate && EndDate == y.EndDate && Type == y.Type && Description == y.Description &&
EmployeeList.SequenceEqual(y.EmployeeList) && ResourceList.SequenceEqual(y.ResourceList) && CustomerList.SequenceEqual(y.CustomerList);
EmployeeList.SequenceEqual(y.EmployeeList) &&
ResourceList.SequenceEqual(y.ResourceList) &&
CustomerList.SequenceEqual(y.CustomerList) &&
SupportConceptList.SequenceEqual(y.SupportConceptList);
return value;
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using BS.Shared.DataContracts.Compact;
@@ -121,6 +122,5 @@ namespace BS.Shared.DataContracts
[DataMember]
public ServiceRecordFormate? ServiceRecordFormat { get; set; }
}
}
}

View File

@@ -1,6 +1,5 @@
using System;
using System.Globalization;
using System.Linq;
using BS.Shared.Core;
using System.Collections.Generic;
using DevExpress.XtraScheduler;
@@ -252,7 +251,7 @@ namespace BS.Shared.Extensions
{
var lInfo = DateTimeFormatInfo.CurrentInfo;
return lInfo.GetAbbreviatedDayName(pDate.DayOfWeek) + ", " + string.Format("{0:00}", pDate.Day) + "." + string.Format("{0:00}", pDate.Month) + "." + pDate.Year.ToString().Substring(2);
return lInfo.GetAbbreviatedDayName(pDate.DayOfWeek) + ", " + $"{pDate.Day:00}" + "." + $"{pDate.Month:00}" + "." + pDate.Year.ToString().Substring(2);
}
private static DateTime FromWeekdayOccurence(int pYear, int pMonth, DayOfWeek pDay, int pWeekdayOccurence, bool pFromStart)