Пример #1
0
        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);
        }
Пример #2
0
 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);
 }
Пример #3
0
        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);
            }
        }
Пример #4
0
        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);
        }