35 lines
934 B
C#
35 lines
934 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Dakota.Models.Segmente
|
|
{
|
|
internal abstract class Segment : IRow
|
|
{
|
|
//public List<Datenelement> Datenelemente { get; set; }
|
|
|
|
public abstract string GetHead();
|
|
public abstract List<Dateneinheit> GetBody();
|
|
|
|
public string GetRows()
|
|
{
|
|
Dateneinheit lastzero = null;
|
|
var body = GetBody();
|
|
var bodyRev = body.ToList();
|
|
bodyRev.Reverse();
|
|
|
|
foreach (var item in bodyRev)
|
|
{
|
|
if (item.HasValue())
|
|
break;
|
|
|
|
body.Remove(item);
|
|
}
|
|
|
|
return GetHead() + DakotaConfig.Trennzeichen + string.Join(DakotaConfig.Trennzeichen, body.Select(x => x.GetValue())) + DakotaConfig.Segmentendezeichen + DakotaConfig.NewLine;
|
|
}
|
|
}
|
|
}
|