private void dateTimePicker1_DateChanged(object sender, EventArgs e) { string a = dateTimePicker1.Value.ToString("yyyy-MM-dd"); TmpAndHmd paivita = new TmpAndHmd(); SetTmpAndHmd2($"SELECT paivamaara, aika, lampotila, ilmankosteus FROM weather WHERE paivamaara LIKE '{a}%' "); paivita.SetTmpAndHmd($"SELECT AVG (lampotila) AS lampotila, AVG (ilmankosteus) AS ilmankosteus FROM weather WHERE paivamaara LIKE '{a}%' "); lampotilaAvgFromDate.Text = paivita.GetTmp() + "°C"; ilmankosteusAvgFromDate.Text = paivita.GetHmd() + "%"; foreach (var series in lampotilaChart.Series) { series.Points.Clear(); } SetTmpAndHmdGraph($"SELECT * FROM weather WHERE paivamaara LIKE '{a}%' "); }
private void Button1_Click_1(object sender, EventArgs e) { TmpAndHmd paivita = new TmpAndHmd(); paivita.SetTmpAndHmd("SELECT lampotila, ilmankosteus FROM weather WHERE DATE(paivamaara) = CURDATE()"); if (paivita.GetVar() == 0) { lampotila.Text = paivita.GetTmp() + "°C"; ilmankosteus.Text = paivita.GetHmd() + "%"; paivita.SetTmpAndHmd("SELECT AVG (lampotila) AS lampotila, AVG (ilmankosteus) AS ilmankosteus FROM weather WHERE DATE(paivamaara) = CURDATE()"); lampotilaAvg.Text = paivita.GetTmp() + "°C"; ilmankosteusAvg.Text = paivita.GetHmd() + "%"; } else { MessageBox.Show("NoData"); } }
private void Form1_Load(object sender, EventArgs e) { TmpAndHmd paivita = new TmpAndHmd(); paivita.SetTmpAndHmd("SELECT lampotila, ilmankosteus FROM weather WHERE DATE(paivamaara) = CURDATE() ORDER BY idweather");// DESC LIMIT 1"); if (paivita.GetVar() == 0) { lampotila.Text = paivita.GetTmp() + "°C"; ilmankosteus.Text = paivita.GetHmd() + "%"; paivita.SetTmpAndHmd("SELECT AVG (lampotila) AS lampotila, AVG (ilmankosteus) AS ilmankosteus FROM weather WHERE DATE(paivamaara) = CURDATE()"); lampotilaAvg.Text = paivita.GetTmp() + "°C"; ilmankosteusAvg.Text = paivita.GetHmd() + "%"; paivita.SetTmpAndHmd($"SELECT AVG (lampotila) AS lampotila, AVG (ilmankosteus) AS ilmankosteus FROM weather WHERE DATE(paivamaara) = CURDATE()"); lampotilaAvgFromDate.Text = paivita.GetTmp() + "°C"; ilmankosteusAvgFromDate.Text = paivita.GetHmd() + "%"; SetTmpAndHmd2($"SELECT paivamaara, aika, lampotila, ilmankosteus FROM weather WHERE DATE(paivamaara) = CURDATE()"); SetTmpAndHmdGraph($"SELECT * FROM weather WHERE DATE(paivamaara) = CURDATE()"); } else { MessageBox.Show("No Data."); } }