2020-09-30 10:00:31 +02:00
|
|
|
|
using BS.Shared.DataContracts;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BeWo.View.Controls
|
|
|
|
|
|
{
|
|
|
|
|
|
public class DPCtrlWeek : DienstplanerControl
|
|
|
|
|
|
{
|
2021-04-15 07:34:33 +02:00
|
|
|
|
public static readonly DependencyProperty DPCtrlWeekProperty = DependencyProperty.Register(
|
|
|
|
|
|
"DPCtrlWeekInformation",
|
|
|
|
|
|
typeof(DPCtrlWeekInformation),
|
2020-09-30 10:00:31 +02:00
|
|
|
|
typeof(DPCtrlWeek),
|
|
|
|
|
|
new UIPropertyMetadata(
|
|
|
|
|
|
(s, e) =>
|
|
|
|
|
|
{
|
2021-04-15 07:34:33 +02:00
|
|
|
|
var dc = (DPCtrlWeekInformation)e.NewValue;
|
2020-09-30 10:00:31 +02:00
|
|
|
|
var c = (DPCtrlWeek)s;
|
|
|
|
|
|
|
|
|
|
|
|
if (c != null)
|
|
|
|
|
|
{
|
2021-10-18 00:43:47 +02:00
|
|
|
|
c.Text = "";
|
|
|
|
|
|
c.ToolTip = "";
|
2020-09-30 10:00:31 +02:00
|
|
|
|
if (dc != null)
|
|
|
|
|
|
{
|
2021-03-19 13:22:47 +01:00
|
|
|
|
//dc.RemoveAll(x => x == null);
|
2021-06-10 14:40:23 +02:00
|
|
|
|
if (!dc.IsLastRow)
|
|
|
|
|
|
c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 0);
|
|
|
|
|
|
else
|
2022-05-16 16:06:26 +02:00
|
|
|
|
c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1.5 );
|
2020-09-30 10:00:31 +02:00
|
|
|
|
|
|
|
|
|
|
double res = 0.0;
|
|
|
|
|
|
|
2021-06-10 14:40:23 +02:00
|
|
|
|
if(!dc.Statuszeile)
|
2021-02-15 08:04:40 +01:00
|
|
|
|
{
|
2021-06-10 14:40:23 +02:00
|
|
|
|
if (dc.Hours.Count != 0 || dc.Row == 0)
|
2020-09-30 10:00:31 +02:00
|
|
|
|
{
|
2021-06-10 14:40:23 +02:00
|
|
|
|
foreach (var dauer in dc.Hours)
|
|
|
|
|
|
{
|
|
|
|
|
|
res += dauer;
|
|
|
|
|
|
}
|
|
|
|
|
|
c.Text = res.ToString("0.##");
|
2020-09-30 10:00:31 +02:00
|
|
|
|
}
|
2021-02-15 08:04:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2021-04-15 07:34:33 +02:00
|
|
|
|
if(dc.Statuszeile)
|
|
|
|
|
|
c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 2);
|
|
|
|
|
|
else
|
|
|
|
|
|
c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 0);
|
|
|
|
|
|
|
2021-02-15 08:04:40 +01:00
|
|
|
|
c.Text = "";
|
|
|
|
|
|
}
|
2020-09-30 10:00:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2021-02-15 08:04:40 +01:00
|
|
|
|
c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1);
|
2020-09-30 10:00:31 +02:00
|
|
|
|
|
|
|
|
|
|
c.Text = "";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
public DPCtrlWeek()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
|
|
BorderBlack.BorderThickness = new Thickness(0, 0, 1, 0);
|
|
|
|
|
|
txt.TextAlignment = TextAlignment.Left;
|
|
|
|
|
|
txt.HorizontalAlignment = HorizontalAlignment.Left;
|
2021-02-10 14:02:59 +01:00
|
|
|
|
|
2020-09-30 10:00:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-04-15 07:34:33 +02:00
|
|
|
|
public DPCtrlWeekInformation DPCtrlWeekInformation
|
2020-09-30 10:00:31 +02:00
|
|
|
|
{
|
2021-04-15 07:34:33 +02:00
|
|
|
|
get { return (DPCtrlWeekInformation)GetValue(DPCtrlWeekProperty); }
|
2020-09-30 10:00:31 +02:00
|
|
|
|
|
2021-04-15 07:34:33 +02:00
|
|
|
|
set { SetValue(DPCtrlWeekProperty, value); }
|
2020-09-30 10:00:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-04-15 07:34:33 +02:00
|
|
|
|
|
|
|
|
|
|
public class DPCtrlWeekInformation
|
|
|
|
|
|
{
|
|
|
|
|
|
public List<double> Hours { get; set; }
|
|
|
|
|
|
public bool Statuszeile { get; set; }
|
|
|
|
|
|
public int Row { get; set; }
|
2021-06-10 14:40:23 +02:00
|
|
|
|
public bool IsLastRow { get; set; }
|
2021-04-15 07:34:33 +02:00
|
|
|
|
}
|
2020-09-30 10:00:31 +02:00
|
|
|
|
}
|