Example #1
0
        static bool InsertOneSite(OD_1_1_DataSet.SitesDataTable sitesTable,
                                  WaterML11.SiteInfoType stinfo, SqlConnection sqlConn)
        {
            OD_1_1_DataSet.SitesRow row = sitesTable.NewSitesRow();

            row.SiteCode = stinfo.siteCode[0].Value;
            string cond = "SiteCode = '" + row.SiteCode + "'";

            if (OD_Utils.Exists(row.Table.TableName, cond, sqlConn))
            {
                return(false);
            }

            row.SiteName = stinfo.siteName;
            WaterML11.LatLonPointType glt = (WaterML11.LatLonPointType)stinfo.geoLocation.geogLocation;
            row.Latitude       = glt.latitude;
            row.Longitude      = glt.longitude;
            row.LatLongDatumID = 0;
            row.Elevation_m    = stinfo.elevation_m;
            row.VerticalDatum  = stinfo.verticalDatum;
            //row.LocalX = 0;
            //row.LocalY = 0;
            //row.LocalProjectionID = 0;
            //row.PosAccuracy_m = 0;
            for (int i = 0; i < stinfo.note.Count(); i++)
            {
                NoteType note = stinfo.note[i];
                switch (note.title)
                {
                case "State":
                    row.State = note.Value;
                    break;

                case "County":
                    row.County = note.Value;
                    break;

                case "agency":
                    row.Comments = note.Value;
                    break;
                }
            }

            sitesTable.AddSitesRow(row);

            return(true);
        }