Die Eingrenzung des Zeitraums in der Zeiterfassung funktioniert jetzt auch ohne Hilfeplan.

Code aufgeräumt.
This commit is contained in:
staccatomamba
2017-08-30 14:52:04 +02:00
parent 2908966c77
commit 6fef133548
3 changed files with 78 additions and 189 deletions

View File

@@ -19,10 +19,7 @@
xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon"
Height="Auto" Width="Auto" VerticalAlignment="Stretch" Focusable="True" HorizontalAlignment="Stretch">
<localView:BeWoView.Resources>
<dxre:RichEditUICommand x:Key="commands" />
<dxre:RichEditUICommand x:Key="commands" />
<Style TargetType="{x:Type Button}" x:Key="DockPanelMaximizeButtonStyle">
<Style.Setters>
<Setter Property="Template">
@@ -291,7 +288,7 @@
Unchecked="ChkGroupBooking_Unchecked" />
<CheckBox Content="Mehrfachbuchung erstellen" Margin="10,3,0,2" IsChecked="False"
x:Name="chkMultiBooking" Checked="ChkMultiBooking_Checked"
Unchecked="chkMultiBooking_Unchecked" />
Unchecked="ChkMultiBooking_Unchecked" />
<!--<CheckBox Content="Wohnheimbuchung erstellen" Margin="10,3,0,2" IsChecked="False"
x:Name="chkWohnheimBooking" Checked="ChkWohnheimBookingChecked"
Unchecked="ChkWohnheimBookingUnchecked" />-->
@@ -442,18 +439,12 @@
</Grid>
</Border>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
</Trigger>
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}, Mode=FindAncestor}}"
Value="True">
</DataTrigger>
<Trigger Property="IsMouseOver" Value="True" />
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}, Mode=FindAncestor}}" Value="True" />
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
<Grid Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Top" x:Name="zeitraumGrid">
@@ -510,14 +501,15 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="von " />
<dxe:DateEdit Grid.Column="1" Grid.Row="0"
x:Name="NDay_Von" Width="80" Margin="3,3,3,3" MaskType="DateTimeAdvancingCaret" EditValue="{val:ValidationBinding Mode=TwoWay, Path=XTageVon}"/>
x:Name="NDay_Von" Width="80" Margin="3,3,3,3" MaskType="DateTimeAdvancingCaret"
EditValue="{val:ValidationBinding Mode=TwoWay, Path=XTageVon}" />
<Label Grid.Column="2" Grid.Row="0" Content="bis" />
<dxe:DateEdit Grid.Column="3" Grid.Row="0"
x:Name="NDay_Bis" Width="80" Margin="3,3,3,3" MaskType="DateTimeAdvancingCaret" EditValue="{val:ValidationBinding Mode=TwoWay, Path=XTageBis}" />
x:Name="NDay_Bis" Width="80" Margin="3,3,3,3" MaskType="DateTimeAdvancingCaret"
EditValue="{val:ValidationBinding Mode=TwoWay, Path=XTageBis}" />
</Grid>
@@ -911,7 +903,7 @@
<!--increas font size muss vllt raus-->
<DockPanel Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left">
<Button Margin="3" Content="1" FontFamily="Webdings" Click="RTFVollBildDokuButton_OnClick" />
<Button Margin="3" Content="1" FontFamily="Webdings" Click="RTFVollbildDokuButton_OnClick" />
<Button Margin="3" Content="A+" HorizontalAlignment="Center" Click="IncreaseFontSizeBtn_Click" />
<Button Margin="3" Content="A-" Click="DecreaseFontSizeBtn_Click" />
</DockPanel>
@@ -1000,7 +992,7 @@
<!--increas font size muss vllt raus-->
<DockPanel Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left">
<Button Margin="3" Content="1" FontFamily="Webdings" Click="RTFVollBildDokuButton_OnClick" />
<Button Margin="3" Content="1" FontFamily="Webdings" Click="RTFVollbildDokuButton_OnClick" />
<Button Margin="3" Content="A+" HorizontalAlignment="Center" Click="IncreaseFontSizeBtn_Click" />
<Button Margin="3" Content="A-" Click="DecreaseFontSizeBtn_Click" />
</DockPanel>
@@ -1086,7 +1078,7 @@
<!--increas font size muss vllt raus-->
<DockPanel Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left">
<Button Margin="3" Content="1" FontFamily="Webdings" Click="RTFVollBildDokuButton_OnClick" />
<Button Margin="3" Content="1" FontFamily="Webdings" Click="RTFVollbildDokuButton_OnClick" />
<Button Margin="3" Content="A+" HorizontalAlignment="Center" Click="IncreaseFontSizeBtn_Click" />
<Button Margin="3" Content="A-" Click="DecreaseFontSizeBtn_Click" />
</DockPanel>
@@ -1172,7 +1164,7 @@
<!--increas font size muss vllt raus-->
<DockPanel Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left">
<Button Margin="3" Content="1" FontFamily="Webdings" Click="RTFVollBildDokuButton_OnClick" />
<Button Margin="3" Content="1" FontFamily="Webdings" Click="RTFVollbildDokuButton_OnClick" />
<Button Margin="3" Content="A+" HorizontalAlignment="Center" Click="IncreaseFontSizeBtn_Click" />
<Button Margin="3" Content="A-" Click="DecreaseFontSizeBtn_Click" />
</DockPanel>
@@ -1258,7 +1250,7 @@
<!--increas font size muss vllt raus-->
<DockPanel Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left">
<Button Margin="3" Content="1" FontFamily="Webdings" Click="RTFVollBildDokuButton_OnClick" />
<Button Margin="3" Content="1" FontFamily="Webdings" Click="RTFVollbildDokuButton_OnClick" />
<Button Margin="3" Content="A+" HorizontalAlignment="Center" Click="IncreaseFontSizeBtn_Click" />
<Button Margin="3" Content="A-" Click="DecreaseFontSizeBtn_Click" />
</DockPanel>

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.IO;
@@ -36,9 +35,6 @@ using DevExpress.Xpf.Core;
using DevExpress.Xpf.Docking;
using DevExpress.Xpf.Docking.Platform;
using DevExpress.Xpf.Editors;
using DevExpress.Xpf.RichEdit;
using DevExpress.XtraPrinting.Native;
using DevExpress.XtraRichEdit;
using Microsoft.Win32;
using VerticalAlignment = System.Windows.VerticalAlignment;
@@ -77,7 +73,7 @@ namespace BeWo.View.Detail
private bool _IgnoreGroupMultiCheck;
private int lastPosition = 0;
private int lastPosition;
public static double DocumentationTextBoxFontSize
{
@@ -94,7 +90,7 @@ namespace BeWo.View.Detail
InitializeComponent();
multiSupportConceptControl.AutoGetAllAfterLoaded = false;
multiSupportConceptControl.EditGroupButtonClicked += multiSupportConceptControl_EditGroupButtonClicked;
multiSupportConceptControl.EditGroupButtonClicked += MultiSupportConceptControl_EditGroupButtonClicked;
popup_content.Visibility = Visibility.Hidden;
InsertedByColumn.Visible = !BeWoApp.AppSettings.HideServiceRecordInsertedByAndInsertedOn;
@@ -2128,7 +2124,7 @@ namespace BeWo.View.Detail
SelectedItemChanged(SupportConceptService.CreateFlatSupportConceptItem(multiSupportConceptControl.SelectedItem, null));
}
private void chkMultiBooking_Unchecked(object sender, RoutedEventArgs e)
private void ChkMultiBooking_Unchecked(object sender, RoutedEventArgs e)
{
if (_IgnoreGroupMultiCheck)
{
@@ -3020,7 +3016,7 @@ namespace BeWo.View.Detail
_GroupOfPeopleModalPopUp.SaveData();
}
void multiSupportConceptControl_EditGroupButtonClicked(object sender, EventArgs e)
private void MultiSupportConceptControl_EditGroupButtonClicked(object sender, EventArgs e)
{
OpenGroupEditView();
}
@@ -4197,7 +4193,7 @@ namespace BeWo.View.Detail
private ServiceRecordRTFWindowView _rtfWindowView;
private void RTFVollBildDokuButton_OnClick(object sender, RoutedEventArgs e)
private void RTFVollbildDokuButton_OnClick(object sender, RoutedEventArgs e)
{
string stringtheorie = "";
string rtfStringTheorie = "";
@@ -4611,7 +4607,5 @@ namespace BeWo.View.Detail
BeWoApp.SaveAppSettings();
}
}
}
}

