Abwesenheitstabelle hinzugefügt (Add, Edit, Delete)
This commit is contained in:
@@ -304,6 +304,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\Detail\Report\AbwesenheitsEditView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\Detail\Report\IcfImportControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -875,6 +879,9 @@
|
||||
<Compile Include="View\Detail\Report\AbwesenheitstabelleView.xaml.cs">
|
||||
<DependentUpon>AbwesenheitstabelleView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\Detail\Report\AbwesenheitsEditView.xaml.cs">
|
||||
<DependentUpon>AbwesenheitsEditView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\Detail\Report\IcfImportControl.xaml.cs">
|
||||
<DependentUpon>IcfImportControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -1058,7 +1058,7 @@ namespace BeWo.Scheduler.View
|
||||
ShowPrivateAppointmentsCheckBox.IsChecked = true;
|
||||
}
|
||||
|
||||
ViewModel.ActiveAppointmentViewModel.InsertAppointments(Scheduler, appList);
|
||||
ViewModel.ActiveAppointmentViewModel.InsertAppointments(Scheduler, appList);
|
||||
UpdateRequestString();
|
||||
ReloadVM(true);
|
||||
}
|
||||
@@ -1141,7 +1141,6 @@ namespace BeWo.Scheduler.View
|
||||
{
|
||||
e.Menu.ItemLinks.Remove(verfuegbarkeitMenue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(Scheduler.SelectedAppointments.Count == 0 || Scheduler.SelectedAppointments[0]?.Type != AppointmentType.ChangedOccurrence)
|
||||
|
||||
@@ -4674,6 +4674,18 @@ namespace BeWo.ServiceProxy
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetAllAbsenceReasonBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
System.Collections.Generic.List<BS.Shared.DataContracts.AbsenceReasonDC> GetAllAbsenceReason();
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/UpdateAbsenceTimeWithReturn", ReplyAction="http://tempuri.org/IOperationsService/UpdateAbsenceTimeWithReturnResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/UpdateAbsenceTimeWithReturnBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
BS.Shared.DataContracts.AbsenceTimeDC UpdateAbsenceTimeWithReturn(BS.Shared.DataContracts.AbsenceTimeDC absenceTimeDC);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/InsertAbsenceTimeWithReturn", ReplyAction="http://tempuri.org/IOperationsService/InsertAbsenceTimeWithReturnResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/InsertAbsenceTimeWithReturnBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
BS.Shared.DataContracts.AbsenceTimeDC InsertAbsenceTimeWithReturn(BS.Shared.DataContracts.AbsenceTimeDC absenceTimeDC);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/DeleteAbsenceTime", ReplyAction="http://tempuri.org/IOperationsService/DeleteAbsenceTimeResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/DeleteAbsenceTimeBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
void DeleteAbsenceTime(BS.Shared.DataContracts.AbsenceTimeDC absenceTimeDC);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/UpdateIsChatActiveCustomerAPPCodeDC", ReplyAction="http://tempuri.org/IOperationsService/UpdateIsChatActiveCustomerAPPCodeDCResponse" +
|
||||
"")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/UpdateIsChatActiveCustomerAPPCodeDCBeWoFaul" +
|
||||
@@ -5629,6 +5641,21 @@ namespace BeWo.ServiceProxy
|
||||
return base.Channel.GetAllAbsenceReason();
|
||||
}
|
||||
|
||||
public BS.Shared.DataContracts.AbsenceTimeDC UpdateAbsenceTimeWithReturn(BS.Shared.DataContracts.AbsenceTimeDC absenceTimeDC)
|
||||
{
|
||||
return base.Channel.UpdateAbsenceTimeWithReturn(absenceTimeDC);
|
||||
}
|
||||
|
||||
public BS.Shared.DataContracts.AbsenceTimeDC InsertAbsenceTimeWithReturn(BS.Shared.DataContracts.AbsenceTimeDC absenceTimeDC)
|
||||
{
|
||||
return base.Channel.InsertAbsenceTimeWithReturn(absenceTimeDC);
|
||||
}
|
||||
|
||||
public void DeleteAbsenceTime(BS.Shared.DataContracts.AbsenceTimeDC absenceTimeDC)
|
||||
{
|
||||
base.Channel.DeleteAbsenceTime(absenceTimeDC);
|
||||
}
|
||||
|
||||
public void UpdateIsChatActiveCustomerAPPCodeDC(long customerOid, int activeType)
|
||||
{
|
||||
base.Channel.UpdateIsChatActiveCustomerAPPCodeDC(customerOid, activeType);
|
||||
|
||||
44
BeWo/View/Detail/Report/AbwesenheitsEditView.xaml
Normal file
44
BeWo/View/Detail/Report/AbwesenheitsEditView.xaml
Normal file
@@ -0,0 +1,44 @@
|
||||
<UserControl
|
||||
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
|
||||
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
|
||||
Height="Auto" Width="Auto" HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch" Focusable="True"
|
||||
xmlns:val="clr-namespace:BeWo.Validation"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduler"
|
||||
x:Class="BeWo.View.Detail.Report.AbwesenheitsEditView"
|
||||
d:DesignHeight="300" d:DesignWidth="300"
|
||||
|
||||
mc:Ignorable="d">
|
||||
<Grid Background="{StaticResource ObjectEditBackgroundBrush}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="10" />
|
||||
<ColumnDefinition Width="*" MinWidth="100" />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" MinHeight="100"/>
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Column="0" Grid.Row="0" Content="Start:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
<dxe:DateEdit x:Name="_DatePickerStartDate" Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="2" MaskType="DateTimeAdvancingCaret" HorizontalAlignment="Stretch" Margin="3" AllowNullInput="False" />
|
||||
<Label Grid.Column="0" Grid.Row="1" Content="Ende:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
<dxe:DateEdit x:Name="_DatePickerEndDate" Grid.Column="2" Grid.Row="1" Grid.ColumnSpan="2" MaskType="DateTimeAdvancingCaret" HorizontalAlignment="Stretch" Margin="3" />
|
||||
<Label Grid.Column="0" Grid.Row="2" Content="Kategorie:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
<dxe:ComboBoxEdit x:Name="_ReasonPicker" Grid.Column="2" Grid.Row="2" Grid.ColumnSpan="2" Margin="3" DisplayMember="Description"/>
|
||||
<Label Grid.Column="0" Grid.Row="3" Content="Bemerkung:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
<TextBox x:Name="_NoticeTxt" Grid.Column="2" Grid.Row="3" Grid.ColumnSpan="2" Margin="3"/>
|
||||
<Button x:Name="_DeleteBtn" Visibility="Collapsed" Grid.Column="0" Grid.Row="5" Content="Löschen" Margin="3" Click="DeleteBtn_Click" HorizontalAlignment="Left" />
|
||||
<Button x:Name="_SaveBtn" Grid.Column="2" Grid.Row="5" Content="Speichern" Margin="3, 3, 4, 3" HorizontalAlignment="Right" Click="SaveBtn_Click" MinWidth="80"/>
|
||||
<Button x:Name="_CancelBtn" Grid.Column="3" Grid.Row="5" Content="Abbrechen" Margin="3" Click="CancelBtn_Click"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
127
BeWo/View/Detail/Report/AbwesenheitsEditView.xaml.cs
Normal file
127
BeWo/View/Detail/Report/AbwesenheitsEditView.xaml.cs
Normal file
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
using BeWo.Core;
|
||||
using BeWo.ServiceProxy;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.Extensions;
|
||||
|
||||
using DevExpress.Utils;
|
||||
using DevExpress.Xpf.Scheduler;
|
||||
using DevExpress.Xpf.Scheduler.UI;
|
||||
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
|
||||
using DevExpress.XtraScheduler;
|
||||
using SchedulerControl = DevExpress.Xpf.Scheduler.SchedulerControl;
|
||||
|
||||
namespace BeWo.View.Detail.Report
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für TestEMailControl.xaml
|
||||
/// </summary>
|
||||
public partial class AbwesenheitsEditView : UserControl
|
||||
{
|
||||
private SchedulerControl _SchedulerControl;
|
||||
|
||||
public bool IsEditMode { get; set; }
|
||||
public AbsenceTimeDC AbsenceTime { get; set; }
|
||||
public Appointment Appointment { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Für Appointment-Bearbeitung
|
||||
/// </summary>
|
||||
/// <param name="appointment"></param>
|
||||
/// <param name="absenceTimeDC"></param>
|
||||
/// <param name="reasons"></param>
|
||||
public AbwesenheitsEditView(SchedulerControl schedulerControl, Appointment appointment, AbsenceTimeDC absenceTimeDC, List<AbsenceReasonDC> reasons)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_SchedulerControl = schedulerControl;
|
||||
|
||||
_ReasonPicker.Items.AddRange(reasons.ToArray());
|
||||
Appointment = appointment;
|
||||
|
||||
IsEditMode = appointment.CustomFields["AbsenceTime"] != null;
|
||||
|
||||
if (IsEditMode)
|
||||
{
|
||||
_DeleteBtn.Visibility = Visibility.Visible;
|
||||
|
||||
AbsenceTime = absenceTimeDC;
|
||||
|
||||
_ReasonPicker.SelectedItem = absenceTimeDC.Reason;
|
||||
_NoticeTxt.Text = absenceTimeDC.Notice;
|
||||
}
|
||||
else
|
||||
{
|
||||
AbsenceTime = new AbsenceTimeDC();
|
||||
AbsenceTime.EmployeeOid = long.Parse(appointment.ResourceId.ToString());
|
||||
AbsenceTime.Start = AbsenceTime.End = Appointment.Start;
|
||||
|
||||
_ReasonPicker.SelectedItem = reasons[0];
|
||||
}
|
||||
|
||||
_DatePickerStartDate.DateTime = AbsenceTime.Start.Value;
|
||||
if (AbsenceTime.End.HasValue) _DatePickerEndDate.DateTime = AbsenceTime.End.Value;
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SchedulerFormBehavior.Close(this, false);
|
||||
}
|
||||
|
||||
private void DeleteBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Möchten Sie den Eintrag wirklich löschen?", "Eintrag löschen", MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes)
|
||||
return;
|
||||
|
||||
_SchedulerControl.Storage.AppointmentStorage.Remove(Appointment);
|
||||
ServiceFacade.DoOperationsServiceAsync(x => x.DeleteAbsenceTime(AbsenceTime));
|
||||
|
||||
SchedulerFormBehavior.Close(this, true);
|
||||
}
|
||||
|
||||
private void SaveBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
var start = _DatePickerStartDate.DateTime;
|
||||
var end = string.IsNullOrEmpty(_DatePickerEndDate.Text) ? null : _DatePickerEndDate.DateTime as DateTime?;
|
||||
|
||||
if (end.HasValue && end < start)
|
||||
{
|
||||
MessageBox.Show("Der Anfang darf nicht nach dem Ende kommen.", "Fehler", MessageBoxButton.OK);
|
||||
return;
|
||||
}
|
||||
|
||||
AbsenceTime.Reason = (AbsenceReasonDC)_ReasonPicker.SelectedItem;
|
||||
AbsenceTime.Notice = _NoticeTxt.Text;
|
||||
AbsenceTime.Start = start;
|
||||
AbsenceTime.End = end;
|
||||
|
||||
if (IsEditMode)
|
||||
{
|
||||
AbsenceTime = ServiceFacade.DoOperationsServiceSync(x => x.UpdateAbsenceTimeWithReturn(AbsenceTime));
|
||||
|
||||
var t = AbsenceTime.AbsenceTimeVersion;
|
||||
|
||||
SchedulerHelper.OverrideAWithB(Appointment, AbsenceTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
AbsenceTime = ServiceFacade.DoOperationsServiceSync(x => x.InsertAbsenceTimeWithReturn(AbsenceTime));
|
||||
|
||||
SchedulerHelper.OverrideAWithB(Appointment, AbsenceTime);
|
||||
|
||||
_SchedulerControl.Storage.AppointmentStorage.Add(Appointment);
|
||||
}
|
||||
|
||||
SchedulerFormBehavior.Close(this, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,11 @@
|
||||
xmlns:localView="clr-namespace:BeWo.View"
|
||||
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
|
||||
xmlns:dxschi="http://schemas.devexpress.com/winfx/2008/xaml/scheduler/internal"
|
||||
xmlns:XtraScheduler="clr-namespace:DevExpress.XtraScheduler;assembly=DevExpress.XtraScheduler.v17.1.Core"
|
||||
x:Class="BeWo.View.Detail.Report.AbwesenheitstabelleView"
|
||||
Height="Auto" Width="Auto" HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch" Focusable="True">
|
||||
|
||||
|
||||
<localView:BeWoView.Resources>
|
||||
<Style x:Key="VerticalResourceHeaderStyle" TargetType="{x:Type dxschi:VisualResourceHeader}">
|
||||
<Setter Property="Template">
|
||||
@@ -21,9 +22,8 @@
|
||||
<dxschi:VerticalHeaderControl SnapsToDevicePixels="True"
|
||||
ResourceColor="{Binding ResourceHeader.Brushes.ResourceHeader}"
|
||||
Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
dxschi:SchedulerItemsControl.ElementPosition="{Binding Path=(dxschi:SchedulerItemsControl.ElementPosition), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
>
|
||||
</dxschi:VerticalHeaderControl>
|
||||
dxschi:SchedulerItemsControl.ElementPosition="{Binding (dxschi:SchedulerItemsControl.ElementPosition), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
@@ -98,10 +98,28 @@
|
||||
<Button Grid.Column="0" Grid.Row="0" Content="Erstellen" Margin="3" MinWidth="100" Click="Button_Click"/>
|
||||
</Grid>
|
||||
|
||||
<dxsch:SchedulerControl dx:ThemeManager.ThemeName="Office2010Black" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" x:Name="_SchedularControl" ActiveViewType="Timeline" Visibility="Collapsed" GroupType="Resource" IsManipulationEnabled="True" AllowDrop="False" IsTabStop="False"
|
||||
EditAppointmentFormShowing="SchedularControl_EditAppointmentFormShowing" EditRecurrentAppointmentFormShowing="SchedularControl_EditRecurrentAppointmentFormShowing" >
|
||||
<dxsch:SchedulerControl dx:ThemeManager.ThemeName="Office2010Black" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" x:Name="_SchedulerControl" ActiveViewType="Timeline" Visibility="Collapsed" GroupType="Resource" IsManipulationEnabled="True" AllowDrop="False" IsTabStop="False"
|
||||
EditAppointmentFormShowing="SchedularControl_EditAppointmentFormShowing" EditRecurrentAppointmentFormShowing="SchedularControl_EditRecurrentAppointmentFormShowing" FormCustomizationUsingMVVMLocal="False" AppointmentViewInfoCustomizing="SchedulerControl_AppointmentViewInfoCustomizing">
|
||||
<!--<dxsch:SchedulerControl.Storage>
|
||||
<dxsch:SchedulerStorage>
|
||||
<dxsch:SchedulerStorage.ResourceStorage>
|
||||
<dxsch:ResourceStorage DataSource="_EmployeesWithAbsence">
|
||||
<dxsch:ResourceStorage.Mappings>
|
||||
<dxsch:ResourceMapping Caption="LastNameFirstName"/>
|
||||
</dxsch:ResourceStorage.Mappings>
|
||||
</dxsch:ResourceStorage>
|
||||
</dxsch:SchedulerStorage.ResourceStorage>
|
||||
<dxsch:SchedulerStorage.AppointmentStorage>
|
||||
<dxsch:AppointmentStorage DataSource="_AbsenceReasons">
|
||||
<dxsch:AppointmentStorage.Mappings >
|
||||
<dxsch:AppointmentMapping/>
|
||||
</dxsch:AppointmentStorage.Mappings>
|
||||
</dxsch:AppointmentStorage>
|
||||
</dxsch:SchedulerStorage.AppointmentStorage>
|
||||
</dxsch:SchedulerStorage>
|
||||
</dxsch:SchedulerControl.Storage>-->
|
||||
<dxsch:SchedulerControl.OptionsCustomization>
|
||||
<dxsch:OptionsCustomization AllowAppointmentCopy="None" AllowAppointmentCreate="None" AllowAppointmentDelete="None" AllowAppointmentDrag="None" AllowAppointmentDragBetweenResources="None" AllowAppointmentEdit="None" AllowAppointmentResize="None" AllowDisplayAppointmentForm="Never" AllowInplaceEditor="None" AllowAppointmentMultiSelect="False"/>
|
||||
<dxsch:OptionsCustomization AllowAppointmentCopy="None" AllowAppointmentCreate="All" AllowAppointmentDelete="None" AllowAppointmentDrag="None" AllowAppointmentDragBetweenResources="None" AllowAppointmentEdit="All" AllowAppointmentResize="None" AllowInplaceEditor="None" AllowAppointmentMultiSelect="False"/>
|
||||
</dxsch:SchedulerControl.OptionsCustomization>
|
||||
<dxsch:SchedulerControl.OptionsView>
|
||||
<dxsch:OptionsView/>
|
||||
@@ -109,23 +127,28 @@
|
||||
<dxsch:SchedulerControl.OptionsBehavior>
|
||||
<dxsch:OptionsBehavior/>
|
||||
</dxsch:SchedulerControl.OptionsBehavior>
|
||||
<dxsch:SchedulerControl.DayView>
|
||||
<dxsch:DayView Enabled="False"/>
|
||||
<dxsch:SchedulerControl.DayView >
|
||||
<dxsch:DayView />
|
||||
</dxsch:SchedulerControl.DayView>
|
||||
<dxsch:SchedulerControl.FullWeekView>
|
||||
<dxsch:FullWeekView Enabled="False"/>
|
||||
<dxsch:SchedulerControl.FullWeekView >
|
||||
<dxsch:FullWeekView Enabled="false"/>
|
||||
</dxsch:SchedulerControl.FullWeekView>
|
||||
<dxsch:SchedulerControl.MonthView>
|
||||
<dxsch:MonthView Enabled="False"/>
|
||||
<dxsch:SchedulerControl.MonthView >
|
||||
<dxsch:MonthView Enabled="false"/>
|
||||
</dxsch:SchedulerControl.MonthView>
|
||||
<dxsch:SchedulerControl.WeekView>
|
||||
<dxsch:WeekView Enabled="False"/>
|
||||
<dxsch:SchedulerControl.WeekView >
|
||||
<dxsch:WeekView Enabled="false"/>
|
||||
</dxsch:SchedulerControl.WeekView>
|
||||
<dxsch:SchedulerControl.WorkWeekView>
|
||||
<dxsch:WorkWeekView Enabled="False"/>
|
||||
<dxsch:WorkWeekView />
|
||||
</dxsch:SchedulerControl.WorkWeekView>
|
||||
<dxsch:SchedulerControl.TimelineView>
|
||||
<dxsch:TimelineView ResourcesPerPage="10" IntervalCount="31" TimelineScrollBarVisibility="Auto" >
|
||||
<dxsch:TimelineView ResourcesPerPage="10" IntervalCount="31" TimelineScrollBarVisibility="Auto" AppointmentToolTipVisibility="Never" >
|
||||
<dxsch:TimelineView.Scales>
|
||||
<XtraScheduler:TimeScaleYear/>
|
||||
<XtraScheduler:TimeScaleMonth/>
|
||||
<XtraScheduler:TimeScaleDay/>
|
||||
</dxsch:TimelineView.Scales>
|
||||
<dxsch:TimelineView.AppointmentDisplayOptions>
|
||||
<dxsch:SchedulerTimelineViewAppointmentDisplayOptions SnapToCellsMode="Auto" EndTimeVisibility="Never" StartTimeVisibility="Never"/>
|
||||
</dxsch:TimelineView.AppointmentDisplayOptions>
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media;
|
||||
@@ -21,6 +22,7 @@ using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Translation;
|
||||
|
||||
using DevExpress.Services;
|
||||
using DevExpress.XtraScheduler;
|
||||
using DevExpress.Xpf.Scheduler;
|
||||
using DevExpress.Xpf.Scheduler.Native;
|
||||
@@ -29,7 +31,8 @@ using SchedulerStorage = DevExpress.Xpf.Scheduler.SchedulerStorage;
|
||||
using ResourceStorage = DevExpress.Xpf.Scheduler.ResourceStorage;
|
||||
using AppointmentStorage = DevExpress.Xpf.Scheduler.AppointmentStorage;
|
||||
using IAppointmentLabelStorage = DevExpress.Xpf.Scheduler.AppointmentLabelCollection;
|
||||
using DevExpress.Services;
|
||||
using BeWo.Scheduler.View;
|
||||
using AppointmentLabel = DevExpress.Xpf.Scheduler.AppointmentLabel;
|
||||
|
||||
namespace BeWo.View.Detail.Report
|
||||
{
|
||||
@@ -39,147 +42,60 @@ namespace BeWo.View.Detail.Report
|
||||
public partial class AbwesenheitstabelleView : BeWoView
|
||||
{
|
||||
private SchedulerStorage _SchedularStorage;
|
||||
private IAppointmentLabelStorage _LabelStorage;
|
||||
private ResourceStorage _ResourceStorage;
|
||||
private AppointmentStorage _AppointmentStorage;
|
||||
private IAppointmentLabelStorage _LabelStorage;
|
||||
private Dictionary<long, EmployeeDC> _Employees;
|
||||
|
||||
private List<AbsenceReasonDC> _AbsenceReasonDCs;
|
||||
|
||||
public AbwesenheitstabelleView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_SchedularStorage = _SchedularControl.Storage;
|
||||
_ResourceStorage = _SchedularControl.Storage.ResourceStorage;
|
||||
_AppointmentStorage = _SchedularControl.Storage.AppointmentStorage;
|
||||
_LabelStorage = _SchedularControl.Storage.AppointmentStorage.Labels;
|
||||
_SchedularStorage = _SchedulerControl.Storage;
|
||||
_LabelStorage = _SchedulerControl.Storage.AppointmentStorage.Labels;
|
||||
_ResourceStorage = _SchedulerControl.Storage.ResourceStorage;
|
||||
_AppointmentStorage = _SchedulerControl.Storage.AppointmentStorage;
|
||||
|
||||
var timeline = _SchedularControl.TimelineView;
|
||||
|
||||
_AppointmentStorage.CustomFieldMappings.Add(new SchedulerCustomFieldMapping("AbsenceTime", "AbsenceTime"));
|
||||
_SchedularStorage.AppointmentsInserted += _SchedularStorage_AppointmentsInserted;
|
||||
_SchedularStorage.AppointmentInserting += _SchedularStorage_AppointmentInserting;
|
||||
_SchedulerControl.TimelineView.VerticalResourceHeaderStyle = (Style)this.FindResource("VerticalResourceHeaderStyle");
|
||||
|
||||
ServiceFacade.DoEmployeeServiceAsync(
|
||||
s => s.GetAllEmployees(),
|
||||
r => this.Dispatch(delegate
|
||||
{
|
||||
_Employees = new Dictionary<long, EmployeeDC>();
|
||||
|
||||
foreach (var emp in r.Where(x => x.EmployeeOid.HasValue))
|
||||
{
|
||||
_Employees.Add(emp.EmployeeOid.Value, emp);
|
||||
}
|
||||
}));
|
||||
|
||||
ServiceFacade.DoOperationsServiceAsync(
|
||||
s => s.GetAllAbsenceReason(),
|
||||
r => this.Dispatch(delegate
|
||||
{
|
||||
_LabelStorage.Clear();
|
||||
|
||||
foreach (var reason in r)
|
||||
{
|
||||
var label = _LabelStorage.CreateNewLabel(reason, reason.Description);
|
||||
label.Color = (Color)ColorConverter.ConvertFromString(reason.Color);
|
||||
_LabelStorage.Add(label);
|
||||
}
|
||||
}));
|
||||
|
||||
foreach (var item in _SchedularControl.TimelineView.Scales)
|
||||
{
|
||||
item.Enabled = false;
|
||||
item.Visible = false;
|
||||
}
|
||||
|
||||
_SchedularControl.TimelineView.Scales[0].Enabled = true;
|
||||
_SchedularControl.TimelineView.Scales[0].Visible = true;
|
||||
|
||||
_SchedularControl.TimelineView.Scales[2].Enabled = true;
|
||||
_SchedularControl.TimelineView.Scales[2].Visible = true;
|
||||
|
||||
_SchedularControl.TimelineView.Scales[4].Enabled = true;
|
||||
_SchedularControl.TimelineView.Scales[4].Visible = true;
|
||||
|
||||
_SchedularControl.TimelineView.VerticalResourceHeaderStyle = (Style)this.FindResource("VerticalResourceHeaderStyle");
|
||||
|
||||
IMouseHandlerService oldMouseHandler = (IMouseHandlerService)_SchedularControl.GetService(typeof(IMouseHandlerService));
|
||||
IMouseHandlerService oldMouseHandler = (IMouseHandlerService)_SchedulerControl.GetService(typeof(IMouseHandlerService));
|
||||
|
||||
if (oldMouseHandler != null)
|
||||
{
|
||||
MouseHandlerService newMouseHandler =
|
||||
new MouseHandlerService(_SchedularControl, oldMouseHandler);
|
||||
_SchedularControl.RemoveService(typeof(IMouseHandlerService));
|
||||
_SchedularControl.AddService(typeof(IMouseHandlerService), newMouseHandler);
|
||||
new MouseHandlerService(_SchedulerControl, oldMouseHandler);
|
||||
_SchedulerControl.RemoveService(typeof(IMouseHandlerService));
|
||||
_SchedulerControl.AddService(typeof(IMouseHandlerService), newMouseHandler);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void _SchedularStorage_AppointmentInserting(object sender, PersistentObjectCancelEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void _SchedularStorage_AppointmentsInserted(object sender, PersistentObjectsEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ServiceFacade.DoOperationsServiceAsync(
|
||||
s => s.GetAbsenceTimeDCsFilter(new DateTime(2000, 1, 1), new DateTime(2020, 1, 1)),
|
||||
r => this.Dispatch(delegate
|
||||
{
|
||||
_SchedularStorage.BeginUpdate();
|
||||
try
|
||||
{
|
||||
_ResourceStorage.Clear();
|
||||
_AppointmentStorage.Clear();
|
||||
|
||||
var allEmps = r.Select(x => x.EmployeeOid.Value);
|
||||
var empGotAbsenceTime = _Employees.Where(x => allEmps.Contains(x.Key)).Select(x => x.Value).OrderBy(x => x.LastNameFirstName);
|
||||
|
||||
foreach (var emp in empGotAbsenceTime)
|
||||
{
|
||||
AddResource((int)emp.EmployeeOid.Value, emp.LastNameFirstName);
|
||||
}
|
||||
|
||||
var geordnet = _Employees.OrderBy(x => x.Value.LastNameFirstName).Select(x => x.Value);
|
||||
|
||||
foreach (var emp in geordnet)
|
||||
{
|
||||
foreach (var absence in r.Where(x => x.EmployeeOid == emp.EmployeeOid))
|
||||
{
|
||||
var name = emp.LastNameFirstName;
|
||||
var app = CreateAppointment(absence);
|
||||
_AppointmentStorage.Add(app);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_SchedularStorage.EndUpdate();
|
||||
}
|
||||
}));
|
||||
|
||||
_SchedularControl.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void AddResource(int index, string caption)
|
||||
{
|
||||
var r = _SchedularStorage.CreateResource(index.ToString());
|
||||
|
||||
r.SetColor(Colors.White);
|
||||
r.Caption = caption;
|
||||
|
||||
_ResourceStorage.Add(r);
|
||||
}
|
||||
|
||||
private Appointment CreateAppointment(AbsenceTimeDC absence)
|
||||
{
|
||||
var app = _SchedularStorage.CreateAppointment(AppointmentType.Normal);
|
||||
|
||||
app.Subject = absence.Reason.Description;
|
||||
app.Start = absence.Start.Value;
|
||||
app.Duration = absence.End.HasValue ? absence.End.Value.AddDays(1) - absence.Start.Value : TimeSpan.MaxValue;
|
||||
app.ResourceId = absence.EmployeeOid.Value.ToString();
|
||||
app.CustomFields.Add(new DevExpress.XtraScheduler.Native.CustomField("Color", "Color"));
|
||||
app.CustomFields["Color"] = absence.Reason.Color;
|
||||
app.LabelKey = absence.Reason;
|
||||
|
||||
return app;
|
||||
Update();
|
||||
}
|
||||
|
||||
private void SchedularControl_EditAppointmentFormShowing(object sender, EditAppointmentFormEventArgs e)
|
||||
{
|
||||
//e.Cancel = true;
|
||||
//e.Form = new TeamView(new TeamVM(new TeamDC()));
|
||||
var apt = e.Appointment;
|
||||
|
||||
e.AllowResize = false;
|
||||
|
||||
|
||||
e.Form = new AbwesenheitsEditView(_SchedulerControl, apt, (AbsenceTimeDC)apt.CustomFields["AbsenceTime"], _AbsenceReasonDCs);
|
||||
}
|
||||
|
||||
private void SchedularControl_EditRecurrentAppointmentFormShowing(object sender, EditAppointmentFormEventArgs e)
|
||||
@@ -187,16 +103,76 @@ namespace BeWo.View.Detail.Report
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
private void SchedulerControl_AppointmentViewInfoCustomizing(object sender, DevExpress.Xpf.Scheduler.AppointmentViewInfoCustomizingEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void SpinEdit_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
|
||||
{
|
||||
if (e.NewValue == null || !int.TryParse(e.NewValue.ToString(), out var count))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (count > 0)
|
||||
_SchedulerControl.TimelineView.IntervalCount = count;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
_AbsenceReasonDCs = ServiceFacade.DoOperationsServiceSync(x => x
|
||||
.GetAllAbsenceReason());
|
||||
|
||||
var absenceTimes = ServiceFacade.DoOperationsServiceSync(x => x
|
||||
.GetAbsenceTimeDCsFilter(new DateTime(2000, 1, 1), new DateTime(2021, 1, 1)))
|
||||
.Where(f => f.EmployeeOid.HasValue)
|
||||
.ToList();
|
||||
|
||||
var empIDs = absenceTimes.Select(x => x.EmployeeOid.Value).Distinct().ToList();
|
||||
|
||||
var empWithAbsence = ServiceFacade.DoEmployeeServiceSync(x => x
|
||||
.GetAllEmployees()
|
||||
.Where(emp => empIDs.Contains(emp.EmployeeOid.Value)))
|
||||
.ToList()
|
||||
.OrderBy(x => x.LastNameFirstName);
|
||||
|
||||
try
|
||||
{
|
||||
_SchedularControl.TimelineView.IntervalCount = count;
|
||||
_SchedularStorage.BeginUpdate();
|
||||
|
||||
_LabelStorage.Clear();
|
||||
foreach (var reason in _AbsenceReasonDCs)
|
||||
{
|
||||
var label = _LabelStorage.CreateNewLabel(reason.AbsenceReasonOid.ToString(), reason.Description);
|
||||
|
||||
label.Color = (Color)ColorConverter.ConvertFromString(reason.Color);
|
||||
|
||||
_LabelStorage.Add(label);
|
||||
}
|
||||
|
||||
_ResourceStorage.Clear();
|
||||
foreach (var employee in empWithAbsence)
|
||||
{
|
||||
var resource = _SchedularStorage.CreateResource(employee.EmployeeOid.Value.ToString());
|
||||
|
||||
resource.Caption = employee.LastNameFirstName;
|
||||
|
||||
_ResourceStorage.Add(resource);
|
||||
}
|
||||
|
||||
_AppointmentStorage.Clear();
|
||||
foreach (var absenceTime in absenceTimes)
|
||||
{
|
||||
var appointment = _SchedularStorage.CreateAppointment(AppointmentType.Normal);
|
||||
|
||||
SchedulerHelper.OverrideAWithB(appointment, absenceTime);
|
||||
|
||||
_AppointmentStorage.Add(appointment);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_SchedularStorage.EndUpdate();
|
||||
_SchedulerControl.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,8 +189,24 @@ namespace BeWo.View.Detail.Report
|
||||
|
||||
public override void OnMouseWheel(System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ((System.Windows.Forms.Control.ModifierKeys & System.Windows.Forms.Keys.Control) != System.Windows.Forms.Keys.Control)
|
||||
if ((System.Windows.Forms.Control.ModifierKeys & Keys.Control) != Keys.Control)
|
||||
base.OnMouseWheel(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SchedulerHelper
|
||||
{
|
||||
public static void OverrideAWithB(Appointment appointment, AbsenceTimeDC absenceTime)
|
||||
{
|
||||
appointment.AllDay = true;
|
||||
appointment.Subject = absenceTime.Reason.Description;
|
||||
appointment.Start = absenceTime.Start.Value;
|
||||
appointment.End = (absenceTime.End ?? DateTime.MaxValue.AddDays(-1)).AddHours(23);
|
||||
appointment.ResourceId = absenceTime.EmployeeOid.Value.ToString();
|
||||
appointment.LabelKey = absenceTime.Reason.AbsenceReasonOid.ToString();
|
||||
appointment.Description = absenceTime.Notice;
|
||||
appointment.CustomFields["AbsenceTime"] = null;
|
||||
appointment.CustomFields["AbsenceTime"] = absenceTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -855,5 +855,17 @@ namespace BeWo.Service.ServiceContracts
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
IList<AbsenceReasonDC> GetAllAbsenceReason();
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
AbsenceTimeDC UpdateAbsenceTimeWithReturn(AbsenceTimeDC absenceTimeDC);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
AbsenceTimeDC InsertAbsenceTimeWithReturn(AbsenceTimeDC absenceTimeDC);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
void DeleteAbsenceTime(AbsenceTimeDC absenceTimeDC);
|
||||
}
|
||||
}
|
||||
@@ -5892,5 +5892,64 @@ namespace BeWo.Service.ServiceImplementations
|
||||
var list = DAOFactory.GenericDAO.GetAllActive<AbsenceReason>();
|
||||
return MapperFactory.AbsenceReasonDC_AbsenceReason.MapToNewDCs(list);
|
||||
}
|
||||
|
||||
public AbsenceTimeDC UpdateAbsenceTimeWithReturn(AbsenceTimeDC abs)
|
||||
{
|
||||
try
|
||||
{
|
||||
var testbefore = abs.AbsenceTimeVersion;
|
||||
|
||||
var x = DAOFactory.GenericDAO.LoadByID<AbsenceTime>(abs.AbsenceTimeOid.Value);
|
||||
|
||||
MapperFactory.AbsenceTimeDC_AbsenceTime.MergeWithEntity(abs, x);
|
||||
|
||||
DAOFactory.GenericDAO.Update(x);
|
||||
|
||||
var y = DAOFactory.GenericDAO.LoadByID<AbsenceTime>(abs.AbsenceTimeOid.Value);
|
||||
|
||||
var z = MapperFactory.AbsenceTimeDC_AbsenceTime.MapToNewDC(y);
|
||||
|
||||
return z;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw Utils.CreateBeWoFaultException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public AbsenceTimeDC InsertAbsenceTimeWithReturn(AbsenceTimeDC absenceTimeDC)
|
||||
{
|
||||
try
|
||||
{
|
||||
var emp = DAOFactory.GenericDAO.GetByID<Employee>(absenceTimeDC.EmployeeOid.Value);
|
||||
emp.AbsenceTimes.Add(MapperFactory.AbsenceTimeDC_AbsenceTime.MapToNewEntity(absenceTimeDC));
|
||||
DAOFactory.GenericDAO.Update(emp);
|
||||
|
||||
emp = DAOFactory.GenericDAO.LoadByID<Employee>(absenceTimeDC.EmployeeOid.Value);
|
||||
var newAbsenceTimeOid = emp.AbsenceTimes.Max(x => x.Oid);
|
||||
var newAbsenceTimeDC = DAOFactory.GenericDAO.GetByID<AbsenceTime>(newAbsenceTimeOid.Value);
|
||||
|
||||
newAbsenceTimeDC.EmployeeOid = emp.Oid;
|
||||
return MapperFactory.AbsenceTimeDC_AbsenceTime.MapToNewDC(newAbsenceTimeDC);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw Utils.CreateBeWoFaultException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteAbsenceTime(AbsenceTimeDC absenceTimeDC)
|
||||
{
|
||||
try
|
||||
{
|
||||
var emp = DAOFactory.GenericDAO.GetByID<Employee>(absenceTimeDC.EmployeeOid.Value);
|
||||
emp.AbsenceTimes.Remove(emp.AbsenceTimes.First(a => a.Oid == absenceTimeDC.AbsenceTimeOid));
|
||||
DAOFactory.GenericDAO.Update(emp);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw Utils.CreateBeWoFaultException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user