Example #1
0
        /// <summary>
        /// Method to emulate the HDB_SITE table
        /// </summary>
        /// <param name="sitePcodeArray"></param>
        /// <returns></returns>
        public static List <SiteModel.HdbSite> GetSiteInfo(string[] sitePcodeArray)
        {
            /*
             * {
             * "site_id": 919,
             * "site_name": "LAKE POWELL",
             * "site_common_name": "LAKE POWELL",
             * "description": "",
             * "elevation": 3700,
             * "lat": "37.05778",
             * "longi": "-111.30332",
             * "db_site_code": "UC",
             * "objecttype_id": 7,
             * "objecttype_name": "reservoir",
             * "basin_id": 2029,
             * "river_mile": "NaN",
             * "segment_no": 0,
             * "state_id": 3,
             * "state_code": "UT",
             * "usgs_id": "",
             * "nws_code": "",
             * "shef_code": "",
             * "scs_id": "",
             * "parent_objecttype_id": 0,
             * "parent_site_id": 0
             * }
             */
            List <Models.SiteModel.HdbSite> siteReults = new List <SiteModel.HdbSite>();
            var siteList = GetSitePcodeList(sitePcodeArray, false);

            if (siteList == null)
            {
                List <string[]> allSites = new List <string[]>();
                for (int i = 0; i < siteTable.Rows.Count; i++)
                {
                    allSites.Add(new string[] { siteTable.Rows[i]["siteid"].ToString() });
                }
                siteList = allSites;
            }
            foreach (string[] siteCode in siteList)
            {
                DataRow[] siteRow = siteTable.Select("siteid = '" + siteCode[0].ToString().ToLower() + "'");
                if (siteRow.Length < 1)
                {
                    throw new Exception("site not found '" + siteCode[0].ToString().ToLower() + "'");
                }
                var ithSite = new SiteModel.HdbSite();
                ithSite.site_id          = siteRow[0]["siteid"].ToString().ToUpper();
                ithSite.lat              = siteRow[0]["latitude"].ToString();
                ithSite.longi            = siteRow[0]["longitude"].ToString();
                ithSite.elevation        = siteRow[0]["elevation"].ToString();
                ithSite.state_code       = siteRow[0]["state"].ToString();
                ithSite.site_name        = siteRow[0]["description"].ToString();
                ithSite.site_common_name = siteRow[0]["description"].ToString();
                ithSite.hydrologic_unit  = siteRow[0]["huc12"].ToString();
                ithSite.db_site_code     = siteRow[0]["agency_region"].ToString().ToLower() + "hyd";
                siteReults.Add(ithSite);
            }
            return(siteReults);
        }
Example #2
0
 public bool UpdateModelRun(IDbConnection db, SiteModel.HdbSite site)
 {
     throw new NotImplementedException();
 }
Example #3
0
 public bool InsertSite(IDbConnection db, SiteModel.HdbSite site)
 {
     throw new NotImplementedException();
 }