예제 #1
0
        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;
            }
예제 #3
0
        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);
        }
            private static siteInfoDataSet CreateBaseSiteInfoDataset()
            {
                siteInfoDataSet ds = new siteInfoDataSet();
                SpatialReferencesTableAdapter spatialTableAdapter =
                    new SpatialReferencesTableAdapter();
                sitesTableAdapter sitesTableAdapter = new sitesTableAdapter();

                spatialTableAdapter.Connection.ConnectionString = odws.Config.ODDB();
                sitesTableAdapter.Connection.ConnectionString   = odws.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);
                }
                return(ds);
            }
예제 #5
0
        public static siteInfoDataSet GetSiteInfoDataSet()
        {
            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);
                sitesTableAdapter.Fill(ds.sites);
            }
            catch (Exception e)
            {
                log.Fatal("Cannot retrieve information from connection " + e.Message);//+ spatialTableAdapter.Connection.DataSource
                throw new WaterOneFlowServerException("Database error", e);
            }

            return(ds);
        }
            public static siteInfoDataSet GetSiteInfoDataSet()
            {
                siteInfoDataSet ds = new siteInfoDataSet();

                SpatialReferencesTableAdapter spatialTableAdapter =
                    new SpatialReferencesTableAdapter();
                sitesTableAdapter sitesTableAdapter = new sitesTableAdapter();

                spatialTableAdapter.Connection.ConnectionString = odws.Config.ODDB();
                sitesTableAdapter.Connection.ConnectionString = odws.Config.ODDB();

                try
                {
                    spatialTableAdapter.Fill(ds.SpatialReferences);
                    sitesTableAdapter.Fill(ds.sites);
                }
                catch (Exception e)
                {
                    log.Fatal("Cannot retrieve information from connection " + e.Message);//+ spatialTableAdapter.Connection.DataSource
                    throw new WaterOneFlowServerException("Database error", e);
                }

                return ds;
            }
            private static siteInfoDataSet CreateBaseSiteInfoDataset()
            {
                siteInfoDataSet ds = new siteInfoDataSet();
                SpatialReferencesTableAdapter spatialTableAdapter =
                     new SpatialReferencesTableAdapter();
                sitesTableAdapter sitesTableAdapter = new sitesTableAdapter();
                spatialTableAdapter.Connection.ConnectionString = odws.Config.ODDB();
                sitesTableAdapter.Connection.ConnectionString = odws.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);
                }
                return ds;
            }