/// <summary> /// Constructs a monitor for use in a bed /// </summary> /// <param name="monitorType">The type of monitor to create</param> /// <param name="ward"></param> /// <param name="bay"></param> /// <param name="bed"></param> /// <param name="number"></param> public Monitor(int monitorType, Ward ward, int bay, int bed, int number) { DataSet monitorTypeInfo = SqlQueryExecutor.SelectAllFromTable("Monitors"); DataTableReader reader = monitorTypeInfo.CreateDataReader(); this.ward = ward; this.bay = bay; this.bed = bed; while (reader.Read()) { sensorTypes.Add(reader.GetString(1)); defaultValues.Add(reader.GetDouble(5)); defaultMinValues.Add(reader.GetDouble(3)); defaultMaxValues.Add(reader.GetDouble(4)); readRanges.Add(reader.GetDouble(6)); readFrequencies.Add(reader.GetInt32(2)); readRounds.Add(2); } this.name = sensorTypes[monitorType]; sensor = new MonitorSensor(readFrequencies[monitorType], defaultValues[monitorType], readRanges[monitorType], defaultMaxValues[monitorType], defaultMinValues[monitorType]); round = readRounds[monitorType]; }
/// <summary> /// Initializes the ward by retrieving ward data from the database /// </summary> /// <param name="ID"></param> public Ward(int ID) { this.id = ID; //Load info from database DataSet wardInfo; wardInfo = SqlQueryExecutor.SelectAllFromTable("Ward_Settings", "Id = " + ID.ToString()); DataTableReader reader = wardInfo.CreateDataReader(); reader.Read(); //Load data from reader name = reader.GetString(1); int nBays = reader.GetInt32(2); int nBeds = reader.GetInt32(3); int nMonitors = reader.GetInt32(4); //Load bays bays = new Bay[nBays]; for (int bay = 0; bay < nBays; bay++) { bays[bay] = new Bay(bay, nBeds, nMonitors, this); } }