private void LoadTrucks() { DateTime dtStart = new DateTime(); DateTime dtEnd = new DateTime(); try { dtStart = Convert.ToDateTime(dtpStart.Text + " " + txtStartHour.Text); dtEnd = Convert.ToDateTime(dtpEnd.Text + " " + txtEndHour.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); } SQLCode mySQL = new SQLCode(); cboTrucks.Items.Clear(); try { List <string> trucks = mySQL.GetTrucks(dtStart, dtEnd); foreach (string s in trucks) { cboTrucks.Items.Add(s); } cboTrucks.Text = "Select"; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error"); } }
private void LoadPlaybackByBeat() { try { gvData.DataSource = null; gvData.Rows.Clear(); bool LogonOnly = false; if (chkLogon.Checked == true) { LogonOnly = true; } DateTime dtStart = Convert.ToDateTime(dtpStart.Text + " 00:00:00"); DateTime dtEnd = Convert.ToDateTime(dtpEnd.Text + " 23:59:59"); SQLCode mySQL = new SQLCode(); mySQL.LoadTrackingDataByBeat(cboBeats.Text, dtStart, dtEnd, LogonOnly); gvData.DataSource = GlobalData.allTrack; GPSTrack firstTrack = GlobalData.allTrack[0]; gMapControl1.Position = new PointLatLng(firstTrack.Lat, firstTrack.Lon); gMapControl1.Overlays.Clear(); GMapOverlay overlay = new GMapOverlay(gMapControl1, "base"); GMapMarkerGoogleGreen home = new GMapMarkerGoogleGreen(new PointLatLng(firstTrack.Lat, firstTrack.Lon)); overlay.Markers.Add(home); gMapControl1.Overlays.Add(overlay); iEventCount = GlobalData.allTrack.Count - 1; foreach (DataGridViewRow row in gvData.Rows) { row.DefaultCellStyle.BackColor = Color.White; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }