/// <summary> /// Initializes the bed /// </summary> /// <param name="ID">The bed number</param> /// <param name="nMonitors"></param> /// <param name="ward"></param> /// <param name="bay"></param> public Bed(int ID, int nMonitors, Ward ward, int bay) { // Initialise fields this.bedNumber = ID; this.monitors = new Monitor[nMonitors]; wardRef = ward; bayID = bay; // Load any existing monitors LoadMonitorConfigurationFromDatabase(); }
/// <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]; }