39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Dakota.Models.Daten
|
|
{
|
|
internal class DatenelementFiller : Datenelement
|
|
{
|
|
public int Value { get; set; }
|
|
public int FillLength { get; set; }
|
|
|
|
public DatenelementFiller(string title, int count, int filllength) : base(title, count, Feldart.Muss)
|
|
{
|
|
FillLength = filllength;
|
|
Title = title;
|
|
}
|
|
|
|
public DatenelementFiller(string title, int min, int max, int filllength) : base(title, min, max, Feldart.Muss)
|
|
{
|
|
FillLength = filllength;
|
|
Title = title;
|
|
}
|
|
|
|
public new void SetValue(int value)
|
|
{
|
|
if (value.ToString().Length > FillLength)
|
|
throw new ArgumentOutOfRangeException("length", $"the length of {value} is bigger than len {FillLength}");
|
|
|
|
Value = value;
|
|
|
|
var temp = value.ToString("D" + FillLength.ToString());
|
|
|
|
SetValue(temp);
|
|
}
|
|
}
|
|
}
|