private void execSearchCar() { try { string rowFilter = ""; string sValue = this.txtCarNo.Text.Trim(); if (sValue.Length == 0) { this.txtCarNo.Focus(); } else { sValue = Check.ValueReplace(sValue); if ("0".Equals(this.comType.SelectedValue.ToString())) { rowFilter = "CarNum like '%" + sValue + "%'"; } else if ("1".Equals(this.comType.SelectedValue.ToString())) { rowFilter = "CarId = " + sValue; } else if ("2".Equals(this.comType.SelectedValue.ToString())) { rowFilter = "SimNum like '%" + sValue + "%'"; } else if ("3".Equals(this.comType.SelectedValue.ToString()) && (this.m_dtShippingList != null)) { rowFilter = "WaybillCode like '%" + sValue + "%'"; DataView view = new DataView(this.m_dtShippingList, rowFilter, "", DataViewRowState.CurrentRows); if (view.Count == 0) { this.txtCarNo.Focus(); return; } string str3 = view[0]["CarId"].ToString(); rowFilter = "CarId = " + str3; } else if (this.m_dtCarList.Columns.Contains("DriverName") && "4".Equals(this.comType.SelectedValue.ToString())) { rowFilter = "DriverName like '%" + sValue + "%'"; } else { if ("5".Equals(this.comType.SelectedValue.ToString()) || "6".Equals(this.comType.SelectedValue.ToString())) { string str4 = "5".Equals(this.comType.SelectedValue.ToString()) ? "2" : "3"; rowFilter = "AreaName like '%" + sValue + "%' and AreaType = '" + str4 + "' "; DataView view2 = new DataView(this.m_dtAllAreaList, rowFilter, "AreaCode", DataViewRowState.CurrentRows); if (view2.Count == 0) { this.txtCarNo.Focus(); return; } int nodeIndex = -1; if (this.tvList.CurrentNode != null) { nodeIndex = ((ThreeStateTreeNode)this.tvList.CurrentNode).NodeIndex; } ThreeStateTreeNode node = new ThreeStateTreeNode(); bool flag = false; foreach (DataRowView view3 in view2) { string sAreaId = view3["AreaCode"].ToString(); ThreeStateTreeNode node2 = this.tvList.getAreaById(sAreaId); if ((node2 != null) && (node2.NodeIndex > nodeIndex)) { node = node2; flag = true; break; } } if (!flag) { string str6 = view2[0]["AreaCode"].ToString(); ThreeStateTreeNode node3 = this.tvList.getAreaById(str6); if (node3 == null) { this.txtCarNo.Focus(); return; } node = node3; } this.tvList.setSelectNode(node); this.tvList.setMulSelectNodes(node); node.EnsureVisible(); this.tvList.Focus(); } return; } DataView view4 = new DataView(this.m_dtCarList, rowFilter, "AreaCode,CarNum", DataViewRowState.CurrentRows); if (view4.Count == 0) { this.txtCarNo.Focus(); } else { view4[0]["CarNum"].ToString(); int num2 = -1; if (this.tvList.CurrentNode != null) { num2 = ((ThreeStateTreeNode)this.tvList.CurrentNode).NodeIndex; } ThreeStateTreeNode node4 = new ThreeStateTreeNode(); bool flag2 = false; foreach (DataRowView view5 in view4) { string sCarId = view5["CarId"].ToString(); ThreeStateTreeNode node5 = this.tvList.getNodeById(sCarId); if ((node5 != null) && (node5.NodeIndex > num2)) { node4 = node5; flag2 = true; break; } } if (!flag2) { string str8 = view4[0]["CarId"].ToString(); ThreeStateTreeNode node6 = this.tvList.getNodeById(str8); if (node6 == null) { this.txtCarNo.Focus(); return; } node4 = node6; } this.tvList.setSelectNode(node4); if (this.pbRichText.Visible) { MainForm.myMap.excuteSpatialQueryById(node4.CarId, node4.Longitude, node4.Latitude); this.ShowCarDetail(node4); } node4.EnsureVisible(); this.tvList.Focus(); } } } catch (Exception exception) { Record.execFileRecord("查询车辆", exception.Message); } }
private bool searchTrackCarByDriver(string searchkey) { try { DataView view = new DataView(this.m_dtCarList, searchkey, "AreaCode,CarNum", DataViewRowState.CurrentRows); if (view.Count == 0) { this.txtCarNo.Focus(); return false; } view[0]["CarNum"].ToString(); int nodeIndex = -1; if (this.tvTrackCar.CurrentNode != null) { nodeIndex = ((ThreeStateTreeNode)this.tvTrackCar.CurrentNode).NodeIndex; } ThreeStateTreeNode node = new ThreeStateTreeNode(); bool flag = false; foreach (DataRowView view2 in view) { string sCarId = view2["CarId"].ToString(); ThreeStateTreeNode node2 = this.tvTrackCar.getNodeById(sCarId); if ((node2 != null) && (node2.NodeIndex > nodeIndex)) { node = node2; flag = true; break; } } if (!flag) { string str2 = view[0]["CarId"].ToString(); ThreeStateTreeNode node3 = this.tvTrackCar.getNodeById(str2); if (node3 == null) { this.txtCarNo.Focus(); return false; } node = node3; } this.tvTrackCar.setSelectNode(node); node.EnsureVisible(); this.tvTrackCar.Focus(); view = null; } catch { } return true; }
private void execSearchAlarmCar() { try { string searchkey = ""; string str2 = this.txtCarNo.Text.Trim(); if ((str2.Length == 0) || (this.m_dtCarAlermList == null)) { this.txtCarNo.Focus(); } else { if ("0".Equals(this.comType.SelectedValue.ToString())) { searchkey = "CarNum like '%" + str2 + "%'"; } if ("1".Equals(this.comType.SelectedValue.ToString())) { searchkey = "CarId = " + str2; } if ("2".Equals(this.comType.SelectedValue.ToString())) { searchkey = "SimNum like '%" + str2 + "%'"; } else if ("4".Equals(this.comType.SelectedValue.ToString())) { searchkey = "DriverName like '%" + str2 + "%'"; this.searchTrackCarByDriver(searchkey); return; } DataView view = new DataView(this.m_dtCarAlermList, searchkey, "CarNum", DataViewRowState.CurrentRows); if (view.Count == 0) { this.txtCarNo.Focus(); } else { view[0]["CarNum"].ToString(); int nodeIndex = -1; if (this.tvTrackCar.CurrentNode != null) { nodeIndex = ((ThreeStateTreeNode)this.tvTrackCar.CurrentNode).NodeIndex; } ThreeStateTreeNode node = new ThreeStateTreeNode(); bool flag = false; foreach (DataRowView view2 in view) { string sCarId = view2["CarId"].ToString(); ThreeStateTreeNode node2 = this.tvTrackCar.getNodeById(sCarId); if ((node2 != null) && (node2.NodeIndex > nodeIndex)) { node = node2; flag = true; break; } } if (!flag) { string str4 = view[0]["CarId"].ToString(); ThreeStateTreeNode node3 = this.tvTrackCar.getNodeById(str4); if (node3 == null) { this.txtCarNo.Focus(); return; } node = node3; } this.tvTrackCar.setSelectNode(node); node.EnsureVisible(); this.tvTrackCar.Focus(); view = null; } } } catch (Exception exception) { Record.execFileRecord("查询报警车辆", exception.Message); } }