private int GetSensorTypeDecimals(string sensorType) { int sensorTypeDecimals = 1; SensorTypeInfo sensorTypeInfo = null; sensorType = sensorType.ToStr().Trim().ToUpper(); if (AlarmHelper.IsTempSensor(sensorType)) { sensorTypeDecimals = 1; } else if (sensorType.IndexOf("HUMI") >= 0) { sensorTypeDecimals = 0; } else if (AlarmHelper.IsContactSensor(sensorType)) { sensorTypeDecimals = 0; } else if (sensorType.IndexOf("REPEA") >= 0) { sensorTypeDecimals = 0; } else if (sensorType.Length > 0) { sensorTypeInfo = AlarmHelper.GetSensorTypeInfo(sensorType); if (sensorTypeInfo.ID != 0) { sensorTypeDecimals = sensorTypeInfo.nDecimals; sensorTypeInfo = null; } } return(sensorTypeDecimals); }
/// <summary> /// Check for sensor type Units Of Measure /// </summary> /// <param name="alarmObject"></param> /// <returns></returns> private string GetSensorTypeUOM(Interface.Alarm.AlarmObject alarmObject) { string sensorType = "", sensorTypeUOM = ""; SensorTypeInfo sensorTypeInfo = null; sensorType = alarmObject.SensorType.ToStr().Trim().ToUpper(); if (AlarmHelper.IsTempSensor(sensorType)) { sensorTypeUOM = (alarmObject.IsCelsius) ? "C" : "F"; } else if (sensorType.IndexOf("HUMI") >= 0) { sensorTypeUOM = "%RH"; } else if (AlarmHelper.IsContactSensor(sensorType)) { sensorTypeUOM = ""; } else if (sensorType.Length > 0) { sensorTypeInfo = AlarmHelper.GetSensorTypeInfo(sensorType); if (sensorTypeInfo != null) { sensorTypeUOM = sensorTypeInfo.UOM; sensorTypeInfo = null; } } return(sensorTypeUOM); }