private bool getRegionAlarmList(bool isStartPoint, ref RegionAlarmList m_RegionAlarmList) { int num = 0; string str = ""; int num2 = 0; string str2 = ""; string str3 = ""; string str4 = ""; int num3 = this.getRegionType(!isStartPoint); ArrayList list = new ArrayList(); RegionAlarm alarm = new RegionAlarm(); DataRow row = isStartPoint ? (this.lbStartPoint.SelectedItem as DataRowView).Row : (this.lbEndPoint.SelectedItem as DataRowView).Row; str = row["RegionName"].ToString() ?? ""; num2 = Convert.ToInt32(row["RegionId"].ToString()); alarm.newRegionId = num2; alarm.PathName = str; alarm.RegionType = num3; alarm.RegionID = num2; str4 = row["RegionDot"].ToString() ?? ""; alarm.AlarmRegionDot = num3 + @"\" + str4.Replace("*", @"\").Trim(new char[] { '\\' }); string[] strArray = str4.Split(new char[] { '*' }); num += strArray.Length; for (int i = 0; i < (strArray.Length - 1); i++) { if (string.IsNullOrEmpty(strArray[i])) { MessageBox.Show(ERRORPATHAlARM); return(false); } string[] strArray2 = strArray[i].Split(new char[] { '\\' }); if (strArray2.Length < 2) { MessageBox.Show(ERRORPATHAlARM); return(false); } ParamLibrary.CmdParamInfo.Point point = new ParamLibrary.CmdParamInfo.Point { Longitude = double.Parse(strArray2[0]), Latitude = double.Parse(strArray2[1]) }; list.Add(point); } alarm.Points = list; str2 = ""; str3 = ""; string sStr = ""; string str6 = ""; string str7 = ""; alarm.toEndTime = this.getToTime(sStr); alarm.toBackTime = this.getToTime(sStr); alarm.param = this.GetRegionParam(isStartPoint); alarm.PlanUpTime = str6; alarm.PlanDownTime = str7; alarm.BeginTime = str2; alarm.EndTime = str3; m_RegionAlarmList.Add(alarm); return(true); }
private bool getParam(int iRegionFeature) { if (base.OrderCode == CmdParam.OrderCode.区域报警设置) { int num = 0; string str = ""; int num2 = 0; string str2 = ""; if (!this.chkSeletRegion()) { this.dgvArea.Focus(); return(false); } this.m_RegionAlarmList = new RegionAlarmList(); for (int i = 0; i < this.dgvArea.Rows.Count; i++) { int num4 = this.getRegionType(i); if (num4 >= 0) { ArrayList list = new ArrayList(); RegionAlarm alarm = new RegionAlarm(); str = this.dgvArea.Rows[i].Cells["RegionName"].Value.ToString(); ///ToString num2 = int.Parse(this.dgvArea.Rows[i].Cells["RegionId"].Value.ToString()); if (bool.Parse(this.dgvArea.Rows[i].Cells["InOutRegion"].Value.ToString())) { alarm.newRegionId = 0; } else { alarm.newRegionId = num2; } alarm.PathName = str; alarm.RegionType = num4; alarm.RegionID = num2; str2 = this.dgvArea.Rows[i].Cells["RegionDot"].Value.ToString(); ///ToString alarm.AlarmRegionDot = num4 + @"\" + str2.Replace("*", @"\").Trim(new char[] { '\\' }); string[] strArray = str2.Split(new char[] { '*' }); num += strArray.Length; for (int j = 0; j < (strArray.Length - 1); j++) { if (string.IsNullOrEmpty(strArray[j])) { MessageBox.Show(ERRORPATHAlARM); return(false); } string[] strArray2 = strArray[j].Split(new char[] { '\\' }); if (strArray2.Length < 2) { MessageBox.Show(ERRORPATHAlARM); return(false); } ParamLibrary.CmdParamInfo.Point point = new ParamLibrary.CmdParamInfo.Point { Longitude = double.Parse(strArray2[0]), Latitude = double.Parse(strArray2[1]) }; list.Add(point); } alarm.Points = list; this.m_RegionAlarmList.Add(alarm); } } this.m_RegionAlarmList.OrderCode = base.OrderCode; } else if (base.OrderCode == CmdParam.OrderCode.行车记录设置) { if (!this.chkSeletRegion()) { this.dgvArea.Focus(); return(false); } this.m_SimpleCmd.OrderCode = CmdParam.OrderCode.行车记录设置; ArrayList list2 = new ArrayList(); for (int k = 0; k < this.dgvArea.Rows.Count; k++) { int num7 = this.getRegionType(k); if (num7 >= 0) { string[] strArray3 = new string[4]; strArray3[0] = "1"; strArray3[1] = this.numStartIndex.Value.ToString(); string[] strArray4 = this.dgvArea.Rows[k].Cells["RegionDot"].Value.ToString().Replace("*", @"\").Trim(new char[] { '\\' }).Split(new char[] { '\\' }); strArray3[2] = strArray4[2] + "," + strArray4[3] + "," + strArray4[6] + "," + strArray4[7]; strArray3[3] = num7.ToString(); list2.Add(strArray3); } } this.m_SimpleCmd.CmdParams = list2; } return(true); }
public GpsResponse iSetRegionAlarm(int ParamType, string sCarValue, string sPw, ArrayList RegionList) { GpsResponse response = new GpsResponse(-1L); try { int num = 0; string str = ""; int num2 = 0; string str2 = ""; RegionAlarmList regionAlarmList = new RegionAlarmList(); string[] strArray = RegionList[0] as string[]; string[] strArray2 = RegionList[1] as string[]; int iRegionFeature = 0; string str3 = MainForm.myCarList.execChangeCarValue(ParamType, 1, sCarValue); if (string.IsNullOrEmpty(str3)) { response.ErrorMsg = string.Format("目标车辆:{0}不存在", sCarValue); Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg); return(response); } DataTable table = RemotingClient.Car_GetRegionInfo(str3, iRegionFeature); for (int i = 0; i < strArray.Length; i++) { int num5 = int.Parse(strArray2[i]); if (num5 >= 0) { ArrayList list2 = new ArrayList(); RegionAlarm alarm = new RegionAlarm(); num2 = int.Parse(strArray[i]); DataView view = new DataView(table, string.Format("RegionId='{0}'", num2), "", DataViewRowState.CurrentRows); if (view.Count <= 0) { response.ErrorMsg = string.Format("下发区域不存在!", new object[0]); Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg); return(response); } str = view[0]["regionName"].ToString(); alarm.newRegionId = num2; alarm.PathName = str; alarm.RegionType = num5; alarm.RegionID = num2; str2 = view[0]["regionDot"].ToString(); alarm.AlarmRegionDot = num5 + @"\" + str2.Replace("*", @"\").Trim(new char[] { '\\' }); string[] strArray3 = str2.Split(new char[] { '*' }); num += strArray3.Length; for (int j = 0; j < (strArray3.Length - 1); j++) { if (string.IsNullOrEmpty(strArray3[j])) { response.ErrorMsg = "解析区域失败!"; Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg); return(response); } string[] strArray4 = strArray3[j].Split(new char[] { '\\' }); if (strArray4.Length < 2) { response.ErrorMsg = "解析区域失败!"; Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg); return(response); } Point point = new Point { Longitude = double.Parse(strArray4[0]), Latitude = double.Parse(strArray4[1]) }; list2.Add(point); alarm.Points = list2; } regionAlarmList.Add(alarm); } } regionAlarmList.RegionFeature = iRegionFeature; regionAlarmList.OrderCode = CmdParam.OrderCode.设置区域报警; Response result = RemotingClient.DownData_SetRegionAlarm_FJYD((CmdParam.ParamType)ParamType, sCarValue, sPw, CmdParam.CommMode.未知方式, regionAlarmList); return(this.execToResponse(result)); } catch (Exception exception) { Record.execFileRecord("插件操作->设置区域报警", exception.Message); response.ErrorMsg = exception.Message; return(response); } }