48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using Dakota.Models.Schlüssels;
|
|
using System;
|
|
|
|
namespace Dakota.Models.Daten
|
|
{
|
|
internal class DatenelementDecimal : Datenelement
|
|
{
|
|
public decimal DecimalValue { get; set; }
|
|
|
|
public DatenelementDecimal(string title, int min, int max, Feldart art) : base(title, min, max, art)
|
|
{
|
|
_IgnoreCheck = true;
|
|
}
|
|
|
|
public void SetValue(Decimal input)
|
|
{
|
|
decimal temp = input;
|
|
string dec;
|
|
if (temp != default(decimal))
|
|
{
|
|
dec = temp.ToString("#.00").Replace(".", ",");
|
|
var tester = Math.Abs(temp).ToString("#.00").Replace(".", "").Replace(",", "");
|
|
|
|
if (tester.Length < MinStellen || tester.Length > MaxStellen)
|
|
{
|
|
throw new NotImplementedException("Error Code: 3483091097895");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(Feldart == Feldart.Kann)
|
|
{
|
|
dec = null;
|
|
}
|
|
else
|
|
{
|
|
dec = ",00";
|
|
}
|
|
|
|
temp = 0;
|
|
}
|
|
|
|
_Value = dec;
|
|
DecimalValue = temp;
|
|
}
|
|
}
|
|
}
|