public string ReadPressure(StreamReader sr) { string line = sr.ReadLine(); if (string.IsNullOrEmpty(line)) { return(null); } int i = 10; while (line.Substring(0, 1) != "#") { var values = line.Split(';'); PressureValue presValue = new PressureValue(); presValue.Id = i.ToString(); string type = values[0] == "0" ? "Rampa" : "Patamar"; presValue.Tipo = type; presValue.SetPoint = String.IsNullOrEmpty(values[1]) ? null : Convert.ToDouble(values[1], System.Globalization.CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture);; presValue.Taxa = String.IsNullOrEmpty(values[2]) ? null : Convert.ToDouble(values[2], System.Globalization.CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); presValue.Tempo = values[3]; presValue.Tolerancia = String.IsNullOrEmpty(values[4]) ? null : Convert.ToDouble(values[4], System.Globalization.CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); i += 10; _pressureRepository.addValue(presValue); line = sr.ReadLine(); if (string.IsNullOrEmpty(line)) { return(null); } } return(line); }
/// <summary> /// Returns true if TemperatureZoneStatus instances are equal /// </summary> /// <param name="other">Instance of TemperatureZoneStatus to be compared</param> /// <returns>Boolean</returns> public bool Equals(TemperatureZoneStatus other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( TemperatureValue == other.TemperatureValue || TemperatureValue != null && TemperatureValue.Equals(other.TemperatureValue) ) && ( HumidityValue == other.HumidityValue || HumidityValue != null && HumidityValue.Equals(other.HumidityValue) ) && ( PressureValue == other.PressureValue || PressureValue != null && PressureValue.Equals(other.PressureValue) ) && ( Units == other.Units || Units != null && Units.Equals(other.Units) ) && ( Timestamp == other.Timestamp || Timestamp != null && Timestamp.Equals(other.Timestamp) )); }
public bool isInputValid(PressureValue tempValue) { if (!String.IsNullOrEmpty(tempValue.SetPoint)) { validateSetPoint(tempValue.SetPoint); } if (!String.IsNullOrEmpty(tempValue.Taxa)) { validateTaxa(tempValue.Taxa); } if (!String.IsNullOrEmpty(tempValue.Tempo)) { validateTempo(tempValue.Tempo); } if (!String.IsNullOrEmpty(tempValue.Tolerancia)) { validateTolerancia(tempValue.Tolerancia); } if (!String.IsNullOrEmpty(tempValue.Tipo)) { if (tempValue.Tipo == "Rampa") { if (!String.IsNullOrEmpty(tempValue.Taxa) && Convert.ToDouble(tempValue.Taxa, CultureInfo.InvariantCulture) != 0) { return(!String.IsNullOrEmpty(tempValue.SetPoint) && !String.IsNullOrEmpty(tempValue.Id) && !String.IsNullOrEmpty(tempValue.Taxa) && !String.IsNullOrEmpty(tempValue.Tolerancia)); } else { return(false); } } else { return(!String.IsNullOrEmpty(tempValue.SetPoint) && !String.IsNullOrEmpty(tempValue.Id) && !String.IsNullOrEmpty(tempValue.Tempo) && (Convert.ToInt32(tempValue.Tempo, CultureInfo.InvariantCulture) != 0) && !String.IsNullOrEmpty(tempValue.Tolerancia)); } } return(false); }
private void SetPressureValue(PressureValue presValue) { (_controlList.Where(x => x.Name == "Id").FirstOrDefault() as TextBox).Text = presValue.Id; (_controlList.Where(x => x.Name == "Tipo").FirstOrDefault() as ComboBox).SelectedIndex = (_controlList.Where(x => x.Name == "Tipo").FirstOrDefault() as ComboBox).Items.IndexOf(presValue.Tipo); (_controlList.Where(x => x.Name == "SetPoint").FirstOrDefault() as TextBox).Text = presValue.SetPoint; if ((_controlList.Where(x => x.Name == "Taxa").FirstOrDefault() as TextBox).IsEnabled) { (_controlList.Where(x => x.Name == "Taxa").FirstOrDefault() as TextBox).Text = presValue.Taxa; } if ((_controlList.Where(x => x.Name == "Tempo").FirstOrDefault() as TextBox).IsEnabled) { (_controlList.Where(x => x.Name == "Tempo").FirstOrDefault() as TextBox).Text = presValue.Tempo; } (_controlList.Where(x => x.Name == "Tolerancia").FirstOrDefault() as TextBox).Text = presValue.Tolerancia; }
private PressureValue GetPressureValue() { PressureValue newValue = new PressureValue(); PressureValidation presValidation = new PressureValidation(); newValue.Id = (_controlList.Where(x => x.Name == "Id").FirstOrDefault() as TextBox).Text; newValue.SetPoint = (_controlList.Where(x => x.Name == "SetPoint").FirstOrDefault() as TextBox).Text; newValue.Taxa = (_controlList.Where(x => x.Name == "Taxa").FirstOrDefault() as TextBox).Text; newValue.Tempo = (_controlList.Where(x => x.Name == "Tempo").FirstOrDefault() as TextBox).Text; newValue.Tolerancia = (_controlList.Where(x => x.Name == "Tolerancia").FirstOrDefault() as TextBox).Text; newValue.Tipo = (_controlList.Where(x => x.Name == "Tipo").FirstOrDefault() as ComboBox).SelectedValue as string; newValue.SetPoint = String.IsNullOrEmpty(newValue.SetPoint) ? null: Convert.ToDouble(newValue.SetPoint, CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); newValue.Taxa = String.IsNullOrEmpty(newValue.Taxa) ? null : Convert.ToDouble(newValue.Taxa, CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); newValue.Tolerancia = String.IsNullOrEmpty(newValue.Tolerancia) ? null : Convert.ToDouble(newValue.Tolerancia, CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); if (presValidation.isInputValid(newValue)) { CleanPressure(); return(newValue); } return(null); }
public void setValueFromControls(string type, object values) { switch (type) { case "Vacuum": VacuumValue vacValue = values as VacuumValue; SetVacuumValue(vacValue); break; case "Pressure": PressureValue presValue = values as PressureValue; SetPressureValue(presValue); break; case "Temperature": TemperatureValue TempValue = values as TemperatureValue; SetTemperatureValue(TempValue); break; default: throw new FormatException("Data Type Not Found"); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (TemperatureValue != null) { hashCode = hashCode * 59 + TemperatureValue.GetHashCode(); } if (HumidityValue != null) { hashCode = hashCode * 59 + HumidityValue.GetHashCode(); } if (PressureValue != null) { hashCode = hashCode * 59 + PressureValue.GetHashCode(); } if (Units != null) { hashCode = hashCode * 59 + Units.GetHashCode(); } if (Timestamp != null) { hashCode = hashCode * 59 + Timestamp.GetHashCode(); } return(hashCode); } }