Ejemplo n.º 1
0
        public static unitsDataset getUnitsDataset()
        {
            unitsDataset uDS = new unitsDataset();

            UnitsTableAdapter unitsTableAdapter = new UnitsTableAdapter();
            unitsTableAdapter.Connection.ConnectionString = Config.ODDB();

            try
            {
                unitsTableAdapter.Fill(uDS.Units);
            } catch  (Exception e)
            {
                log.Fatal("Cannot retrieve units from the database: " + e.Message); //+ unitsTableAdapter.Connection.DataSource
            }

            return uDS;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a VariablesDataSet, as defined by VariablesDataSet.xsd
        /// 
        /// In SDSC code, this variable is loaded once, and is stored in an 
        /// Application, or AppServer variable, and queries are run against the stored dataset.
        /// Other methods in this class are used to query the dataset.
        /// </summary>
        /// <param name="networkID"></param>
        /// <returns></returns>
        public static VariablesDataset GetVariableDataSet(int networkID)
        {
            VariablesDataset ds = new VariablesDataset();

            UnitsTableAdapter unitTableAdapter = new UnitsTableAdapter();
            VariablesTableAdapter varsTableAdapter = new VariablesTableAdapter();
            unitTableAdapter.Connection.ConnectionString = Config.ODDB();
            varsTableAdapter.Connection.ConnectionString = Config.ODDB();

            try
            {
                unitTableAdapter.Fill(ds.Units);
                varsTableAdapter.Fill(ds.Variables);
            }
            catch (Exception e)
            {
                log.Fatal("Cannot retrieve units or variables from database" + e.Message);
                    // + unitTableAdapter.Connection.DataSource
                throw new WaterOneFlowServerException("Cannot retrieve units or variables from database", e);
            }

            GetCategories(ds);
            return ds;
        }