public Forecast() { From = new DateTime(); To = new DateTime(); Wind = new Wind(); Temperature = new Temperature(); Pressure = new Pressure(); Symbol = new Symbol(); Precipitation = new Precipitation(); Clouds = new Clouds(); }
public Forecast(params object[] args) { Id = int.Parse(args[0].ToString()); From = DateTime.Parse(args[2].ToString()); To = DateTime.Parse(args[3].ToString()); Humidity = FixDouble.ToDouble(args[4].ToString()); Temperature = new Temperature { UnitType = args[6].ToString(), Value = FixDouble.ToDouble(args[7].ToString()), Min = FixDouble.ToDouble(args[8].ToString()), Max = FixDouble.ToDouble(args[9].ToString()), }; Precipitation = new Precipitation { Unit = args[11].ToString(), Value = FixDouble.ToDouble(args[12].ToString()), Type = args[13].ToString() }; Pressure = new Pressure { Unit = args[15].ToString(), Value = FixDouble.ToDouble(args[16].ToString()) }; Symbol = new Symbol { Number = FixDouble.ToDouble(args[18].ToString()), Name = args[19].ToString(), Var = args[20].ToString(), }; Wind = new Wind { Direction = FixDouble.ToDouble(args[22].ToString()), Code = args[23].ToString(), DirectionName = args[24].ToString(), Speed = FixDouble.ToDouble(args[26].ToString()), SpeedName = args[27].ToString(), }; Clouds = new Clouds { Value = args[29].ToString(), All = FixDouble.ToDouble(args[30].ToString()), }; }
public Forecast(XmlNode node) { string fromQuery = "@from"; string toQuery = "@to"; string humidityQuery = "humidity/@value"; From = DateTime.Parse($"{node.SelectSingleNode(fromQuery)?.InnerText:O}"); To = DateTime.Parse($"{node.SelectSingleNode(toQuery)?.InnerText:O}"); Wind = new Wind(node); Temperature = new Temperature(node); Pressure = new Pressure(node); Symbol = new Symbol(node); Humidity = FixDouble.ToDouble(node.SelectSingleNode(humidityQuery)?.InnerText); Clouds = new Clouds(node); Precipitation = new Precipitation(node); }