public override string GetMembersXml(ref string content) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < this.PathSegmentAlarmList.Count; i++) { PathSegmentAlarm item = this.PathSegmentAlarmList[i]; content = string.Concat(content, this.PathName, ","); stringBuilder.Append("<Segment>"); stringBuilder.Append(string.Concat("<SegmentID>", item.PathSegmentID, "</SegmentID>")); stringBuilder.Append(string.Concat("<DriEnough>", item.DriEnough, "</DriEnough>")); stringBuilder.Append(string.Concat("<DriNoEnough>", item.DriNoEnough, "</DriNoEnough>")); stringBuilder.Append(string.Concat("<SegmentPointNums>", item.Points.Count, "</SegmentPointNums>")); stringBuilder.Append(string.Concat("<SegmentWidth>", item.PathWidth, "</SegmentWidth>")); for (int j = 0; j < item.Points.Count; j++) { Point point = (Point)item.Points[j]; stringBuilder.Append(point.ToString()); } PathAlarm count = this; count._PathSegmentPointCount = count._PathSegmentPointCount + item.Points.Count; stringBuilder.Append("<SegmentType>1</SegmentType>"); stringBuilder.Append(string.Concat("<AlarmSpeed>", item.TopSpeed, "</AlarmSpeed>")); stringBuilder.Append(string.Concat("<HoldTime>", item.HoldTime, "</HoldTime>")); stringBuilder.Append(string.Concat("<SegmentFlag>", item.Flag, "</SegmentFlag>")); stringBuilder.Append("</Segment>"); } return(stringBuilder.ToString()); }
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; 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; }