public static siteInfoDataSet GetSiteInfoDataSet(locationParam[] LocationParameters) { siteInfoDataSet ds = new siteInfoDataSet(); SpatialReferencesTableAdapter spatialTableAdapter = new SpatialReferencesTableAdapter(); sitesTableAdapter sitesTableAdapter = new sitesTableAdapter(); spatialTableAdapter.Connection.ConnectionString = Config.ODDB(); sitesTableAdapter.Connection.ConnectionString = Config.ODDB(); try { spatialTableAdapter.Fill(ds.SpatialReferences); } catch (Exception e) { log.Fatal("Cannot connect to database " + e.Message); //+ spatialTableAdapter.Connection.DataSource throw new WaterOneFlowServerException(e.Message); } if (LocationParameters[0].isGeometry) { if (LocationParameters[0].Geometry.GetType().Equals(typeof(box))) { box queryBox = (box)LocationParameters[0].Geometry; sitesTableAdapter.FillByBox(ds.sites, queryBox.South, queryBox.North, queryBox.West, queryBox.East); } } else { siteInfoDataSet.sitesDataTable aSitetable = new siteInfoDataSet.sitesDataTable(); foreach (locationParam s in LocationParameters) { try { if (s.IsId) { int siteID = int.Parse(s.SiteCode); sitesTableAdapter.FillBySiteID(aSitetable, siteID); } else { sitesTableAdapter.FillBySiteCode(aSitetable, s.SiteCode); } ds.sites.Merge(aSitetable); } catch (Exception e) { log.Fatal("Cannot connect to database " + e.Message); //+ sitesTableAdapter.Connection.DataSource throw new WaterOneFlowServerException(e.Message); } } } return(ds); }
public static siteInfoDataSet GetSiteInfoDataSet(int siteID) { siteInfoDataSet ds = new siteInfoDataSet(); SpatialReferencesTableAdapter spatialTableAdapter = new SpatialReferencesTableAdapter(); sitesTableAdapter sitesTableAdapter = new sitesTableAdapter(); spatialTableAdapter.Connection.ConnectionString = odws.Config.ODDB(); sitesTableAdapter.Connection.ConnectionString = odws.Config.ODDB(); spatialTableAdapter.Fill(ds.SpatialReferences); sitesTableAdapter.FillBySiteID(ds.sites, siteID); return ds; }
public static siteInfoDataSet GetSiteInfoDataSet(int siteID) { siteInfoDataSet ds = new siteInfoDataSet(); SpatialReferencesTableAdapter spatialTableAdapter = new SpatialReferencesTableAdapter(); sitesTableAdapter sitesTableAdapter = new sitesTableAdapter(); spatialTableAdapter.Connection.ConnectionString = Config.ODDB(); sitesTableAdapter.Connection.ConnectionString = Config.ODDB(); spatialTableAdapter.Fill(ds.SpatialReferences); sitesTableAdapter.FillBySiteID(ds.sites, siteID); return(ds); }
public static siteInfoDataSet GetSiteInfoDataSet(locationParam[] LocationParameters) { siteInfoDataSet ds = CreateBaseSiteInfoDataset(); if (LocationParameters[0].isGeometry) { if (LocationParameters[0].Geometry.GetType().Equals(typeof(box))) { box queryBox = (box)LocationParameters[0].Geometry; GetSiteInfoDataSet(queryBox, ds); } } else { sitesTableAdapter sitesTableAdapter = CreateSitesTableAdapter(); foreach (locationParam s in LocationParameters) { try { siteInfoDataSet.sitesDataTable aSitetable = new siteInfoDataSet.sitesDataTable(); if (s.IsId) { int siteID = int.Parse(s.SiteCode); sitesTableAdapter.FillBySiteID(aSitetable, siteID); } else { sitesTableAdapter.FillBySiteCode(aSitetable, s.SiteCode); } ds.sites.Merge(aSitetable); } catch (Exception e) { log.Fatal("Cannot connect to database " + e.Message); //+ sitesTableAdapter.Connection.DataSource throw new WaterOneFlowServerException(e.Message); } } } return(ds); }