private void btnSearch_Click(object sender, EventArgs e) { this.dgvSearchResult.DataSource = null; Utilities.CarSearch oSearchCar = new GPSTrackingMonitor.Utilities.CarSearch(GlobeVariables.RealtimeCarInfosTable.Copy()); switch (this.cbbSearchType.SelectedIndex) { case 0: this.dgvSearchResult.DataSource = oSearchCar.SearchByCarNumber(this.txtCarNumber.Text.Trim(), this.ckbAllMatched.Checked); break; case 1: double dSearchRaduis = 0; double dCoordX = 0; double dCoordY = 0; if (!double.TryParse(this.txtCoordX.Text.Trim(), out dCoordX) || !double.TryParse(this.txtCoordY.Text.Trim(), out dCoordY) || !double.TryParse(this.txtSearchRaduis.Text.Trim(), out dSearchRaduis)) { MessageBox.Show("请确定输入了正确的参数.", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } MapObjects2.Point oCenterPoint = new MapObjects2.PointClass(); oCenterPoint.X = dCoordX; oCenterPoint.Y = dCoordY; this.dgvSearchResult.DataSource = oSearchCar.SearchByCarLocation(oCenterPoint, dSearchRaduis); break; case 2: try { this.dgvSearchResult.DataSource = oSearchCar.SearchByCustomFilter(this.txtCustomFilter.Text); } catch (Exception ex) { MessageBox.Show("请确定您输入了正确的过滤条件。\r\n\r\n错误信息如下:\r\n\r\n" + ex.StackTrace); } break; } }
private void btnSearch_Click(object sender, EventArgs e) { this.dgvSearchResult.DataSource = null; Utilities.CarSearch oSearchCar = new GPSTrackingMonitor.Utilities.CarSearch(GlobeVariables.RealtimeCarInfosTable.Copy()); switch (this.cbbSearchType.SelectedIndex) { case 0: this.dgvSearchResult.DataSource = oSearchCar.SearchByCarNumber(this.txtCarNumber.Text.Trim(), this.ckbAllMatched.Checked); break; case 1: double dSearchRaduis = 0; double dCoordX = 0; double dCoordY = 0; if (!double.TryParse(this.txtCoordX.Text.Trim(), out dCoordX) || !double.TryParse(this.txtCoordY.Text.Trim(), out dCoordY) || !double.TryParse(this.txtSearchRaduis.Text.Trim(), out dSearchRaduis)) { MessageBox.Show("��ȷ����������ȷ�IJ���.", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } MapObjects2.Point oCenterPoint = new MapObjects2.PointClass(); oCenterPoint.X = dCoordX; oCenterPoint.Y = dCoordY; this.dgvSearchResult.DataSource = oSearchCar.SearchByCarLocation(oCenterPoint, dSearchRaduis); break; case 2: try { this.dgvSearchResult.DataSource = oSearchCar.SearchByCustomFilter(this.txtCustomFilter.Text); } catch (Exception ex) { MessageBox.Show("��ȷ������������ȷ�Ĺ���������\r\n\r\n������Ϣ����:\r\n\r\n" + ex.StackTrace); } break; } }