using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Diagnostics; using System.Globalization; namespace WillemsWeerWachter { public partial class _default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { DateTime startSelect = DateTime.Now.AddDays(-1); DateTime endSelect = startSelect.AddDays(5); string select = "date>='" + startSelect + "' AND date<='" + endSelect + "'"; KiteForecast[] forecasts = WmDataIntermediar.getKiteForecasts(select); forecastGrid.DataSource = forecasts; forecastGrid.DataBind(); Status status = WmDataIntermediar.getStatus(); lastTideUpdateLbl.Text = status.LastTideUpdate.ToString(); lastWeatherUpdateLbl.Text = status.LastWeatherUpdate.ToString(); } protected void forecastGrid_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { KiteForecast displayItem = (KiteForecast)e.Row.DataItem; string directionText = "-"; switch (displayItem.WindDirection) { case WindDirection.EAST: directionText = "oost"; break; case WindDirection.NORTH: directionText = "noord"; break; case WindDirection.NORTH_EAST: directionText = "noordoost"; break; case WindDirection.NORTH_WEST: directionText = "noordwest"; break; case WindDirection.SOUTH: directionText = "zuid"; break; case WindDirection.SOUTH_EAST: directionText = "zuidoost"; break; case WindDirection.SOUTH_WEST: directionText = "zuidwest"; break; case WindDirection.WEST: directionText = "west"; break; } e.Row.Cells[2].Text = directionText; e.Row.Cells[3].Text = displayItem.LowTide1Moment.ToShortTimeString(); e.Row.Cells[3].ToolTip = displayItem.LowTide1WaterPosition + " cm"; e.Row.Cells[4].Text = displayItem.HighTide1Moment.ToShortTimeString(); e.Row.Cells[4].ToolTip = displayItem.HighTide1WaterPosition + " cm"; if (displayItem.LowTide2Moment > DateTime.Now.AddDays( -100)) { e.Row.Cells[5].Text = displayItem.LowTide2Moment.ToShortTimeString(); e.Row.Cells[5].ToolTip = displayItem.LowTide2WaterPosition + " cm"; } else { e.Row.Cells[5].Text = "-"; } if (displayItem.HighTide2Moment > DateTime.Now.AddDays(-100)) { e.Row.Cells[6].Text = displayItem.HighTide2Moment.ToShortTimeString(); e.Row.Cells[6].ToolTip = displayItem.HighTide2WaterPosition + " cm"; } else { e.Row.Cells[6].Text = "-"; } e.Row.Cells[7].Text = displayItem.PercentageRain.ToString() + "%"; e.Row.Cells[7].ToolTip = displayItem.PercentageSun.ToString() + "% kans op zon"; e.Row.Cells[8].Text = displayItem.TemperatureAfternoon.ToString() + "ºC"; e.Row.Cells[8].ToolTip= displayItem.TemperatureMinimum.ToString() + "ºC minimum"; double score = displayItem.getConditionsQuality(); e.Row.Cells[9].Text = score.ToString() + "%"; if (score >= 85) { e.Row.Font.Bold = true; e.Row.ForeColor = System.Drawing.Color.Green; } } } } }