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.Data.OracleClient;
|
|
namespace CCSTrace.CCS.Object
|
{
|
public class EOSCodelist
|
{
|
private Hashtable m_TotalData = new Hashtable();
|
private int KeyID = 1;
|
private int Item = 2;
|
private int Content = 3;
|
|
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();
|
|
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
|
{
|
m_TotalData.Add(Tmp.ToString(), m_Data);
|
Tmp = IndexID;
|
m_Data = new ArrayList();
|
m_Data.Add(m_Record);
|
}
|
}
|
m_TotalData.Add(Tmp.ToString(), m_Data);
|
}
|
catch (Exception e)
|
{
|
Console.WriteLine("Error on Initial EOSCodelist: " + e.Message);
|
Console.WriteLine(e.StackTrace);
|
}
|
finally
|
{
|
reader.Close();
|
Command.Dispose();
|
}
|
}
|
|
public ArrayList getAllContent(int m_IndexID)
|
{
|
return (ArrayList)m_TotalData[m_IndexID.ToString()];
|
}
|
|
public String getContent(int m_IndexID, int m_KeyID)
|
{
|
ArrayList m_Tmp = (ArrayList)m_TotalData[m_IndexID.ToString()];
|
String m_Result = "";
|
|
for (int i = 0; i < m_Tmp.Count; i++)
|
{
|
if (Convert.ToInt32(((ArrayList)m_Tmp[i])[KeyID].ToString()) == m_KeyID)
|
{
|
m_Result = ((ArrayList)m_Tmp[i])[Content].ToString();
|
break;
|
}
|
}
|
return m_Result;
|
}
|
|
public String getContent(int m_IndexID, String m_Item)
|
{
|
ArrayList m_Tmp = (ArrayList)m_TotalData[m_IndexID.ToString()];
|
String m_Result = "";
|
|
for (int i = 0; i < m_Tmp.Count; i++)
|
{
|
if (((ArrayList)m_Tmp[i])[Item].ToString().Equals(m_Item))
|
{
|
m_Result = ((ArrayList)m_Tmp[i])[Content].ToString();
|
break;
|
}
|
}
|
return m_Result;
|
}
|
|
public int getKeyID(int m_IndexID, String m_Content)
|
{
|
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;
|
}
|
|
public int getContentNumber(int m_IndexID)
|
{
|
return ((ArrayList)m_TotalData[m_IndexID]).Count;
|
}
|
}
|
}
|