45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
// Copyright (c) 2017 schick Informatik
|
|
// Description: Alle Lookup-Tabellen für das Display statisch aus der SQLite Datenbank initialisieren
|
|
//
|
|
|
|
using System.Data;
|
|
using System.Data.SQLite;
|
|
using System.Collections.Generic;
|
|
|
|
namespace ENI2
|
|
{
|
|
static class LocalizedLookup
|
|
{
|
|
private static SQLiteConnection _con;
|
|
private const string _locode_DB_NAME = "db.sqlite";
|
|
|
|
static LocalizedLookup()
|
|
{
|
|
_con = new SQLiteConnection(string.Format("data source={0}; Version=3;", _locode_DB_NAME));
|
|
_con.Open();
|
|
}
|
|
|
|
public static Dictionary<int, string> getLADGCargoHandlingStrings(string languageCode)
|
|
{
|
|
Dictionary<int, string> result = new Dictionary<int, string>();
|
|
string query = string.Format("SELECT key, text FROM LADG_CargoHandlingCodes WHERE langKey = '{0}'", languageCode);
|
|
|
|
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
|
IDataReader reader = cmd.ExecuteReader();
|
|
int key;
|
|
string text;
|
|
while (reader.Read())
|
|
{
|
|
key = reader.GetInt32(0);
|
|
text = reader.GetString(1);
|
|
result[key] = text;
|
|
}
|
|
reader.Close();
|
|
return result;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|