67 lines
1.9 KiB
C#
67 lines
1.9 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Xml.Serialization;
|
|
using TBF.BenchControl.Generic;
|
|
using TBF.Resources;
|
|
|
|
namespace TBF.BenchControl.WaterMeter
|
|
{
|
|
public class WaterMeterCfg : ComponentCfgBase, Generic.IComponentCfg
|
|
{
|
|
public string Producer; /// Hersteller
|
|
public float Qn;
|
|
public string ApprovalInfo; /// Zulassungszeichen
|
|
public string MetrologicalClass; /// Metr. Klasse
|
|
|
|
/// Parameterless constructor
|
|
public WaterMeterCfg()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Data entry form configuration parameters
|
|
/// </summary>
|
|
/// <param name="factory">Data entry form factory</param>
|
|
/// <param name="name">Component name</param>
|
|
public WaterMeterCfg(IComponentFactory factory, string name, string producer,
|
|
float qn, string approvalInfo, string metrologicalClass)
|
|
: base(factory, name)
|
|
{
|
|
Producer = producer;
|
|
Qn = qn;
|
|
ApprovalInfo = approvalInfo;
|
|
MetrologicalClass = metrologicalClass;
|
|
}
|
|
|
|
public IComponentCfg Clone()
|
|
{
|
|
return new WaterMeterCfg(Factory, Name, Producer,
|
|
Qn, ApprovalInfo, MetrologicalClass);
|
|
}
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format(Strings.nothing_to_configure);
|
|
}
|
|
|
|
public TBF.Entities.Component CreateDbEntity()
|
|
{
|
|
using (var writer = new StringWriter())
|
|
{
|
|
(new XmlSerializer(GetType())).Serialize(writer, this);
|
|
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
|
|
}
|
|
}
|
|
|
|
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
|
|
{
|
|
using (var reader = new StringReader(component.Parameters))
|
|
{
|
|
WaterMeterCfg config = (WaterMeterCfg)(new XmlSerializer(typeof(WaterMeterCfg))).Deserialize(reader);
|
|
config.InitCfgBaseFromEntity(component, factory);
|
|
return config;
|
|
}
|
|
}
|
|
}
|
|
}
|