- Implement `DatabaseWriter` factory and configuration logic. - Add `WriteDbCfgCtrl` for component configuration UI. - Introduce database connection handling, network adapter selection, and tracing record management.
58 lines
1.8 KiB
C#
58 lines
1.8 KiB
C#
///
|
|
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
|
///
|
|
|
|
using System.Collections.Generic;
|
|
using System.Xml.Serialization;
|
|
using TBF.Rig.Generic;
|
|
|
|
namespace TBF.Rig.Output.DB.DatabaseWriter
|
|
{
|
|
///
|
|
/// Class and file name is preserved for backward compatibility
|
|
///
|
|
public class WriterCfg : ComponentCfgBase, Generic.IComponentCfg
|
|
{
|
|
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(WriterCfg) })[0];
|
|
public override XmlSerializer GetSerializer() { return Serializer; }
|
|
|
|
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new WriteDbCfgCtrl(); }
|
|
|
|
|
|
public string ConnStr;
|
|
public string ConnStr2;
|
|
public string NetAdapter;
|
|
public bool CheckPreviousRecords;
|
|
public bool SaveTracingRecords;
|
|
|
|
|
|
/// Private parameterless constructor invoked by all other (public) constructors
|
|
WriterCfg()
|
|
{
|
|
ParentName = string.Empty;
|
|
NetAdapter = string.Empty;
|
|
ConnStr = "server=10.42.128.24; database=sledovanie2020; uid=vyroba2020; pwd=qwerty; charset=utf8;";
|
|
ConnStr2 = "server=10.42.128.24; database=sledovanie2019; uid=vyroba2019; pwd=qwerty; charset=utf8;";
|
|
CheckPreviousRecords = true;
|
|
SaveTracingRecords = true;
|
|
}
|
|
|
|
public WriterCfg(string name, IComponentFactory factory)
|
|
: this()
|
|
{
|
|
this.Name = name;
|
|
this.Factory = factory;
|
|
}
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format("Name={0}, CheckPrev.={1}, SaveRecords={2}, ConnStr={3}, , ConnStr2={4}",
|
|
Name,
|
|
CheckPreviousRecords,
|
|
SaveTracingRecords,
|
|
ConnStr,
|
|
ConnStr2);
|
|
}
|
|
}
|
|
}
|