private List <Parking> SortedParkingList(List <Parking> list) { for (int count = 1; count < list.Count(); count++) { for (int i = 0; i < list.Count() - count; i++) { if (list[i].distanceFromNow > list[i + 1].distanceFromNow) { Parking temp = list[i]; list[i] = list[i + 1]; list[i + 1] = temp; } } } return(list); }
private void changeParking() { Parking p = sortedResult[init]; p_name_text.Text = p.p_name; p_address_text.Text = p.p_address; p_pri_cost.Text = p.p_pri_cost.ToString() + "원"; p_10m_cost.Text = p.p_cost_10m.ToString() + "원"; now_max.Text = p.p_now_num + " / " + p.p_max_num; open_time.Text = p.p_open_time; close_time.Text = p.p_close_time; p_distance_text.Text = p.distanceFromNow + "m"; nowGv.latitude = p.p_latitude; nowGv.longitude = p.p_longitude; //MessageBox.Show(p.p_latitude + ", " + p.p_longitude); Image img = NaverMapApi.MapDownload(nowGv, level); this.pictureBox1.Image = img; }
public Parking GetParking(int p_code) { string sql = string.Format("SELECT * FROM parking_project.parking where p_code={0};", p_code); Parking result; MySqlCommand command = new MySqlCommand(sql, connection); MySqlDataReader table = command.ExecuteReader(); try { if (table == null) { result = null; } table.Read(); result = new Parking(Int32.Parse(table["p_code"].ToString()), table["p_name"].ToString(), table["p_address"].ToString(), Double.Parse(table["p_latitude"].ToString()), Double.Parse(table["p_longitude"].ToString()), Int32.Parse(table["p_max_num"].ToString()), Int32.Parse(table["p_now_num"].ToString()), Int32.Parse(table["p_pri_cost"].ToString()), Int32.Parse(table["p_cost_10m"].ToString()), table["p_open_time"].ToString(), table["p_close_time"].ToString()); table.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); table.Close(); result = null; } return(result); }