Exemplo n.º 1
0
        private void loadAuxiliaryMaterialTable()
        {
            string sql = "SELECT [PKEY],[NODE_NAME],[TABLE_NAME] FROM [dbo].[BASE_AUXILIARY_MATERIAL] ORDER BY PKEY";

            m_auxiliaryMaterialList.Clear();

            using (DataTable dataTable = DatabaseAccessFactoryInstance.Instance.QueryDataTable(FormMain.DB_NAME, sql))
            {
                foreach (DataRow row in dataTable.Rows)
                {
                    AuxiliaryMaterialTable record = new AuxiliaryMaterialTable();

                    record.pkey      = DbDataConvert.ToInt32(row[0]);
                    record.nodeName  = DbDataConvert.ToString(row[1]);
                    record.tableName = DbDataConvert.ToString(row[2]);

                    m_auxiliaryMaterialList.Add(m_auxiliaryMaterialList.Count, record);
                }
            }
        }
Exemplo n.º 2
0
        public string getAuxiliaryMaterialTableNameFromPkey(int pkey)
        {
            if (m_auxiliaryMaterialList.Count == 0)
            {
                loadAuxiliaryMaterialTable();
            }

            string tableName = "";

            foreach (KeyValuePair <int, AuxiliaryMaterialTable> index in m_auxiliaryMaterialList)
            {
                AuxiliaryMaterialTable record = new AuxiliaryMaterialTable();
                record = index.Value;

                if (record.pkey == pkey)
                {
                    tableName = record.tableName;
                    break;
                }
            }

            return(tableName);
        }