hank
2015-08-18 2d4b747b3ac277babbd8eddfd88f378953f497bd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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;
        }
    }
}