Files
BeWoPlaner/BeWo/View/Controls/DPCtrlSoll.cs
2022-05-16 16:06:26 +02:00

77 lines
2.8 KiB
C#

using BS.Shared.DataContracts;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace BeWo.View.Controls
{
public class DPCtrlSoll : DienstplanerControl
{
public static readonly DependencyProperty SollInformationProperty = DependencyProperty.Register(
"SollInformation",
typeof(DPCtrlSollInformation),
typeof(DPCtrlSoll),
new UIPropertyMetadata(
(s, e) =>
{
var information = (DPCtrlSollInformation)e.NewValue;
var ctrl = (DPCtrlSoll)s;
if (ctrl != null)
{
ctrl.Text = "";
ctrl.ToolTip = "";
if (information != null)
{
Debug.WriteLine("Status: " + information.Statuszeile + " | MA: " + information.EmployeeDC + " | Soll: " + information.SollWert);
if (information.Row == 0 && !information.Statuszeile)
{
ctrl.Text = string.Format("{0:0.00}", information.SollWert);
ctrl.ToolTip = "Soll-Wert";
}
if (information.Statuszeile)
ctrl.BorderBlack.BorderThickness = new Thickness(0, 0, 0, 2);
else
{
if (information.IsLastRow)
ctrl.BorderBlack.BorderThickness = new Thickness(0, 0, 0, 1.5);
else
ctrl.BorderBlack.BorderThickness = new Thickness(0, 0, 0, 0);
}
}
}
}));
public DPCtrlSoll()
{
InitializeComponent();
//BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1);
txt.HorizontalAlignment = HorizontalAlignment.Right;
}
public DPCtrlSollInformation SollInformation
{
get { return (DPCtrlSollInformation)GetValue(SollInformationProperty); }
set { SetValue(SollInformationProperty, value); }
}
}
public class DPCtrlSollInformation
{
public int Row { get; set; }
public bool Statuszeile { get; set; }
public decimal SollWert { get; set; }
public bool IsLastRow { get; set; }
public EmployeeDC EmployeeDC { get; set; }
}
}