public GetValuesOD() { // // TODO: Add constructor logic here // variableDs = ODvariables.GetVariableDataSet(); unitsDs = ODUnits.getUnitsDataset(); oDconnectionString = ConfigurationManager.ConnectionStrings["ODDB"]; }
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; }
public static units getUnitsElement(string unitsID, unitsDataset ds) { DataRow[] dr = ds.Tables["units"].Select("unitID = " + unitsID); if (dr.Length > 0) { unitsDataset.UnitsRow row = (unitsDataset.UnitsRow)dr[0]; string uID = row.UnitsID.ToString(); string unitType = String.IsNullOrEmpty(row.UnitsType) ? null : row.UnitsType; string unitAbbrev = String.IsNullOrEmpty(row.UnitsAbbreviation) ? null : row.UnitsAbbreviation; string unitName = String.IsNullOrEmpty(row.UnitsName) ? null : row.UnitsName; units u = CuahsiBuilder.CreateUnitsElement(null, uID, unitAbbrev, unitName); return u; } else { return null; } }