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() { 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); }
private bool getParam() { if (base.OrderCode != CmdParam.OrderCode.载兴趣点) { this.m_PathAlarmList = new PathAlarmList(); this.dataFilter(""); string str2 = this.getCheckPathName(); if (string.IsNullOrEmpty(str2)) { MessageBox.Show("没有选择预设路线!"); return(false); } DataTable table4 = RemotingClient.Car_GetPathRouteByPathName(str2); if ((table4 == null) || (table4.Rows.Count <= 0)) { MessageBox.Show("没有读取到偏移路线数据,请重新设置"); return(false); } foreach (DataRow row2 in table4.Rows) { PathAlarm alarm = new PathAlarm(); ArrayList list = new ArrayList(); string str3 = row2["PathName"] as string; string str4 = row2["alarmPathDot"] as string; if (string.IsNullOrEmpty(str4)) { MessageBox.Show(ERRORPATHAlARM); return(false); } string[] strArray = str4.Split(new char[] { '/' }); alarm.PointCount = 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; alarm.PathName = str3; this.m_PathAlarmList.Add(alarm); } if ((this.m_PathAlarmList == null) || (this.m_PathAlarmList.Count < 0)) { return(false); } } else { int iPoiAutn = 0; string str = this.getCheckPathName().Replace("'", "").Replace(",", "/"); if (string.IsNullOrEmpty(str)) { MessageBox.Show("请选择预下载兴趣点的类别!"); return(false); } DataTable table = RemotingClient.Car_GetPOIAuth(); if (((table != null) && (table.Rows.Count > 0)) && (table.Rows[0]["POIAuth"] != DBNull.Value)) { iPoiAutn = int.Parse(table.Rows[0]["POIAuth"].ToString()); } DataTable table2 = RemotingClient.Area_GetUserAreaInfo(); DataTable table3 = null; if ((table2 != null) && (table2.Rows.Count > 0)) { foreach (DataRow row in table2.Rows) { if (row["AreaCode"] != DBNull.Value) { table3 = RemotingClient.Car_GetInterestPointMulti(str, iPoiAutn); break; } } } else { table3 = RemotingClient.Car_GetInterestPointSingle(str, iPoiAutn); } if ((table3 == null) || (table3.Rows.Count <= 0)) { MessageBox.Show("没有兴趣点,请检查是否设置!"); return(false); } this.m_SimpleCmd.MapTypes = str; this.m_SimpleCmd.InsterestPoints = table3; } this.m_PathAlarmList.OrderCode = base.OrderCode; this.m_SimpleCmd.OrderCode = base.OrderCode; 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); }
private bool getParam() { this.dataFilter(""); string str = this.getCheckPathName(); if (string.IsNullOrEmpty(str)) { MessageBox.Show("没有选择预设路线!"); return(false); } if (this.dgvSubSpeedParam.Rows.Count <= 0) { MessageBox.Show("没有路线"); return(false); } DataTable table = RemotingClient.Car_GetPathRouteByPathName(str); if ((table == null) || (table.Rows.Count <= 0)) { MessageBox.Show("没有读取到偏移路线数据,请重新设置"); return(false); } foreach (DataGridViewRow row in (IEnumerable)this.dgvSubSpeedParam.Rows) { if (row.Cells["Choose"].Value.ToString() == "1") { string str2 = row.Cells["PathName"].Value.ToString(); PathAlarm alarm = new PathAlarm(); ArrayList list = new ArrayList(); alarm.Points = list; alarm.PathName = str2; DataView view = new DataView(table, "PathName='" + str2 + "'", "", DataViewRowState.CurrentRows); string str3 = string.Empty; if ((view != null) && (view.Count > 0)) { str3 = view[0]["alarmPathDot"].ToString(); } if (string.IsNullOrEmpty(str3)) { MessageBox.Show(ERRORPATHAlARM); return(false); } string[] strArray = str3.Split(new char[] { '/' }); alarm.PointCount = 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); } string pStrNum = row.Cells["TopSpeed"].Value.ToString(); string str5 = row.Cells["HoldTime"].Value.ToString(); if (!Check.isNumeric(pStrNum, Check.NumType.sByte)) { MessageBox.Show("路线\"" + str2 + "\"最高时速必须为0-255的数字!"); return(false); } alarm.Speed = byte.Parse(pStrNum); if (!Check.isNumeric(str5, Check.NumType.sByte) || ((int.Parse(str5) % 5) != 0)) { MessageBox.Show("路线\"" + str2 + "\"持续时长必须为0-255之间5的倍数!"); return(false); } alarm.Time = byte.Parse(str5); string strDate = row.Cells["BeginTime"].Value.ToString(); string str7 = row.Cells["EndTime"].Value.ToString(); string strResultDate = string.Empty; string str9 = string.Empty; if (strDate.Length == 0) { MessageBox.Show("路线\"" + str2 + "\"没有设置起始时间!"); return(false); } if (str7.Length == 0) { MessageBox.Show("路线\"" + str2 + "\"没有设置终止时间!"); return(false); } if (!Check.CheckIsDate(strDate, out strResultDate)) { MessageBox.Show("路线\"" + str2 + "\"起始时间格式有误!"); return(false); } if (!Check.CheckIsDate(str7, out str9)) { MessageBox.Show("路线\"" + str2 + "\"终止时间格式有误!"); return(false); } alarm.BeginTime = strDate; alarm.EndTime = str7; alarm.sBeginTime = strResultDate; alarm.sEndTime = str9; string str10 = alarm.BeginTime.Substring(0, 4); string str11 = alarm.EndTime.Substring(0, 4); if (((str10 == "0000") && (str11 != "0000")) || ((str11 == "0000") && (str10 != "0000"))) { MessageBox.Show("路线\"" + str2 + "\"设置起始时间和终止时间时,固定时段参数勾选状态需保持一致!"); return(false); } if ((str10 != "0000") && (DateTime.Parse(alarm.BeginTime) > DateTime.Parse(alarm.EndTime))) { MessageBox.Show("路线\"" + str2 + "\"起始时间不能大于终止时间!"); return(false); } this.m_pathAlarmList.Add(alarm); } } if ((this.m_pathAlarmList == null) || (this.m_pathAlarmList.Count < 0)) { return(false); } this.m_pathAlarmList.OrderCode = base.OrderCode; return(true); }
private bool getParam() { string str = ""; string str2 = this.getCheckPathName(); if (string.IsNullOrEmpty(str2)) { MessageBox.Show("没有选择预设路线!"); return false; } if (this.dgvSubSpeedParam.Rows.Count <= 0) { MessageBox.Show("没有路线"); return false; } DataTable table = RemotingClient.Car_GetPathRouteByPathName(str2); if ((table == null) || (table.Rows.Count <= 0)) { MessageBox.Show("没有读取到偏移路线数据,请重新设置"); return false; } if (this.IsIDRepeat()) { return false; } bool flag = false; DataView defaultView = (this.dgvSubSpeedParam.DataSource as DataTable).DefaultView; defaultView.RowFilter = "PathSegment='已设置'"; if (defaultView.Count > 0) { flag = true; } defaultView.RowFilter = ""; foreach (DataGridViewRow row in (IEnumerable) this.dgvSubSpeedParam.Rows) { if (row.Cells["Choose"].Value.ToString() == "1") { string str3 = row.Cells["PathName"].Value.ToString(); str = str + "路线名称:" + str3 + Environment.NewLine; int num = Convert.ToInt32(row.Cells["PathId"].Value.ToString()); PathAlarm alarm = new PathAlarm(); ArrayList list = new ArrayList(); alarm.Points = list; alarm.ParentID = num; alarm.ID = Convert.ToInt32(row.Cells["newPathID"].Value.ToString()); alarm.PathName = str3; DataView view2 = new DataView(table, "PathName='" + str3 + "'", "", DataViewRowState.CurrentRows); string str4 = string.Empty; if ((view2 != null) && (view2.Count > 0)) { str4 = view2[0]["alarmPathDot"].ToString(); } if (string.IsNullOrEmpty(str4)) { MessageBox.Show(ERRORPATHAlARM); return false; } string[] strArray = str4.Split(new char[] { '/' }); alarm.PointCount = 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); } row.Cells["TopSpeed"].Value.ToString(); row.Cells["HoldTime"].Value.ToString(); if (row.Cells["路线属性"].Value.ToString().Trim().Length == 0) { MessageBox.Show("路线\"" + str3 + "\"的路线属性没有设置!"); return false; } if (!row.Cells["路段属性"].Value.ToString().Equals("已设置")) { MessageBox.Show("路线\"" + str3 + "\"的路段属性没有设置!"); return false; } if (row.Cells["路线属性"].Value.ToString().IndexOf("根据时间") >= 0) { string strDate = row.Cells["BeginTime"].Value.ToString(); string str6 = row.Cells["EndTime"].Value.ToString(); string strResultDate = string.Empty; string str8 = string.Empty; if (strDate.Length == 0) { MessageBox.Show("路线\"" + str3 + "\"没有设置起始时间!"); return false; } if (str6.Length == 0) { MessageBox.Show("路线\"" + str3 + "\"没有设置终止时间!"); return false; } if (!Check.CheckIsDate(strDate, out strResultDate)) { MessageBox.Show("路线\"" + str3 + "\"起始时间格式有误!"); return false; } if (!Check.CheckIsDate(str6, out str8)) { MessageBox.Show("路线\"" + str3 + "\"终止时间格式有误!"); return false; } if (Convert.ToDateTime(strDate) > Convert.ToDateTime(str6)) { MessageBox.Show("路线\"" + str3 + "\"的起始时间不能大于终止时间!"); return false; } alarm.BeginTime = strDate; str = str + "起始时间:" + strDate + Environment.NewLine; alarm.EndTime = str6; str = str + "终止时间:" + str6 + Environment.NewLine; alarm.sBeginTime = strResultDate; alarm.sEndTime = str8; string str9 = alarm.BeginTime.Substring(0, 4); string str10 = alarm.EndTime.Substring(0, 4); if (((str9 == "0000") && (str10 != "0000")) || ((str10 == "0000") && (str9 != "0000"))) { MessageBox.Show("路线\"" + str3 + "\"设置起始时间和终止时间时,固定时段参数勾选状态需保持一致!"); return false; } if ((str9 != "0000") && (DateTime.Parse(alarm.BeginTime) > DateTime.Parse(alarm.EndTime))) { MessageBox.Show("路线\"" + str3 + "\"起始时间不能大于终止时间!"); return false; } } if (row.Cells["路段属性"].Value.ToString().Equals("已设置")) { DataRow[] rowArray = this._路段属性DT.Select("PathID = '" + num + "'", "PathSegmentID Asc"); if ((rowArray != null) && (rowArray.Length > 0)) { if ((row.Cells["路线属性"].Tag == null) && (row.Cells["路线属性"].Value.ToString().Trim().Length > 0)) { alarm.PathFlag = this.GeneralDomainTextToVal(row.Cells["路线属性"].Value.ToString()); } else if (row.Cells["路线属性"].Tag != null) { alarm.PathFlag = this.GeneralDomainTextToVal(row.Cells["路线属性"].Value.ToString()); } List<PathSegmentAlarm> list2 = new List<PathSegmentAlarm>(); str = str + "路线属性:" + alarm.PathFlag.ToString() + Environment.NewLine; int num3 = 1; for (int j = 0; j < rowArray.Length; j++) { int num5; int num6; int num7; int num8; DataRow row2 = rowArray[j]; PathSegmentAlarm item = new PathSegmentAlarm(); bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; flag2 = int.TryParse(row2["DriEnough"].ToString(), out num5); string str13 = str; str = str13 + "路段" + row2["PathSegmentID"].ToString() + "DriEnough属性:" + num5.ToString() + Environment.NewLine; flag3 = int.TryParse(row2["DriNoEnough"].ToString(), out num6); string str14 = str; str = str14 + "路段" + row2["PathSegmentID"].ToString() + "DriNoEnough属性::" + num6.ToString() + Environment.NewLine; flag4 = int.TryParse(row2["HoldTime"].ToString(), out num7); string str15 = str; str = str15 + "路段" + row2["PathSegmentID"].ToString() + "HoldTime属性::" + num7.ToString() + Environment.NewLine; flag5 = int.TryParse(row2["TopSpeed"].ToString(), out num8); string str16 = str; str = str16 + "路段" + row2["PathSegmentID"].ToString() + "TopSpeed属性::" + num8.ToString() + Environment.NewLine; if (flag2) { item.DriEnough = new int?(num5); } str = str + "路段Flag" + row2["SegmentflagValue"].ToString() + Environment.NewLine; if (flag3) { item.DriNoEnough = new int?(num6); } if (flag4) { item.HoldTime = new int?(num7); } item.PathId = num; item.PathSegmentID = num3; num3++; item.PathSegmentDataBaseID = Convert.ToInt32(row2["PathSegmentID"].ToString()); if (flag5) { item.TopSpeed = new int?(num8); } string[] strArray3 = row2["AlarmSegmentDot"].ToString().Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); if ((strArray3 == null) || (strArray3.Length == 0)) { MessageBox.Show("路线\"" + str3 + "\"的路段经纬度有误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return false; } ArrayList list3 = new ArrayList(); string str17 = str; str = str17 + "路段" + row2["PathSegmentID"].ToString() + "经纬度::" + row2["AlarmSegmentDot"].ToString() + Environment.NewLine; foreach (string str11 in strArray3) { string[] strArray4 = str11.Split("/".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (int k = 0; k < strArray4.Length; k++) { string[] strArray5 = strArray4[k].Split(new char[] { '*' }); ParamLibrary.CmdParamInfo.Point point2 = new ParamLibrary.CmdParamInfo.Point(); if (strArray5.Length == 2) { point2.Latitude = Convert.ToDouble(strArray5[1]); point2.Longitude = Convert.ToDouble(strArray5[0]); if ((k != (strArray4.Length - 1)) || (j == (rowArray.Length - 1))) { list3.Add(point2); } } } } try { item.PathWidth = Convert.ToInt32(row2["PathWidth"].ToString()); } catch { Record.execFileRecord("路线分路段报警设置", "路段宽度录入有误!"); } item.Points = list3; item.Flag = Convert.ToInt32(row2["SegmentflagValue"].ToString()); list2.Add(item); } alarm.PathSegmentAlarmList = list2; } } else if (flag) { MessageBox.Show("请设置路线\"" + str3 + "\"的路段属性!"); return false; } this.m_pathAlarmList.Add(alarm); } } if ((this.m_pathAlarmList == null) || (this.m_pathAlarmList.Count < 0)) { return false; } this.m_pathAlarmList.OrderCode = base.OrderCode; this.m_pathAlarmList.protocolType = CarProtocolType.交通厅; return true; }
private bool getParam() { int num = 0; string str = ""; int num2 = 0; string strDate = ""; string str3 = ""; string str4 = ""; this.m_RegionAlarmList = new RegionAlarmList(); if (!this.chkSeletRegion()) { this.dgvArea.Focus(); return false; } int num3 = 0; if (base.OrderCode == CmdParam.OrderCode.设置多功能区域报警) { this.m_RegionAlarmList.protocolType = CarProtocolType.交通厅; num3 = 1; } bool flag = true; for (int i = 0; i < this.dgvArea.Rows.Count; i++) { int num5 = this.getRegionType(i); if (this.dgvArea.Rows[i].Cells["区域属性"].Value.ToString().Trim().Length > 0) { flag = false; 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["MainRegion"].Value.ToString())) { alarm.newRegionId = 0; } else { alarm.newRegionId = num2; } alarm.PathName = str; alarm.RegionType = num5; alarm.RegionID = num2; str4 = this.dgvArea.Rows[i].Cells["RegionDot"].Value.ToString(); /// alarm.AlarmRegionDot = num5 + @"\" + str4.Replace("*", @"\").Trim(new char[] { '\\' }); string[] strArray = str4.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; strDate = this.dgvArea.Rows[i].Cells["beginTime"].Value.ToString(); /// str3 = this.dgvArea.Rows[i].Cells["endTime"].Value.ToString(); /// if (num3 == 1) { string strResultDate = ""; string str6 = ""; Check.CheckIsDate(strDate, out strResultDate); Check.CheckIsDate(str3, out str6); if ((this.dgvArea.Rows[i].Cells["区域属性"].Value.ToString().IndexOf("根据时间") >= 0) && ((strResultDate.Length == 0) || (str6.Length == 0))) { MessageBox.Show("区域\"" + str + "\"须设置起始时间和终止时间!"); return false; } if ((this.dgvArea.Rows[i].Cells["区域属性"].Value.ToString().IndexOf("根据时间") >= 0) && (Convert.ToDateTime(strDate) > Convert.ToDateTime(str3))) { MessageBox.Show("区域\"" + str + "\"设置的起始时间不能大于终止时间!"); return false; } alarm.AlarmCondition = this.getMultiAlarmCondition(i); if (strResultDate.Trim().Length > 0) { alarm.BeginTime = strResultDate; } if (str6.Trim().Length > 0) { alarm.EndTime = str6; } if (this.dgvArea.Rows[i].Cells["区域属性"].Value.ToString().Trim().Length > 0) { if (this.dgvArea.Rows[i].Cells["区域属性"].Value.ToString().Trim().Length == 0) { MessageBox.Show("区域\"" + str + "\"的区域属性不能为空!"); return false; } if ((this.dgvArea.Rows[i].Cells["区域属性"].Value.ToString().IndexOf("限速") >= 0) && (this.dgvArea.Rows[i].Cells["最高时速"].Value.ToString().Trim().Length == 0)) { MessageBox.Show("区域\"" + str + "\"的最高时速不能为空!"); return false; } if ((this.dgvArea.Rows[i].Cells["区域属性"].Value.ToString().IndexOf("限速") >= 0) && (this.dgvArea.Rows[i].Cells["超速持续时间"].Value.ToString().Trim().Length == 0)) { MessageBox.Show("区域\"" + str + "\"的超速持续时间不能为空!"); return false; } if (this.dgvArea.Rows[i].Cells["区域属性"].Tag != null) { alarm.AlarmFlag = this.GeneralValue(this.dgvArea.Rows[i].Cells["区域属性"].Tag as ArrayList); } else if ((this.dgvArea.Rows[i].Cells["区域属性"].Tag == null) && (this.dgvArea.Rows[i].Cells["区域属性"].Value.ToString().Trim().Length > 0)) { alarm.AlarmFlag = this.GeneralValue(this.GeneralDomainText(this.dgvArea.Rows[i].Cells["区域属性"].Value.ToString())); } int result = 0; int num8 = 0; if (this.dgvArea.Rows[i].Cells["区域属性"].Value.ToString().IndexOf("限速") >= 0) { if (int.TryParse(this.dgvArea.Rows[i].Cells["最高时速"].Value.ToString(), out result)) { if (result <= 0) { MessageBox.Show("区域\"" + str + "\"的最高时速须大于0!"); return false; } if (!Check.isNumeric(result.ToString(), Check.NumType.sByte)) { MessageBox.Show("区域\"" + str + "\"最高时速必须为1-255的数字!"); return false; } alarm.MaxSpeed = new int?(result); } else { MessageBox.Show("区域\"" + str + "\"的最高时速项只能输入整数!"); return false; } if (int.TryParse(this.dgvArea.Rows[i].Cells["超速持续时间"].Value.ToString(), out num8)) { if (num8 <= 0) { MessageBox.Show("区域\"" + str + "\"的超速持续时间须大于0!"); return false; } if (!Check.isNumeric(num8.ToString(), Check.NumType.sByte)) { MessageBox.Show("区域\"" + str + "\"持续时长必须为1-255之间的数字!"); return false; } alarm.HodeTime = new int?(num8); } else { MessageBox.Show("区域\"" + str + "\"的超速持续时间项只能输入整数!"); return false; } } } } alarm.newRegionId = Convert.ToInt32(this.dgvArea.Rows[i].Cells["newRegionID"].Value); this.m_RegionAlarmList.Add(alarm); } } int num9 = 7; switch (this.cbRegionType.SelectedIndex) { case 0: num9 = 7; break; case 1: num9 = 1; break; case 2: num9 = 2; break; case 3: num9 = 4; break; } this.m_RegionAlarmList.OperationType = new int?(num9 | 8); this.m_RegionAlarmList.RegionFeature = num3; this.m_RegionAlarmList.OrderCode = base.OrderCode; if (flag) { MessageBox.Show("没有选择区域。"); return false; } return true; }
private bool getParam() { int num = 0; string str = ""; int num2 = 0; string strDate = ""; string str3 = ""; string str4 = ""; if (!this.chkSeletRegion()) { this.dgvArea.Focus(); return false; } int num3 = 0; if (base.OrderCode == CmdParam.OrderCode.设置多功能区域报警) { num3 = 1; } this.m_RegionAlarmList = new RegionAlarmList(); for (int i = 0; i < this.dgvArea.Rows.Count; i++) { int num5 = this.getRegionType(i); if (num5 >= 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["MainRegion"].Value.ToString())) { alarm.newRegionId = 0; } else { alarm.newRegionId = num2; } alarm.PathName = str; alarm.RegionType = num5; alarm.RegionID = num2; str4 = this.dgvArea.Rows[i].Cells["RegionDot"].Value.ToString(); ///ToString alarm.AlarmRegionDot = num5 + @"\" + str4.Replace("*", @"\").Trim(new char[] { '\\' }); string[] strArray = str4.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; strDate = this.dgvArea.Rows[i].Cells["beginTime"].Value.ToString(); ///ToString str3 = this.dgvArea.Rows[i].Cells["endTime"].Value.ToString(); ///ToString if (num3 == 1) { string strResultDate = ""; string str6 = ""; Check.CheckIsDate(strDate, out strResultDate); Check.CheckIsDate(str3, out str6); alarm.AlarmCondition = this.getMultiAlarmCondition(i); alarm.BeginTime = strResultDate; alarm.EndTime = str6; } else { string sStr = this.dgvArea.Rows[i].Cells["distanceToBegin"].Value.ToString(); ///ToString string text1 = this.dgvArea.Rows[i].Cells["distanceToEnd"].Value.ToString(); ///ToString string str8 = this.dgvArea.Rows[i].Cells["planUpBeginTime"].Value.ToString(); ///ToString string str9 = this.dgvArea.Rows[i].Cells["planDownBeginTime"].Value.ToString(); ///ToString alarm.toEndTime = this.getToTime(sStr); alarm.toBackTime = this.getToTime(sStr); alarm.param = this.GetRegionParam(i); alarm.PlanUpTime = str8; alarm.PlanDownTime = str9; alarm.BeginTime = strDate; alarm.EndTime = str3; } this.m_RegionAlarmList.Add(alarm); } } this.m_RegionAlarmList.RegionFeature = num3; this.m_RegionAlarmList.OrderCode = base.OrderCode; return true; }
private bool getParam() { int num; int num1; int num2; int num3; bool flag; string str = ""; string checkPathName = this.getCheckPathName(); if (string.IsNullOrEmpty(checkPathName)) { MessageBox.Show("没有选择预设路线!"); return false; } if (this.dgvSubSpeedParam.Rows.Count <= 0) { MessageBox.Show("没有路线"); return false; } DataTable dataTable = RemotingClient.Car_GetPathRouteByPathName(checkPathName); if (dataTable == null || dataTable.Rows.Count <= 0) { MessageBox.Show("没有读取到偏移路线数据,请重新设置"); return false; } bool flag1 = false; DataView defaultView = (this.dgvSubSpeedParam.DataSource as DataTable).DefaultView; defaultView.RowFilter = "PathSegment='已设置'"; if (defaultView.Count > 0) { flag1 = true; } defaultView.RowFilter = ""; this.m_pathAlarmList.Clear(); IEnumerator enumerator = ((IEnumerable)this.dgvSubSpeedParam.Rows).GetEnumerator(); try { while (enumerator.MoveNext()) { DataGridViewRow current = (DataGridViewRow)enumerator.Current; if (current.Cells["Choose"].Value.ToString() != "1") { continue; } string str1 = current.Cells["PathName"].Value.ToString(); str = string.Concat(str, "路线名称:", str1, Environment.NewLine); int num4 = Convert.ToInt32(current.Cells["PathId"].Value.ToString()); PathAlarm pathAlarm = new PathAlarm(); ArrayList arrayLists = new ArrayList(); pathAlarm.Points = arrayLists; pathAlarm.ParentID = num4; pathAlarm.PathName = str1; DataView dataViews = new DataView(dataTable, string.Concat("PathName='", str1, "'"), "", DataViewRowState.CurrentRows); string empty = string.Empty; if (dataViews != null && dataViews.Count > 0) { empty = dataViews[0]["alarmPathDot"].ToString(); } if (!string.IsNullOrEmpty(empty)) { char[] chrArray = new char[] { '/' }; string[] strArrays = empty.Split(chrArray); pathAlarm.PointCount = (int)strArrays.Length; int num5 = 0; while (num5 < (int)strArrays.Length - 1) { if (!string.IsNullOrEmpty(strArrays[num5])) { string[] strArrays1 = strArrays[num5].Split(new char[] { '*' }); if ((int)strArrays1.Length == 2) { ParamLibrary.CmdParamInfo.Point point = new ParamLibrary.CmdParamInfo.Point() { Longitude = double.Parse(strArrays1[0]), Latitude = double.Parse(strArrays1[1]) }; arrayLists.Add(point); num5++; } else { MessageBox.Show(ERRORPATHAlARM); flag = false; return flag; } } else { MessageBox.Show(ERRORPATHAlARM); flag = false; return flag; } } current.Cells["TopSpeed"].Value.ToString(); current.Cells["HoldTime"].Value.ToString(); if (current.Cells["路线属性"].Value.ToString().Trim().Length == 0) { MessageBox.Show(string.Concat("路线\"", str1, "\"的路线属性没有设置!")); flag = false; return flag; } else if (current.Cells["路段属性"].Value.ToString().Equals("已设置")) { if (current.Cells["路线属性"].Value.ToString().IndexOf("根据时间") >= 0) { string str2 = current.Cells["BeginTime"].Value.ToString(); string str3 = current.Cells["EndTime"].Value.ToString(); string empty1 = string.Empty; string empty2 = string.Empty; if (str2.Length == 0) { MessageBox.Show(string.Concat("路线\"", str1, "\"没有设置起始时间!")); flag = false; return flag; } else if (str3.Length == 0) { MessageBox.Show(string.Concat("路线\"", str1, "\"没有设置终止时间!")); flag = false; return flag; } else if (!Check.CheckIsDate(str2, out empty1)) { MessageBox.Show(string.Concat("路线\"", str1, "\"起始时间格式有误!")); flag = false; return flag; } else if (!Check.CheckIsDate(str3, out empty2)) { MessageBox.Show(string.Concat("路线\"", str1, "\"终止时间格式有误!")); flag = false; return flag; } else if (Convert.ToDateTime(str2) <= Convert.ToDateTime(str3)) { pathAlarm.BeginTime = str2; str = string.Concat(str, "起始时间:", str2, Environment.NewLine); pathAlarm.EndTime = str3; str = string.Concat(str, "终止时间:", str3, Environment.NewLine); pathAlarm.sBeginTime = empty1; pathAlarm.sEndTime = empty2; string str4 = pathAlarm.BeginTime.Substring(0, 4); string str5 = pathAlarm.EndTime.Substring(0, 4); if (str4 == "0000" && str5 != "0000" || str5 == "0000" && str4 != "0000") { MessageBox.Show(string.Concat("路线\"", str1, "\"设置起始时间和终止时间时,固定时段参数勾选状态需保持一致!")); flag = false; return flag; } else if (str4 != "0000" && DateTime.Parse(pathAlarm.BeginTime) > DateTime.Parse(pathAlarm.EndTime)) { MessageBox.Show(string.Concat("路线\"", str1, "\"起始时间不能大于终止时间!")); flag = false; return flag; } } else { MessageBox.Show(string.Concat("路线\"", str1, "\"的起始时间不能大于终止时间!")); flag = false; return flag; } } if (current.Cells["路段属性"].Value.ToString().Equals("已设置")) { DataRow[] dataRowArray = this._路段属性DT.Select(string.Concat("PathID = '", num4, "'"), "PathSegmentID Asc"); if (dataRowArray != null && (int)dataRowArray.Length > 0) { if (current.Cells["路线属性"].Tag == null && current.Cells["路线属性"].Value.ToString().Trim().Length > 0) { pathAlarm.PathFlag = this.GeneralDomainTextToVal(current.Cells["路线属性"].Value.ToString()); } else if (current.Cells["路线属性"].Tag != null) { pathAlarm.PathFlag = this.GeneralDomainTextToVal(current.Cells["路线属性"].Value.ToString()); } List<PathSegmentAlarm> pathSegmentAlarms = new List<PathSegmentAlarm>(); int pathFlag = pathAlarm.PathFlag; str = string.Concat(str, "路线属性:", pathFlag.ToString(), Environment.NewLine); DataRow[] dataRowArray1 = dataRowArray; int num6 = 0; while (num6 < (int)dataRowArray1.Length) { DataRow dataRow = dataRowArray1[num6]; PathSegmentAlarm pathSegmentAlarm = new PathSegmentAlarm(); bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; flag2 = int.TryParse(dataRow["DriEnough"].ToString(), out num); string str6 = str; string[] strArrays2 = new string[] { str6, "路段", dataRow["PathSegmentID"].ToString(), "DriEnough属性:", num.ToString(), Environment.NewLine }; str = string.Concat(strArrays2); flag3 = int.TryParse(dataRow["DriNoEnough"].ToString(), out num1); string str7 = str; string[] strArrays3 = new string[] { str7, "路段", dataRow["PathSegmentID"].ToString(), "DriNoEnough属性::", num1.ToString(), Environment.NewLine }; str = string.Concat(strArrays3); flag4 = int.TryParse(dataRow["HoldTime"].ToString(), out num2); string str8 = str; string[] strArrays4 = new string[] { str8, "路段", dataRow["PathSegmentID"].ToString(), "HoldTime属性::", num2.ToString(), Environment.NewLine }; str = string.Concat(strArrays4); flag5 = int.TryParse(dataRow["TopSpeed"].ToString(), out num3); string str9 = str; string[] strArrays5 = new string[] { str9, "路段", dataRow["PathSegmentID"].ToString(), "TopSpeed属性::", num3.ToString(), Environment.NewLine }; str = string.Concat(strArrays5); if (flag2) { pathSegmentAlarm.DriEnough = new int?(num); } str = string.Concat(str, "路段Flag", dataRow["SegmentflagValue"].ToString(), Environment.NewLine); if (flag3) { pathSegmentAlarm.DriNoEnough = new int?(num1); } if (flag4) { pathSegmentAlarm.HoldTime = new int?(num2); } pathSegmentAlarm.PathId = num4; pathSegmentAlarm.PathSegmentID = Convert.ToInt32(dataRow["PathSegmentID"].ToString()); if (flag5) { pathSegmentAlarm.TopSpeed = new int?(num3); } string str10 = dataRow["AlarmSegmentDot"].ToString(); string[] strArrays6 = new string[] { ";" }; string[] strArrays7 = str10.Split(strArrays6, StringSplitOptions.RemoveEmptyEntries); if (strArrays7 == null || (int)strArrays7.Length == 0) { MessageBox.Show(string.Concat("路线\"", str1, "\"的路段经纬度有误!"), "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); flag = false; return flag; } else { ArrayList arrayLists1 = new ArrayList(); string str11 = str; string[] strArrays8 = new string[] { str11, "路段", dataRow["PathSegmentID"].ToString(), "经纬度::", dataRow["AlarmSegmentDot"].ToString(), Environment.NewLine }; str = string.Concat(strArrays8); string[] strArrays9 = strArrays7; for (int i = 0; i < (int)strArrays9.Length; i++) { string str12 = strArrays9[i]; chrArray = new char[] { '/' }; string[] strArrays10 = str12.Split(chrArray); for (int j = 0; j < (int)strArrays10.Length; j++) { string str13 = strArrays10[j]; chrArray = new char[] { '*' }; string[] strArrays11 = str13.Split(chrArray); ParamLibrary.CmdParamInfo.Point point1 = new ParamLibrary.CmdParamInfo.Point(); if ((int)strArrays11.Length == 2) { point1.Latitude = Convert.ToDouble(strArrays11[1]); point1.Longitude = Convert.ToDouble(strArrays11[0]); arrayLists1.Add(point1); } } } try { pathSegmentAlarm.PathWidth = Convert.ToInt32(dataRow["PathWidth"].ToString()); } catch { Record.execFileRecord("路线分路段报警设置", "路段宽度录入有误!"); } pathSegmentAlarm.Points = arrayLists1; pathSegmentAlarm.Flag = Convert.ToInt32(dataRow["SegmentflagValue"].ToString()); pathSegmentAlarms.Add(pathSegmentAlarm); num6++; } } pathAlarm.PathSegmentAlarmList = pathSegmentAlarms; } } else if (flag1) { MessageBox.Show(string.Concat("请设置路线\"", str1, "\"的路段属性!")); flag = false; return flag; } this.m_pathAlarmList.Add(pathAlarm); } else { MessageBox.Show(string.Concat("路线\"", str1, "\"的路段属性没有设置!")); flag = false; return flag; } } else { MessageBox.Show(ERRORPATHAlARM); flag = false; return flag; } } if (this.m_pathAlarmList == null || this.m_pathAlarmList.Count < 0) { return false; } this.m_pathAlarmList.OrderCode = base.OrderCode; this.m_pathAlarmList.protocolType = CarProtocolType.交通厅; return true; } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } return flag; }
private bool getParam() { if (base.OrderCode != CmdParam.OrderCode.下载兴趣点) { this.m_PathAlarmList = new PathAlarmList(); this.dataFilter(""); string str2 = this.getCheckPathName(); if (string.IsNullOrEmpty(str2)) { MessageBox.Show("没有选择预设路线!"); return false; } DataTable table4 = RemotingClient.Car_GetPathRouteByPathName(str2); if ((table4 == null) || (table4.Rows.Count <= 0)) { MessageBox.Show("没有读取到偏移路线数据,请重新设置"); return false; } foreach (DataRow row2 in table4.Rows) { PathAlarm alarm = new PathAlarm(); ArrayList list = new ArrayList(); string str3 = row2["PathName"] as string; string str4 = row2["alarmPathDot"] as string; if (string.IsNullOrEmpty(str4)) { MessageBox.Show(ERRORPATHAlARM); return false; } string[] strArray = str4.Split(new char[] { '/' }); alarm.PointCount = 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; alarm.PathName = str3; this.m_PathAlarmList.Add(alarm); } if ((this.m_PathAlarmList == null) || (this.m_PathAlarmList.Count < 0)) { return false; } } else { int iPoiAutn = 0; string str = this.getCheckPathName().Replace("'", "").Replace(",", "/"); if (string.IsNullOrEmpty(str)) { MessageBox.Show("请选择预下载兴趣点的类别!"); return false; } DataTable table = RemotingClient.Car_GetPOIAuth(); if (((table != null) && (table.Rows.Count > 0)) && (table.Rows[0]["POIAuth"] != DBNull.Value)) { iPoiAutn = int.Parse(table.Rows[0]["POIAuth"].ToString()); } DataTable table2 = RemotingClient.Area_GetUserAreaInfo(); DataTable table3 = null; if ((table2 != null) && (table2.Rows.Count > 0)) { foreach (DataRow row in table2.Rows) { if (row["AreaCode"] != DBNull.Value) { table3 = RemotingClient.Car_GetInterestPointMulti(str, iPoiAutn); break; } } } else { table3 = RemotingClient.Car_GetInterestPointSingle(str, iPoiAutn); } if ((table3 == null) || (table3.Rows.Count <= 0)) { MessageBox.Show("没有兴趣点,请检查是否设置!"); return false; } this.m_SimpleCmd.MapTypes = str; this.m_SimpleCmd.InsterestPoints = table3; } this.m_PathAlarmList.OrderCode = base.OrderCode; this.m_SimpleCmd.OrderCode = base.OrderCode; return true; }
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; }
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; }
private bool getParam() { this.dataFilter(""); string str = this.getCheckPathName(); if (string.IsNullOrEmpty(str)) { MessageBox.Show("没有选择预设路线!"); return false; } if (this.dgvSubSpeedParam.Rows.Count <= 0) { MessageBox.Show("没有路线"); return false; } DataTable table = RemotingClient.Car_GetPathRouteByPathName(str); if ((table == null) || (table.Rows.Count <= 0)) { MessageBox.Show("没有读取到偏移路线数据,请重新设置"); return false; } foreach (DataGridViewRow row in (IEnumerable) this.dgvSubSpeedParam.Rows) { if (row.Cells["Choose"].Value.ToString() == "1") { string str2 = row.Cells["PathName"].Value.ToString(); PathAlarm alarm = new PathAlarm(); ArrayList list = new ArrayList(); alarm.Points = list; alarm.PathName = str2; DataView view = new DataView(table, "PathName='" + str2 + "'", "", DataViewRowState.CurrentRows); string str3 = string.Empty; if ((view != null) && (view.Count > 0)) { str3 = view[0]["alarmPathDot"].ToString(); } if (string.IsNullOrEmpty(str3)) { MessageBox.Show(ERRORPATHAlARM); return false; } string[] strArray = str3.Split(new char[] { '/' }); alarm.PointCount = 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); } string pStrNum = row.Cells["TopSpeed"].Value.ToString(); string str5 = row.Cells["HoldTime"].Value.ToString(); if (!Check.isNumeric(pStrNum, Check.NumType.sByte)) { MessageBox.Show("路线\"" + str2 + "\"最高时速必须为0-255的数字!"); return false; } alarm.Speed = byte.Parse(pStrNum); if (!Check.isNumeric(str5, Check.NumType.sByte) || ((int.Parse(str5) % 5) != 0)) { MessageBox.Show("路线\"" + str2 + "\"持续时长必须为0-255之间5的倍数!"); return false; } alarm.Time = byte.Parse(str5); string strDate = row.Cells["BeginTime"].Value.ToString(); string str7 = row.Cells["EndTime"].Value.ToString(); string strResultDate = string.Empty; string str9 = string.Empty; if (strDate.Length == 0) { MessageBox.Show("路线\"" + str2 + "\"没有设置起始时间!"); return false; } if (str7.Length == 0) { MessageBox.Show("路线\"" + str2 + "\"没有设置终止时间!"); return false; } if (!Check.CheckIsDate(strDate, out strResultDate)) { MessageBox.Show("路线\"" + str2 + "\"起始时间格式有误!"); return false; } if (!Check.CheckIsDate(str7, out str9)) { MessageBox.Show("路线\"" + str2 + "\"终止时间格式有误!"); return false; } alarm.BeginTime = strDate; alarm.EndTime = str7; alarm.sBeginTime = strResultDate; alarm.sEndTime = str9; string str10 = alarm.BeginTime.Substring(0, 4); string str11 = alarm.EndTime.Substring(0, 4); if (((str10 == "0000") && (str11 != "0000")) || ((str11 == "0000") && (str10 != "0000"))) { MessageBox.Show("路线\"" + str2 + "\"设置起始时间和终止时间时,固定时段参数勾选状态需保持一致!"); return false; } if ((str10 != "0000") && (DateTime.Parse(alarm.BeginTime) > DateTime.Parse(alarm.EndTime))) { MessageBox.Show("路线\"" + str2 + "\"起始时间不能大于终止时间!"); return false; } this.m_pathAlarmList.Add(alarm); } } if ((this.m_pathAlarmList == null) || (this.m_pathAlarmList.Count < 0)) { return false; } this.m_pathAlarmList.OrderCode = base.OrderCode; return true; }