public GpsResponse iSetPathAlarm(int ParamType, string sCarValue, string sPw, string[] PathList) { GpsResponse response = new GpsResponse(-1L); try { PathAlarmList pathAlarmList = new PathAlarmList(); if (PathList.Length <= 0) { response.ErrorMsg = "没有选择预设路线!"; Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg); return response; } StringBuilder builder = new StringBuilder(); foreach (string str in PathList) { builder.Append(str + ","); } DataTable table = RemotingClient.Car_GetPathRouteByPathName(builder.ToString().Trim(new char[] { ',' })); if ((table == null) || (table.Rows.Count <= 0)) { response.ErrorMsg = "没有读取到偏移路线数据,请重新设置"; Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg); return response; } foreach (DataRow row in table.Rows) { PathAlarm alarm = new PathAlarm(); ArrayList list2 = new ArrayList(); string str2 = row["PathName"] as string; string str3 = row["alarmPathDot"] as string; if (string.IsNullOrEmpty(str3)) { response.ErrorMsg = "解析行驶线路失败!"; Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg); return response; } string[] strArray = str3.Split(new char[] { '/' }); alarm.PointCount = strArray.Length; for (int i = 0; i < (strArray.Length - 1); i++) { if (string.IsNullOrEmpty(strArray[i])) { response.ErrorMsg = "解析行驶线路失败!"; Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg); return response; } string[] strArray2 = strArray[i].Split(new char[] { '*' }); if (strArray2.Length != 2) { response.ErrorMsg = "解析行驶线路失败!"; Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg); return response; } Point point = new Point { Longitude = double.Parse(strArray2[0]), Latitude = double.Parse(strArray2[1]) }; list2.Add(point); } alarm.Points = list2; alarm.PathName = str2; pathAlarmList.Add(alarm); } if ((pathAlarmList == null) || (pathAlarmList.Count < 0)) { response.ErrorMsg = "路线信息集合为空!"; Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg); return response; } pathAlarmList.OrderCode = CmdParam.OrderCode.设置偏移路线报警; Response result = RemotingClient.DownData_SelMultiPathAlarm((CmdParam.ParamType) ParamType, sCarValue, sPw, CmdParam.CommMode.未知方式, pathAlarmList); return this.execToResponse(result); } catch (Exception exception) { Record.execFileRecord("插件操作->设置偏移路线报警", exception.Message); response.ErrorMsg = exception.Message; return response; } }
private bool getParam() { DataTable dataSource = this.dgvPath.DataSource as DataTable; foreach (DataRow row in dataSource.Rows) { PathAlarmList item = new PathAlarmList { OrderCode = base.OrderCode }; string str = row["pathname"].ToString(); DataTable table2 = this.datalist[str]; int num = 1; foreach (DataRow row2 in table2.Rows) { PathAlarm alarm = new PathAlarm(); ArrayList list2 = new ArrayList(); alarm.Points = list2; alarm.PathName = str; alarm.ID = num; foreach (string str2 in row2["lanlon"].ToString().Split(new char[] { ';' })) { ParamLibrary.CmdParamInfo.Point point = new ParamLibrary.CmdParamInfo.Point(); string[] strArray2 = str2.Split(new char[] { ',' }); if (strArray2.Length == 2) { point.Latitude = Convert.ToDouble(strArray2[1]); point.Longitude = Convert.ToDouble(strArray2[0]); list2.Add(point); } } string pStrNum = row2["MaxSpeed"].ToString(); string str4 = row2["MaxSpeedTm"].ToString(); if (!Check.isNumeric(pStrNum, Check.NumType.sByte)) { MessageBox.Show("路线\"" + str + "\"最高时速必须为0-255的数字!"); return false; } alarm.Speed = byte.Parse(pStrNum); if (!Check.isNumeric(str4, Check.NumType.sByte) || ((int.Parse(str4) % 5) != 0)) { MessageBox.Show("路线\"" + str + "\"持续时长必须为0-255之间5的倍数!"); return false; } alarm.Time = byte.Parse(str4); alarm.DriEnough = Convert.ToInt32(row2["maxtm"].ToString()); alarm.DriNoEnough = Convert.ToInt32(row2["mintm"].ToString()); item.Add(alarm); num++; } string str5 = row["Begintm"].ToString(); string str6 = row["Endtm"].ToString(); item.BeginTime = str5; item.EndTime = str6; item.PathFlag = this.GeneralValue(this.GeneralDomainText(row["pathattr"].ToString())); this.sendlist.Add(item); } return true; }