using System; using System.IO; using System.Xml.Serialization; using TBF.BenchControl.Generic; namespace TBF.BenchControl.DataEntry.Munich3 { public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg { public string ProtocolTitle1; public string ProtocolTitle2; public string ProtocolTitle3; /// Parameterless constructor public EntryFormCfg() { } /// /// Data entry form configuration parameters /// /// Data entry form factory /// Component name public EntryFormCfg(IComponentFactory factory, string name, string protocolTitle1, string protocolTitle2, string protocolTitle3) : base(factory, name) { this.ProtocolTitle1 = protocolTitle1; this.ProtocolTitle2 = protocolTitle2; this.ProtocolTitle3 = protocolTitle3; } public IComponentCfg Clone() { return new EntryFormCfg(Factory, Name, ProtocolTitle1, ProtocolTitle2, ProtocolTitle3); } public string ToString(int i) { return string.Empty; } 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)) { EntryFormCfg config = (EntryFormCfg)(new XmlSerializer(typeof(EntryFormCfg))).Deserialize(reader); config.InitCfgBaseFromEntity(component, factory); return config; } } } }