View File

@@ -222,15 +222,13 @@ namespace BeWo.ViewModel.ListViewModel
public List<CompactWohnheimDC> AlleWohnheime { get; private set; }
//######################### ServiceRecordTimeInterval Erweiterung #############################
public int XTage
{
get { return _XTage; }
set
{
if (_XTage != value)
if (AreDifferent(_XTage, value))
{
_XTage = value;
ServiceRecordTimeInterval = ServiceRecordTimeInterval.XTage;
@@ -240,21 +238,15 @@ namespace BeWo.ViewModel.ListViewModel
BuildServiceRecordsForSelectedTreeNode(true);
}
}
}
}
public DateTime? XTageBis
{
get
{
if (_XTageBis == null)
{
_XTageBis = DateTime.Now;
}
return _XTageBis;
}
get { return _XTageBis ?? (_XTageBis = DateTime.Now); }
set
{
if (_XTageBis != value) //null ersetzen durch _XTageBis
if (AreDifferent(_XTageBis, value))
{
_XTageBis = value;
ServiceRecordTimeInterval = ServiceRecordTimeInterval.ZeitraumWaehlen;
@@ -265,26 +257,17 @@ namespace BeWo.ViewModel.ListViewModel
}
BuildServiceRecordsForSelectedTreeNode(true);
}
}
}
}
public DateTime? XTageVon
{
get
{
if (_XTageVon == null)
{
_XTageVon = new DateTime(DateTime.Now.Year, DateTime.Now.Month,1,0,0,0);
}
return _XTageVon;
}
get { return _XTageVon ?? (_XTageVon = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1, 0, 0, 0)); }
set
{
if (_XTageVon != value)//null ersetzen durch _XTageVon
if (AreDifferent(_XTageVon, value))
{
_XTageVon = value;
ServiceRecordTimeInterval = ServiceRecordTimeInterval.ZeitraumWaehlen;
@@ -294,7 +277,6 @@ namespace BeWo.ViewModel.ListViewModel
}
}
//###########################################################################################################
public List<SupportConceptPeriodStatisticsVM> Statistics
{
get { return _Statistics; }
@@ -530,7 +512,7 @@ namespace BeWo.ViewModel.ListViewModel
get { return (x, y) => y.Date.Value.CompareTo(x.Date.Value); }
}
DateTime? enddate;
private DateTime? enddate;
public List<ServiceRecordVM> CreateFromPrototype()
{
@@ -759,7 +741,7 @@ namespace BeWo.ViewModel.ListViewModel
}
}
private void InitNewDC(ServiceRecordDC newDc, FlatSupportConceptTreeNodeDC selectedCustomerNode)
private static void InitNewDC(ServiceRecordDC newDc, FlatSupportConceptTreeNodeDC selectedCustomerNode)
{
if (selectedCustomerNode != null && selectedCustomerNode.SupportConceptTreeNodeDC != null)
{
@@ -858,55 +840,29 @@ namespace BeWo.ViewModel.ListViewModel
case ServiceRecordTimeInterval.XTage:
days = _XTage;
break;
//case ServiceRecordTimeInterval.ZeitraumWaehlen:
// //zu test zwecken
// var x = XTageBis.Value.Date - XTageVon.Value.Date;
// days = (long)x.TotalDays;
// break;
}
if (WithoutClient)
{
CompactEmployeeDC emp = mSelectedEmployee ?? BeWoApp.LoggedOnUser.Employee;
var emp = mSelectedEmployee ?? BeWoApp.LoggedOnUser.Employee;
PrototypeVM.UpdateServiceAccountings(null, _Category2Services, false);
// TODO: Tage beachten
//if (!_EmployeeServiceRecordsLoaded.ContainsKey(emp) && DispatcherObject != null)
if (DispatcherObject != null)
if (DispatcherObject != null && ServiceRecordTimeInterval != ServiceRecordTimeInterval.ZeitraumWaehlen)
{
ServiceFacade.DoOperationsServiceAsync(s => s.GetEmployeesServiceRecords2(emp.EmployeeOid, days),
r => DispatcherObject.Dispatch(delegate
{
VMList.Clear();
foreach (ServiceRecordDC dc in r)
AddServiceRecordToList(dc, null, null, null);
//_EmployeeServiceRecordsLoaded.Add(emp, true);
// BuildServiceRecordsForTreeNode(_SelectedCustomerNode);
// if (!_CustomerServiceRecordsLoaded.ContainsKey(customer))
// _CustomerServiceRecordsLoaded.Add(customer, true);
BuildServiceRecordsForTreeNode(null, true, null);
}));
PrepareListVM(r, null, null, null, null, true, null);
}));
}
else if (DispatcherObject != null && ServiceRecordTimeInterval == ServiceRecordTimeInterval.ZeitraumWaehlen)
{
ServiceFacade.DoOperationsServiceAsync(s => s.GetEmployeesServiceRecordsWithStartEndDate(emp.EmployeeOid, XTageVon.Value, XTageBis.Value),
r => DispatcherObject.Dispatch(delegate
{
VMList.Clear();
foreach (ServiceRecordDC dc in r)
AddServiceRecordToList(dc, null, null, null);
//_EmployeeServiceRecordsLoaded.Add(emp, true);
// BuildServiceRecordsForTreeNode(_SelectedCustomerNode);
// if (!_CustomerServiceRecordsLoaded.ContainsKey(customer))
// _CustomerServiceRecordsLoaded.Add(customer, true);
BuildServiceRecordsForTreeNode(null, true, null);
}));
PrepareListVM(r, null, null, null, null, true, null);
}));
}
else
{
@@ -914,7 +870,7 @@ namespace BeWo.ViewModel.ListViewModel
}
PrototypeVM.ChangeGoalTree(null, null);
}//hier ne abfrage zwischen und ein service ausführen um alle rauszuholen vllt
}
else
{
if (_SelectedCustomerNode != null)
@@ -928,73 +884,40 @@ namespace BeWo.ViewModel.ListViewModel
}
else
{
CompactCustomerDC customer = _SelectedCustomerNode.SupportConceptTreeNodeDC.Customer;
var customer = _SelectedCustomerNode.SupportConceptTreeNodeDC.Customer;
if (customer != null)
{
CompactSupportConceptDC scDC = _SelectedCustomerNode.SupportConceptTreeNodeDC.SupportConcept;
var scDC = _SelectedCustomerNode.SupportConceptTreeNodeDC.SupportConcept;
SupportConceptTreeNodeDetailInfoDC infoDC;
List<ValueListEntryDC> goalCats = null;
List<ValueListEntryDC> goalCats = null;
List<ValueListEntryDC> goals = null;
List<ValueListEntryDC> goalsAndCats = null;
long cb2scOid = _SelectedCustomerNode.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.CostBearer2SupportConceptOid.Value;
var cb2scOid = _SelectedCustomerNode.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.CostBearer2SupportConceptOid.Value;
if (_CostBearer2SupportConceptOid2BookingInfoDict.ContainsKey(cb2scOid))
_CostBearer2SupportConceptOid2BookingInfoDict.Remove(cb2scOid);
//if (!_CostBearer2SupportConceptOid2BookingInfoDict.ContainsKey(cb2scOid))
//{
long? scOidForGoals = null;
{
_CostBearer2SupportConceptOid2BookingInfoDict.Remove(cb2scOid);
}
scOidForGoals = scDC.SupportConceptOid;
long? scOidForGoals = scDC.SupportConceptOid;
infoDC = ServiceFacade.DoOperationsServiceSync(s => s.GetSupportConceptTreeNodeDetailInfo(customer.CustomerOid, scOidForGoals, cb2scOid));
var infoDC = ServiceFacade.DoOperationsServiceSync(s => s.GetSupportConceptTreeNodeDetailInfo(customer.CustomerOid, scOidForGoals, cb2scOid));
_CostBearer2SupportConceptOid2BookingInfoDict.Add(cb2scOid, infoDC);
//}
//else
//{
// infoDC = _CostBearer2SupportConceptOid2BookingInfoDict[cb2scOid];
//}
//if (scDC != null)
//{
// var sc = ServiceFacade.DoCustomerServiceSync(s => s.GetSupportConceptsById(new List<long> { scDC.SupportConceptOid })).First();
// goalsAndCats = new List<ValueListEntryDC>(sc.Goals);
// var goalCategoryDict = _AllGoalCategories.ToDictionary(goalCat => goalCat.ValueListEntryOid.Value);
// Parents = new List<ValueListEntryDC>();
// foreach (var child in goalsAndCats)
// {
// if (child.Type.Equals(ValueListEntryType.SupportConceptGoalCategoryType) ||
// child.Type.Equals(ValueListEntryType.SupportConceptGoalType) ||
// child.Type.Equals(ValueListEntryType.SupportConceptIndividualGoalCategoryType))
// {
// GetGoalParents(child, goalCategoryDict);
// }
// }
// goalsAndCats.AddRange(Parents);
//}
if (infoDC != null && infoDC.SupportConceptGoals != null && infoDC.SupportConceptGoals.Count > 0)
{
goalCats = new List<ValueListEntryDC>();
goals = new List<ValueListEntryDC>();
var goalCategoryDict = _AllGoalCategories.ToDictionary(goalCat => goalCat.ValueListEntryOid.Value);
Dictionary<long, ValueListEntryDC> goalCategoryDict = _AllGoalCategories.ToDictionary(goalCat => goalCat.ValueListEntryOid.Value);
foreach (ValueListEntryDC goal in infoDC.SupportConceptGoals)
foreach (var goal in infoDC.SupportConceptGoals)
{
if (goal.ParentOid != null && goalCategoryDict.ContainsKey(goal.ParentOid.Value))
{
IEnumerable<ValueListEntryDC> path = GetAllParentGoalCategoies(goalCategoryDict, goal);
var path = GetAllParentGoalCategoies(goalCategoryDict, goal);
foreach (var goalCat in path)
{
goalCats.Add(goalCat);
@@ -1010,65 +933,29 @@ namespace BeWo.ViewModel.ListViewModel
_SelectedCustomerNode.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.ApprovalPeriodList = infoDC.ApprovalPeriods;
if (!IsGroupBooking && !IsMultiBooking)
PrototypeVM.UpdateServiceAccountings(infoDC.ServiceAccountings, _Category2Services, true);
{
PrototypeVM.UpdateServiceAccountings(infoDC.ServiceAccountings, _Category2Services, true);
}
}
String key = String.Format("{0}_{1}", customer.Oid, cb2scOid);
//bool refresh = true;
//if (!forceRefreshServiceRecords && _ServiceRecordsLoaded.ContainsKey(key))
//{
// long maxDaysInCache = _ServiceRecordsLoaded[key];
// if ((days ?? long.MaxValue) <= maxDaysInCache)
// refresh = false;
//}
//if (!refresh)
// BuildServiceRecordsForTreeNode(_SelectedCustomerNode, true, OnlyWithThisType);
//else
//{
if (DispatcherObject != null && ServiceRecordTimeInterval != ServiceRecordTimeInterval.ZeitraumWaehlen)
{
ServiceFacade.DoOperationsServiceAsync(
s =>
s.GetCustomerServiceRecordsCompact(customer.CustomerOid, cb2scOid, days),
s => s.GetCustomerServiceRecordsCompact(customer.CustomerOid, cb2scOid, days),
r => DispatcherObject.Dispatch(delegate
{
VMList.Clear();
foreach (ServiceRecordDC dc in r)
AddServiceRecordToList(dc, goalCats, goals, _SelectedCustomerNode);
BuildServiceRecordsForTreeNode(_SelectedCustomerNode, true, OnlyWithThisType);
//_ServiceRecordsLoaded[key] = (days ?? long.MaxValue);
if (refreshFinishedCallback != null)
refreshFinishedCallback();
PrepareListVM(r, goalCats, goals, _SelectedCustomerNode, refreshFinishedCallback, true, OnlyWithThisType);
}));
}
else if (DispatcherObject != null && ServiceRecordTimeInterval == ServiceRecordTimeInterval.ZeitraumWaehlen)
{
ServiceFacade.DoOperationsServiceAsync(
s => s.GetCustomerServiceRecordsCompactWithStartEndDate(customer.CustomerOid, cb2scOid, XTageVon.Value, XTageBis.Value),
r => DispatcherObject.Dispatch(delegate
{
PrepareListVM(r, goalCats, goals, _SelectedCustomerNode, refreshFinishedCallback, true, OnlyWithThisType);
}));
}else
if (DispatcherObject != null && ServiceRecordTimeInterval == ServiceRecordTimeInterval.ZeitraumWaehlen)
{
//Hole alle des Bestimmten Zeitraumes
ServiceFacade.DoOperationsServiceAsync(
s =>
s.GetCustomerServiceRecordsCompactWithStartEndDate(customer.CustomerOid, cb2scOid, XTageVon.Value, XTageBis.Value),
r => DispatcherObject.Dispatch(delegate
{
VMList.Clear();
foreach (ServiceRecordDC dc in r)
AddServiceRecordToList(dc, goalCats, goals, _SelectedCustomerNode);
BuildServiceRecordsForTreeNode(_SelectedCustomerNode, true, OnlyWithThisType);
//_ServiceRecordsLoaded[key] = (days ?? long.MaxValue);
if (refreshFinishedCallback != null)
refreshFinishedCallback();
}));
}
//}
PrototypeVM.ChangeGoalTree(goalCats, goals);
}
@@ -1077,6 +964,22 @@ namespace BeWo.ViewModel.ListViewModel
}
}
private void PrepareListVM(IEnumerable<ServiceRecordDC> pServiceRecords, List<ValueListEntryDC> pGoalCats, List<ValueListEntryDC> pGoals, FlatSupportConceptTreeNodeDC pSelectedCustomerNode, Action pRefreshFinishedCallback, bool pShouldFetchStatistics, ServiceRecordTypeId? pOnlyWithThisType)
{
VMList.Clear();
foreach(var dc in pServiceRecords)
{
AddServiceRecordToList(dc, pGoalCats, pGoals, pSelectedCustomerNode);
}
BuildServiceRecordsForTreeNode(pSelectedCustomerNode, pShouldFetchStatistics, pOnlyWithThisType);
if(pRefreshFinishedCallback != null)
{
pRefreshFinishedCallback();
}
}
private static IEnumerable<ValueListEntryDC> GetAllParentGoalCategoies(Dictionary<long, ValueListEntryDC> goalCategoryDict, ValueListEntryDC goal)
{
IList<ValueListEntryDC> path = new List<ValueListEntryDC>();