| | |
| | | using System;
|
| | | using System.Data;
|
| | | using System.Configuration;
|
| | | using System.Web;
|
| | | using System.Web.Security;
|
| | | using System.Web.UI;
|
| | | using System.Web.UI.HtmlControls;
|
| | | using System.Web.UI.WebControls;
|
| | | using System.Web.UI.WebControls.WebParts;
|
| | |
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using System.Data.OracleClient;
|
| | | using System.Linq;
|
| | | using CCSTrace.CCS.Domain;
|
| | |
|
| | | namespace CCSTrace.CCS.Object
|
| | | {
|
| | | public class EOSCodelist
|
| | | public class EosCodelist
|
| | | {
|
| | | private Hashtable m_TotalData = new Hashtable();
|
| | | private int KeyID = 1;
|
| | | private int Item = 2;
|
| | | private int Content = 3;
|
| | | private readonly Dictionary<int, Dictionary<int, Codelist>> _mTotalData = new Dictionary<int, Dictionary<int, Codelist>>();
|
| | |
|
| | | public EOSCodelist(OracleConnection _Connection)
|
| | | public EosCodelist(OracleConnection connection)
|
| | | {
|
| | | String SqlStmt;
|
| | | int IndexID;
|
| | | ArrayList m_Data = new ArrayList();
|
| | | int Tmp = 0;
|
| | |
|
| | | SqlStmt = "SELECT INDEXID,KEYID,ITEM,CONTENT FROM EOS.CODELIST ORDER BY INDEXID,KEYID";
|
| | | OracleCommand Command = new OracleCommand(SqlStmt, _Connection);
|
| | | OracleDataReader reader = Command.ExecuteReader();
|
| | | var sqlStmt = "SELECT INDEXID,KEYID,ITEM,CONTENT FROM EOS.CODELIST ORDER BY INDEXID,KEYID";
|
| | | OracleCommand command = new OracleCommand(sqlStmt, connection);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | | try
|
| | | {
|
| | |
|
| | | while (reader.Read())
|
| | | {
|
| | | ArrayList m_Record = new ArrayList();
|
| | | IndexID = Convert.ToInt32(reader["INDEXID"].ToString());
|
| | | m_Record.Add(IndexID);
|
| | | m_Record.Add(Convert.ToInt32(reader["KEYID"].ToString()));
|
| | | m_Record.Add(reader["ITEM"].ToString());
|
| | | m_Record.Add(reader["CONTENT"].ToString());
|
| | |
|
| | | if (Tmp == IndexID)
|
| | | m_Data.Add(m_Record);
|
| | | else
|
| | | var indexId = Convert.ToInt32(reader["INDEXID"].ToString());
|
| | | 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);
|
| | | if (!_mTotalData.ContainsKey(indexId))
|
| | | {
|
| | | m_TotalData.Add(Tmp.ToString(), m_Data);
|
| | | Tmp = IndexID;
|
| | | m_Data = new ArrayList();
|
| | | m_Data.Add(m_Record);
|
| | | _mTotalData.Add(indexId, new Dictionary<int, Codelist>());
|
| | | }
|
| | | Dictionary<int, Codelist> keys = _mTotalData[indexId];
|
| | | if (keys.ContainsKey(keyId))
|
| | | {
|
| | | keys.Add(keyId, codelist);
|
| | | }
|
| | | }
|
| | | m_TotalData.Add(Tmp.ToString(), m_Data);
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine("Error on Initial EOSCodelist: " + e.Message);
|
| | | Console.WriteLine("Error on Startup EOSCodelist: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | }
|
| | | finally
|
| | | { |
| | | {
|
| | | reader.Close();
|
| | | Command.Dispose();
|
| | | command.Dispose();
|
| | | }
|
| | | }
|
| | |
|
| | | public ArrayList getAllContent(int m_IndexID)
|
| | | public Codelist[] GetAllContent(int mIndexId)
|
| | | {
|
| | | return (ArrayList)m_TotalData[m_IndexID.ToString()];
|
| | | return _mTotalData[mIndexId].Values.ToArray();
|
| | | }
|
| | |
|
| | | public String getContent(int m_IndexID, int m_KeyID)
|
| | | public string GetContent(int mIndexId, int mKeyId)
|
| | | {
|
| | | ArrayList m_Tmp = (ArrayList)m_TotalData[m_IndexID.ToString()];
|
| | | String m_Result = "";
|
| | | return _mTotalData[mIndexId][mKeyId].Content;
|
| | | }
|
| | |
|
| | | for (int i = 0; i < m_Tmp.Count; i++)
|
| | | public string GetContent(int mIndexId, string mItem)
|
| | | {
|
| | | string mResult = "";
|
| | |
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | |
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | {
|
| | | if (Convert.ToInt32(((ArrayList)m_Tmp[i])[KeyID].ToString()) == m_KeyID)
|
| | | if (pair.Value.Item.Equals(mItem))
|
| | | {
|
| | | m_Result = ((ArrayList)m_Tmp[i])[Content].ToString();
|
| | | mResult = pair.Value.Content;
|
| | | break;
|
| | | }
|
| | | }
|
| | | return m_Result;
|
| | | return mResult;
|
| | | }
|
| | |
|
| | | public String getContent(int m_IndexID, String m_Item)
|
| | | public int GetKeyId(int mIndexId, string mContent)
|
| | | {
|
| | | ArrayList m_Tmp = (ArrayList)m_TotalData[m_IndexID.ToString()];
|
| | | String m_Result = "";
|
| | | Dictionary<int, Codelist> mTmp = _mTotalData[mIndexId];
|
| | | int mResult = 0;
|
| | |
|
| | | for (int i = 0; i < m_Tmp.Count; i++)
|
| | | foreach (KeyValuePair<int, Codelist> pair in mTmp)
|
| | | {
|
| | | if (((ArrayList)m_Tmp[i])[Item].ToString().Equals(m_Item))
|
| | | if (pair.Value.Content.Equals(mContent))
|
| | | {
|
| | | m_Result = ((ArrayList)m_Tmp[i])[Content].ToString();
|
| | | mResult = pair.Key;
|
| | | break;
|
| | | }
|
| | | }
|
| | | return m_Result;
|
| | | return mResult;
|
| | | }
|
| | |
|
| | | public int getKeyID(int m_IndexID, String m_Content)
|
| | | public int GetContentNumber(int mIndexId)
|
| | | {
|
| | | ArrayList m_Tmp = (ArrayList)m_TotalData[m_IndexID.ToString()];
|
| | | int m_Result = 0;
|
| | |
|
| | | for (int i = 0; i < m_Tmp.Count; i++)
|
| | | {
|
| | | if (((ArrayList)m_Tmp[i])[Content].ToString().Equals(m_Content))
|
| | | {
|
| | | m_Result = Convert.ToInt32(((ArrayList)m_Tmp[i])[1].ToString());
|
| | | break;
|
| | | }
|
| | | }
|
| | | return m_Result;
|
| | | return (_mTotalData[mIndexId]).Count;
|
| | | }
|
| | |
|
| | | public int getContentNumber(int m_IndexID)
|
| | | {
|
| | | return ((ArrayList)m_TotalData[m_IndexID]).Count;
|
| | | }
|
| | | public int Count => _mTotalData.Count;
|
| | | }
|
| | | }
|
| | | } |