// Copyright (c) 2023-present schick Informatik // Description: Container class for self-learning, volatile information that // is added by parsing Excel sheets. Here common wrong/misspelled data fields // are mapped to valid ones. using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; namespace bsmd.database { public class ValueMapping : DatabaseEntityAsync { #region enums public enum MappingType { UNKNOWN, COUNTRY, GENDER, DOCUMENT_TYPE, LOCODE, INVALID }; #endregion #region Fields private static Dictionary> _dicts = new Dictionary>(); #endregion #region Properties public static Dictionary> Dicts { get { return _dicts; } } public MappingType EntryType { get; private set; } public string Key { get; private set; } public string Value { get; private set; } #endregion #region public funcs /// /// creates and saves a new entry and adds it to the internal dictionaries /// /// true if entry was actually created, false if already present public static bool Create(MappingType type, string key, string value) { return false; } /// /// deletes an entry and removes it from the database /// /// true if successful, false if value was not found public static bool Delete(MappingType type, string key) { return false; } /// /// updates an existing value and saves it /// /// true if successful public bool Update(string newValue) { return false; } #endregion #region DatabaseEntity implementation public override void PrepareSave(System.Data.IDbCommand cmd) { throw new NotImplementedException(); } public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria) { throw new NotImplementedException(); } public override List LoadList(System.Data.IDataReader reader) { throw new NotImplementedException(); } protected override DatabaseEntityAsync ReadRowFromReader(System.Data.IDataReader reader) { ValueMapping vm = null; if (reader != null) { vm = new ValueMapping(); vm.id = reader.GetGuid(0); //if (!reader.IsDBNull(1)) md.MessageCoreId = reader.GetGuid(1); //if (!reader.IsDBNull(2)) md.ColA = reader.GetString(2); } return vm; } #endregion } }