protected void Page_Load(object sender, EventArgs e) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); ThermostatMonitorLib.Locations locations = ThermostatMonitorLib.Locations.LoadLocationsByUserId(AppUser.Current.UserData.Id); foreach (ThermostatMonitorLib.Location location in locations) { sb.Append("<tr><td><a href=\"location.aspx?id=" + location.Id.ToString() + "\">" + location.Name.ToString() + "</a></td><td> - API Key: <b>" + location.ApiKey + "</b></td></tr>"); ThermostatMonitorLib.Thermostats thermostats = ThermostatMonitorLib.Thermostats.LoadThermostatsByLocationId(location.Id); foreach (ThermostatMonitorLib.Thermostat thermostat in thermostats) { sb.Append("<tr><td></td><td> - <a href=\"thermostat.aspx?id=" + thermostat.Id.ToString() + "\">" + thermostat.DisplayName + "</a> [<a href=\"editthermostat.aspx?id=" + thermostat.Id.ToString() + "\">Edit</a>]</td></tr>"); } } ThermostatsLit.Text = sb.ToString(); }
public static Locations LoadLocationsByUserId(int userId) { return(Locations.LoadLocations("locations_load_by_user_id", CommandType.StoredProcedure, new MySqlParameter[] { new MySqlParameter("@user_id", userId) })); }
public static Locations LoadLocations(string sql, System.Data.CommandType commandType, MySqlParameter[] parameters) { return(Locations.ConvertFromDT(Utils.ExecuteQuery(sql, commandType, parameters))); }
public static Locations LoadAllLocations() { return(Locations.LoadLocations("locations_load_all", CommandType.StoredProcedure, null)); }
public static Locations LoadLocationsByUserId(System.Int32 userId) { return(Locations.LoadLocations("LoadLocationsByUserId", CommandType.StoredProcedure, new SqlParameter[] { new SqlParameter("@UserId", userId) })); }