Files
BeWoPlaner/BeWo/View/Controls/DPCtrlZeitkonto.cs

74 lines
3.0 KiB
C#

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 DPCtrlZeitkonto : DienstplanerControl
{
public static readonly DependencyProperty ZeitkontoInformationProperty = DependencyProperty.Register(
"ZeitkontoInformation",
typeof(DPCtrlZeitkontoInformation),
typeof(DPCtrlZeitkonto),
new UIPropertyMetadata(
(s, e) =>
{
var information = (DPCtrlZeitkontoInformation)e.NewValue;
var ctrl = (DPCtrlZeitkonto)s;
if (ctrl != null)
{
if (information != null)
{
if (information.IsLastRow)
ctrl.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1);
else
{
if (information.Statuszeile)
ctrl.BorderBlack.BorderThickness = new Thickness(0, 0, 0, 2);
else
{
ctrl.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 0);
if (information.Row == 0)
{
ctrl.Text = string.Format("{0:0.00}", information.Monatszusammenfassung.ZeitkontoLetzterMonat);
ctrl.ToolTip = "Zeitkonto Vormonat";
}
else if (information.Row == 1)
{
ctrl.Text = string.Format("{0:0.00}", information.Monatszusammenfassung.ZeitkontoAktualisiert);
ctrl.ToolTip = "Zeitkonto dieser Monat";
}
}
}
}
}
}));
public DPCtrlZeitkonto()
{
InitializeComponent();
//BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1);
txt.HorizontalAlignment = HorizontalAlignment.Right;
}
public DPCtrlZeitkontoInformation ZeitkontoInformation
{
get { return (DPCtrlZeitkontoInformation)GetValue(ZeitkontoInformationProperty); }
set { SetValue(ZeitkontoInformationProperty, value); }
}
}
public class DPCtrlZeitkontoInformation
{
public int Row { get; set; }
public bool Statuszeile { get; set; }
public DienstplanerMonthlySummaryDC Monatszusammenfassung { get; set;}
public bool IsLastRow { get; set; }
}
}