Exemple #1
0
        /// <summary>Load weather forecast by city id from database</summary>
        private WeatherForecastResponse LoadWeatherForecastFromDBbyCityId(int cityId)
        {
            WeatherForecastResponse tempForecast = new WeatherForecastResponse();

            tempForecast.list = new List <WeatherForecastInfo>();
            WeatherForecastInfo tempForecastInfo;

            DataTable table = SqliteDataAccess.GetTable($"SELECT * FROM WeatherForecast WHERE city_id = {cityId}");

            for (int i = 0; i < table.Rows.Count; i++)
            {
                tempForecastInfo = new WeatherForecastInfo(
                    Convert.ToSingle(table.Rows[i][3]),
                    Convert.ToSingle(table.Rows[i][4]),
                    Convert.ToSingle(table.Rows[i][5]),
                    Convert.ToSingle(table.Rows[i][6]),
                    Convert.ToInt32(table.Rows[i][7]),
                    Convert.ToInt32(table.Rows[i][8]),
                    Convert.ToInt32(table.Rows[i][9]),
                    Convert.ToInt32(table.Rows[i][10]),
                    table.Rows[i][11].ToString(),
                    table.Rows[i][12].ToString(),
                    table.Rows[i][13].ToString(),
                    Convert.ToSingle(table.Rows[i][14]),
                    Convert.ToInt32(table.Rows[i][15]),
                    Convert.ToInt32(table.Rows[i][16]),
                    table.Rows[i][2].ToString()
                    );

                tempForecast.list.Add(tempForecastInfo);
            }
            return(tempForecast);
        }
Exemple #2
0
        /// <summary>Show full info about weather forecast</summary>
        public void ShowFullWeatherByCard(WeatherForecastInfo weather)
        {
            DateTime dateTime = Convert.ToDateTime(weather.dt_txt);

            cityNameForecastText.text = "";

            dateForecastText.text = dateTime.ToShortDateString();

            dayOfWeekForecastText.text = dateTime.DayOfWeek.ToString();

            timeForecastText.text = dateTime.TimeOfDay.ToString();

            tempForecastText.text = weather.main.temp.ToString();

            tempMinForecastText.text = weather.main.temp_min.ToString();

            tempMaxForecastText.text = weather.main.temp_max.ToString();

            feels_likeForecastText.text = weather.main.feels_like.ToString();

            seaLevelForecastText.text = weather.main.sea_level.ToString();

            grndLevelForecastText.text = weather.main.grnd_level.ToString();

            pressureForecastText.text = weather.main.pressure.ToString();

            humidityForecastText.text = weather.main.humidity.ToString();

            windSpeedForecastText.text = weather.wind.speed.ToString();

            windDegForecastText.text = weather.wind.deg.ToString();

            cloudsForecastText.text = weather.clouds.all.ToString();
        }
Exemple #3
0
        public void ShowCard(WeatherForecastInfo weather)
        {
            DateTime dateTime = Convert.ToDateTime(weather.dt_txt);

            this.weather = weather;

            DateText.text      = dateTime.DayOfWeek.ToString();
            TimeText.text      = dateTime.ToShortTimeString();
            TempText.text      = weather.main.temp.ToString();
            CloudsText.text    = weather.clouds.all.ToString();
            WindSpeedText.text = weather.wind.speed.ToString();
            PressureText.text  = weather.main.pressure.ToString();
            HumidityText.text  = weather.main.humidity.ToString();
        }