Ejemplo n.º 1
0
        /// <summary>
        /// Method to emulate the HDB_DATATYPE table
        /// </summary>
        /// <param name="sitePcodeArray"></param>
        /// <returns></returns>
        public static List <DatatypeModel.HdbDatatype> GetPcodeInfo(string[] sitePcodeArray)
        {
            /*
             * {
             * "datatype_id": 1393,
             * "datatype_name": "average reservoir elevation",
             * "datatype_common_name": "ave reservoir elevation",
             * "physical_quantity_name": "water surface elevation",
             * "unit_id": 4,
             * "unit_name": "feet",
             * "unit_common_name": "feet",
             * "allowable_intervals": "non-instant",
             * "agen_id": 0,
             * "cmmnt": ""
             * }
             */
            List <Models.DatatypeModel.HdbDatatype> pCodeResults = new List <DatatypeModel.HdbDatatype>();
            var pcodeList = GetSitePcodeList(sitePcodeArray, false);

            if (pcodeList == null)
            {
                List <string[]> allSites = new List <string[]>();
                for (int i = 0; i < pcodeTable.Rows.Count; i++)
                {
                    allSites.Add(new string[] { pcodeTable.Rows[i]["pcode"].ToString() });
                }
                pcodeList = allSites;
            }
            foreach (string[] pCode in pcodeList)
            {
                DataRow[] pCodeRow = pcodeTable.Select("pcode = '" + pCode[0].ToString().ToLower() + "'");
                if (pCodeRow.Length < 1)
                {
                    throw new Exception("pcode not found '" + pCode[0].ToString().ToLower() + "'");
                }
                var ithPCode = new DatatypeModel.HdbDatatype();
                ithPCode.datatype_id          = pCodeRow[0]["pcode"].ToString().ToUpper();
                ithPCode.datatype_name        = pCodeRow[0]["name"].ToString();
                ithPCode.datatype_common_name = pCodeRow[0]["name"].ToString();
                ithPCode.unit_name            = pCodeRow[0]["units"].ToString();
                ithPCode.unit_common_name     = pCodeRow[0]["units"].ToString();
                pCodeResults.Add(ithPCode);
            }
            return(pCodeResults);
        }
Ejemplo n.º 2
0
 public bool UpdateDataType(IDbConnection db, DatatypeModel.HdbDatatype dtype)
 {
     throw new NotImplementedException();
 }