| | |
| | | using System.Data.OracleClient;
|
| | | using System.Linq;
|
| | | using CCSTrace.CCS.Domain;
|
| | | using CCSTrace.TPower.DMMS.Model.CCS;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class EosCodelist
|
| | | {
|
| | | private readonly Dictionary<int, Dictionary<int, Codelist>> _mTotalData = new Dictionary<int, Dictionary<int, Codelist>>();
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private readonly Dictionary<int, Dictionary<int, CODELIST>> _mTotalData = new Dictionary<int, Dictionary<int, CODELIST>>();
|
| | |
|
| | | public EosCodelist(OracleConnection connection)
|
| | | {
|
| | |
| | | var keyId = Convert.ToInt32(reader["KEYID"].ToString());
|
| | | var item = (reader["ITEM"].ToString());
|
| | | var content = (reader["CONTENT"].ToString());
|
| | | Codelist codelist = new Codelist(indexId, keyId, item, content);
|
| | | CODELIST codelist = new CODELIST(indexId, keyId, item, content);
|
| | | if (!_mTotalData.ContainsKey(indexId))
|
| | | {
|
| | | _mTotalData.Add(indexId, new Dictionary<int, Codelist>());
|
| | | _mTotalData.Add(indexId, new Dictionary<int, CODELIST>());
|
| | | }
|
| | | Dictionary<int, Codelist> keys = _mTotalData[indexId];
|
| | | Dictionary<int, CODELIST> keys = _mTotalData[indexId];
|
| | | if (keys.ContainsKey(keyId))
|
| | | {
|
| | | keys.Add(keyId, codelist);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public Codelist[] GetAllContent(int mIndexId)
|
| | | public CODELIST[] GetAllContent(int mIndexId)
|
| | | {
|
| | | return _mTotalData[mIndexId].Values.ToArray();
|
| | | }
|
| | |
|
| | | public string GetContent(int mIndexId, int mKeyId)
|
| | | {
|
| | | return _mTotalData[mIndexId][mKeyId].Content;
|
| | | return _mTotalData[mIndexId][mKeyId].CONTENT;
|
| | | }
|
| | |
|
| | | public string GetContent(int mIndexId, string mItem)
|
| | | {
|
| | | string mResult = "";
|
| | |
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | | Dictionary<int, CODELIST> mTmp = _mTotalData[mIndexId];
|
| | |
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | foreach (KeyValuePair<int, CODELIST> pair in mTmp)
|
| | | {
|
| | | if (pair.Value.Item.Equals(mItem))
|
| | | if (pair.Value.ITEM.Equals(mItem))
|
| | | {
|
| | | mResult = pair.Value.Content;
|
| | | mResult = pair.Value.CONTENT;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | public int GetKeyId(int mIndexId, string mContent)
|
| | | {
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | | Dictionary<int, CODELIST> mTmp = _mTotalData[mIndexId];
|
| | | int mResult = 0;
|
| | |
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | foreach (KeyValuePair<int, CODELIST> pair in mTmp)
|
| | | {
|
| | | if (pair.Value.Content.Equals(mContent))
|
| | | if (pair.Value.CONTENT.Equals(mContent))
|
| | | {
|
| | | mResult = pair.Key;
|
| | | break;
|