예제 #1
0
        private object GetRegions()
        {
            byte[] numArray = new byte[2048];
            int    length   = 0;

            this.AlarmRegionDot = string.Empty;
            foreach (RegionAlarm regionAlarm in this)
            {
                int             num             = regionAlarm.newRegionId;
                RegionAlarmList regionAlarmList = this;
                regionAlarmList.AlarmRegionDot = string.Concat(regionAlarmList.AlarmRegionDot, num);
                byte            regionType       = (byte)regionAlarm.RegionType;
                RegionAlarmList regionAlarmList1 = this;
                regionAlarmList1.AlarmRegionDot = string.Concat(regionAlarmList1.AlarmRegionDot, "\\", regionType);
                ArrayList points         = regionAlarm.Points;
                long      alarmCondition = regionAlarm.AlarmCondition;
                string    beginTime      = regionAlarm.BeginTime;
                string    endTime        = regionAlarm.EndTime;
                byte[]    numArray1      = this.SealData(num, regionType, points, alarmCondition, beginTime, endTime);
                length = length + (int)numArray1.Length;
                if (length > (int)numArray.Length)
                {
                    byte[] numArray2 = new byte[(int)numArray.Length];
                    numArray.CopyTo(numArray2, 0);
                    numArray = new byte[length * 2];
                    numArray2.CopyTo(numArray, 0);
                }
                numArray1.CopyTo(numArray, length - (int)numArray1.Length);
            }
            Array.Resize <byte>(ref numArray, length);
            return(numArray);
        }
예제 #2
0
파일: DownData.cs 프로젝트: lexzh/Myproject
        /// <summary>
        /// 设置区域报警
        /// </summary>
        /// <param name="ParamType"></param>
        /// <param name="CarValues"></param>
        /// <param name="CarPw"></param>
        /// <param name="CommMode"></param>
        /// <param name="regionAlarmList"></param>
        /// <returns></returns>
        public Response icar_SetRegionAlarm(CmdParam.ParamType ParamType, string CarValues, string CarPw, CmdParam.CommMode CommMode, RegionAlarmList regionAlarmList)
        {
            Response response = new Response();
            base.logMsg.FunctionName = "icar_SetRegionAlarm";
            base.logMsg.Msg = "发送:类型-" + ParamType.ToString() + ",车辆-" + CarValues;
            base.log.WriteLog(base.logMsg);
            if (!base.CheckCar(ParamType, CarValues, CarPw))
            {
                response.ErrorMsg = base.alarmMsg.AlarmText = base.ErrorMsg;
                base.log.WriteAlarm(base.alarmMsg);
                return response;
            }
            if (base.isStartCommon())
            {
                Car car = new Car();
                foreach (Bussiness.CarInfo info in base.carInfoList)
                {
                    try
                    {
                        RegionAlarm alarm;
                        int num = -1;
                        for (int i = 0; i < regionAlarmList.Count; i++)
                        {
                            alarm = (RegionAlarm) regionAlarmList[i];
                            ///////////////////////////////////////////
                            //进行反纠偏处理
                            string LatLngString = alarm.AlarmRegionDot;
                            string[] latlng = LatLngString.Trim(new char[]{'\\'}).Split('\\');
                            LatLngString = latlng[0].ToString() + "\\";
                            for (int j = 0; j < (latlng.Length-1) / 2; j++)
                            {
                                double lng = Convert.ToDouble(latlng[j * 2 + 1]);
                                double lat = Convert.ToDouble(latlng[j * 2 + 2]);
                                GoogleOffset.getMars(ref lng, ref lat);
                                LatLngString = LatLngString + lng.ToString() + "\\" + lat.ToString() + "\\";
                            }
                            if ((latlng.Length/2)*2 == latlng.Length)
                            {
                                LatLngString = LatLngString + latlng[latlng.Length - 1];
                            }
                            alarm.AlarmRegionDot = LatLngString.Trim(new char[]{'\\'});
                            ///////////////////////////////////////////
                            DataTable table = car.GetNewRegionId(info.CarId, alarm.PathName, num);
                            if ((table == null) || (table.Rows.Count == 0))
                            {
                                base.errMsg.ErrorText = string.Format("\"{0}\"获取报警区域ID失败!", info.CarNum);
                                response.ErrorMsg = base.errMsg.ErrorText;
                                base.log.WriteError(base.errMsg);
                                return response;
                            }
                            int num3 = int.Parse(table.Rows[0][0].ToString());
                            alarm.newRegionId = num3;
                            num = num3;
                        }
                        object pvRegions = null;
                        if (regionAlarmList.protocolType == CarProtocolType.非交通厅)
                        {
                            pvRegions = regionAlarmList.pvRegions;
                        }
                        int newOrderId = SendBase.CarCmdSend.GetNewOrderId();
                        base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";");
                        string orderIDParam = response.OrderIDParam;
                        response.OrderIDParam = orderIDParam + newOrderId.ToString() + "|" + info.CarId.ToString() + ";";
                        if ((info.ProtocolName != SendBase.m_ProtocolName) && (regionAlarmList.protocolType == CarProtocolType.交通厅))
                        {
                            base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", regionAlarmList.OrderCode.ToString(), "失败", "", "终端不支持该协议!");
                            response.ResultCode = 0L;
                            return response;
                        }
                        base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", regionAlarmList.OrderCode.ToString(), "等待", "", "");
                        car.InsertRegionIntoGisCar(info.CarId, base.WorkId, newOrderId, regionAlarmList.AlarmRegionDot, regionAlarmList.RegionFeature.ToString());
                        RegionAlarmList list = new RegionAlarmList();
                        RegionAlarmList list2 = new RegionAlarmList();
                        RegionAlarmList list3 = new RegionAlarmList();
                        for (int j = 0; j < regionAlarmList.Count; j++)
                        {
                            alarm = (RegionAlarm) regionAlarmList[j];
                            switch (alarm.GetSharpe())
                            {
                                case 1:
                                    list.Add(alarm);
                                    break;

                                case 2:
                                    list2.Add(alarm);
                                    break;

                                case 3:
                                    list3.Add(alarm);
                                    break;
                            }
                            car.UpdateRegionParam(base.WorkId, newOrderId, int.Parse(info.CarId), alarm.RegionID, alarm.param, alarm.toEndTime, alarm.toBackTime, alarm.RegionType & 15, alarm.BeginTime, alarm.EndTime, regionAlarmList.RegionFeature, alarm.AlarmCondition.ToString(), alarm.PlanUpTime, alarm.PlanDownTime, alarm.newRegionId, alarm.AlarmFlag, alarm.MaxSpeed, alarm.HodeTime);
                        }
                        if (regionAlarmList.RegionFeature == 1)
                        {
                            if ((info.ProtocolName == SendBase.m_ProtocolName) && (regionAlarmList.protocolType == CarProtocolType.交通厅))
                            {
                                if (list.Count > 0)
                                {
                                    string content = "";
                                    list.OrderCode = regionAlarmList.OrderCode;
                                    string str2 = list.ToXmlString(base.CalOrderId(base.WorkId, newOrderId), info.SimNum, SendBase.m_ProtocolName, (int) CommMode, "SetRegionAlarm", ref content);
                                    if (!string.IsNullOrEmpty(content))
                                    {
                                        response.ErrorMsg = content + "经纬度数据有问题";
                                        response.ResultCode = -1L;
                                        return response;
                                    }
                                    response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, (int) list.OrderCode, (int) CommMode, str2);
                                }
                                if (list2.Count > 0)
                                {
                                    string str3 = "";
                                    list2.OrderCode = regionAlarmList.OrderCode;
                                    string str4 = list2.ToXmlString(base.CalOrderId(base.WorkId, newOrderId), info.SimNum, SendBase.m_ProtocolName, (int) CommMode, "SetRegionAlarm", ref str3);
                                    if (!string.IsNullOrEmpty(str3))
                                    {
                                        response.ErrorMsg = str3 + "经纬度数据有问题";
                                        response.ResultCode = -1L;
                                        return response;
                                    }
                                    response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, (int) list2.OrderCode, (int) CommMode, str4);
                                }
                                if (list3.Count > 0)
                                {
                                    string str5 = "";
                                    list3.OrderCode = regionAlarmList.OrderCode;
                                    string str6 = list3.ToXmlString(base.CalOrderId(base.WorkId, newOrderId), info.SimNum, SendBase.m_ProtocolName, (int) CommMode, "SetRegionAlarm", ref str5);
                                    if (!string.IsNullOrEmpty(str5))
                                    {
                                        response.ErrorMsg = str5 + "经纬度数据有问题";
                                        response.ResultCode = -1L;
                                        return response;
                                    }
                                    response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, (int) list3.OrderCode, (int) CommMode, str6);
                                }
                            }
                            else
                            {
                                response.ResultCode = SendBase.CarCmdSend.icar_SimpleCmd(base.WorkId, newOrderId, info.SimNum, regionAlarmList.CmdCode, ref pvRegions);
                            }
                        }
                        else
                        {
                            response.ResultCode = SendBase.CarCmdSend.icar_SetMultiRegionAlarm(base.WorkId, newOrderId, info.SimNum, ref pvRegions);
                        }
                        if (response.ResultCode != 0L)
                        {
                            base.alarmMsg.FunctionName = "icar_SetRegionAlarm";
                            base.alarmMsg.AlarmText = string.Concat(new object[] { "workid-", base.WorkId, ",simNum-", info.SimNum, ",OrderCode-", regionAlarmList.OrderCode });
                            base.alarmMsg.Code = response.ResultCode.ToString();
                            base.log.WriteAlarm(base.alarmMsg);
                        }
                        response.ResultCode = 0L;
                        continue;
                    }
                    catch (Exception exception)
                    {
                        base.errMsg.ErrorText = "下发消息指令时发生错误!";
                        response.ErrorMsg = base.ErrorMsg = base.errMsg.ErrorText;
                        base.log.WriteError(base.errMsg, exception);
                    }
                }
                return response;
            }
            response.ErrorMsg = base.ErrorMsg;
            return response;
        }
예제 #3
0
        private byte[] SealData(int regionId, byte regionType, ArrayList pointsList, long alarmCondition, string beginTime, string endTime)
        {
            byte[] numArray;
            int    num = 0;

            numArray = (this.OrderCode != CmdParam.OrderCode.设置区域报警 ? new byte[4 + pointsList.Count * 20 + 4 + 12 + 12] : new byte[4 + pointsList.Count * 20]);
            int num1 = num;

            num            = num1 + 1;
            numArray[num1] = (byte)regionId;
            int num2 = num;

            num            = num2 + 1;
            numArray[num2] = regionType;
            int count = pointsList.Count;
            int num3  = num;

            num            = num3 + 1;
            numArray[num3] = (byte)(count >> 8);
            int num4 = num;

            num            = num4 + 1;
            numArray[num4] = (byte)(count & 255);
            for (int i = 0; i < pointsList.Count; i++)
            {
                Point           item            = (Point)pointsList[i];
                string          tenBitData      = this.GetTenBitData(item.Longitude.ToString());
                string          str             = this.GetTenBitData(item.Latitude.ToString());
                byte[]          bytes           = Encoding.GetEncoding("gb2312").GetBytes(tenBitData);
                byte[]          bytes1          = Encoding.GetEncoding("gb2312").GetBytes(str);
                RegionAlarmList regionAlarmList = this;
                string          alarmRegionDot  = regionAlarmList.AlarmRegionDot;
                string[]        strArrays       = new string[] { alarmRegionDot, "\\", tenBitData, "\\", str };
                regionAlarmList.AlarmRegionDot = string.Concat(strArrays);
                bytes.CopyTo(numArray, num);
                num = num + 10;
                bytes1.CopyTo(numArray, num);
                num = num + 10;
            }
            RegionAlarmList regionAlarmList1 = this;

            regionAlarmList1.AlarmRegionDot = string.Concat(regionAlarmList1.AlarmRegionDot, "*");
            if (this.OrderCode == CmdParam.OrderCode.设置多功能区域报警)
            {
                int num5 = num;
                num            = num5 + 1;
                numArray[num5] = (byte)(alarmCondition >> 24);
                int num6 = num;
                num            = num6 + 1;
                numArray[num6] = (byte)(alarmCondition >> 16);
                int num7 = num;
                num            = num7 + 1;
                numArray[num7] = (byte)(alarmCondition >> 8);
                int num8 = num;
                num            = num8 + 1;
                numArray[num8] = (byte)alarmCondition;
                byte[] numArray1 = Encoding.GetEncoding("gb2312").GetBytes(beginTime.PadRight(12, '0'));
                byte[] bytes2    = Encoding.GetEncoding("gb2312").GetBytes(endTime.PadRight(12, '0'));
                numArray1.CopyTo(numArray, num);
                num = num + 12;
                bytes2.CopyTo(numArray, num);
                num = num + 12;
            }
            return(numArray);
        }
예제 #4
0
 public static Response DownData_SetRegionAlarm_FJYD(CmdParam.ParamType ParamType, string CarValues, string CarPw, CmdParam.CommMode CommMode, RegionAlarmList regionAlarmList)
 {
     Response response;
     if (RemotingClient.app == null)
     {
         return RemotingClient.reResult;
     }
     try
     {
         response = RemotingClient.app.DownData_SetRegionAlarm_FJYD(ParamType, CarValues, CarPw, CommMode, regionAlarmList);
     }
     catch (SocketException socketException)
     {
         Record.execFileRecord("设置区域报警(福建移动)", socketException.Message);
         response = RemotingClient.reResult;
     }
     catch (RemotingException remotingException)
     {
         Record.execFileRecord("设置区域报警(福建移动)", remotingException.Message);
         response = RemotingClient.reResult;
     }
     catch (Exception exception)
     {
         Record.execFileRecord("设置区域报警(福建移动)", exception.ToString());
         response = RemotingClient.reResult;
     }
     return response;
 }
예제 #5
0
        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;
        }
예제 #6
0
 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;
     }
 }
예제 #7
0
 private object method_8(string string_1, RegionAlarmList regionAlarmList_0, Car car_0)
 {
     int index = 1;
     string[] strArray = null;
     RegionAlarm alarm = null;
     DataTable table = null;
     string str = "0";
     int key = -1;
     object[] objArray = new object[(regionAlarmList_0.Count * 4) + 1];
     objArray[0] = regionAlarmList_0.Count.ToString();
     Hashtable hashtable = new Hashtable(0x40);
     for (int i = 0; i < regionAlarmList_0.Count; i++)
     {
         alarm = (RegionAlarm) regionAlarmList_0[i];
         try
         {
             int num4 = 0;
             goto Label_00A7;
         Label_0065:
             num4++;
             if ((num4 < 5) && hashtable.ContainsKey(key))
             {
                 goto Label_00A7;
             }
             goto Label_00C4;
         Label_0082:
             str = table.Rows[0][0].ToString();
             key = Convert.ToInt32(str);
             goto Label_0065;
         Label_00A7:
             table = car_0.GetNewRegionId(string_1, alarm.PathName, key);
             if (base.IsNullDataTable(table))
             {
                 goto Label_0065;
             }
             goto Label_0082;
         Label_00C4:
             hashtable.Add(key, key);
         }
         catch
         {
         }
         alarm.newRegionId = (alarm.newRegionId == 0) ? 0 : int.Parse(str);
         strArray = alarm.AlarmRegionDot.Split(new char[] { '\\' });
         if (strArray.Length == 4)
         {
             objArray[index + 1] = "1";
             objArray[index + 2] = strArray[1] + "," + strArray[2] + "," + strArray[3];
             objArray[index + 3] = strArray[0];
         }
         else if (strArray.Length == 5)
         {
             objArray[index + 1] = "2";
             objArray[index + 2] = strArray[1] + "," + strArray[2] + "," + strArray[3] + "," + strArray[4];
             objArray[index + 3] = strArray[0];
         }
         else if (strArray.Length > 5)
         {
             string str2 = string.Empty;
             for (int j = 1; j <= (strArray.Length - 2); j += 2)
             {
                 string str3 = str2;
                 str2 = str3 + strArray[j] + "," + strArray[j + 1] + ",";
             }
             objArray[index + 1] = "3";
             objArray[index + 2] = str2.Substring(0, str2.Length - 1);
             objArray[index + 3] = strArray[0];
         }
         if (alarm.newRegionId == 0)
         {
             objArray[index] = "0";
         }
         else
         {
             objArray[index] = str;
         }
         index += 4;
         object alarmRegionDot = regionAlarmList_0.AlarmRegionDot;
         regionAlarmList_0.AlarmRegionDot = string.Concat(new object[] { alarmRegionDot, alarm.newRegionId, @"\", alarm.AlarmRegionDot, "*" });
     }
     return objArray;
 }
예제 #8
0
 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;
 }
예제 #9
0
 public Response icar_SetRegionAlarm(CmdParam.ParamType paramType_0, string string_1, string string_2, CmdParam.CommMode commMode_0, RegionAlarmList regionAlarmList_0)
 {
     Response response = new Response();
     base.WriteLog(paramType_0.ToString(), string_1);
     if (!base.CheckCar(paramType_0, string_1, string_2))
     {
         response.ErrorMsg = base.ErrorMsg;
         return response;
     }
     if (!base.isStartCommon())
     {
         response.ErrorMsg = base.ErrorMsg;
         return response;
     }
     Car car = new Car();
     object obj2 = null;
     RegionAlarm alarm = null;
     int newOrderId = -1;
     try
     {
         foreach (Bussiness.CarInfo info in base.carInfoList)
         {
             newOrderId = SendBase.CarCmdSend.GetNewOrderId();
             obj2 = this.method_8(info.CarId, regionAlarmList_0, car);
             base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";");
             string orderIDParam = response.OrderIDParam;
             response.OrderIDParam = orderIDParam + newOrderId.ToString() + "|" + info.CarId.ToString() + ";";
             base.AddUpDataLog(newOrderId, info.CarNum, CmdParam.CmdCode.区域报警设置.ToString(), "");
             car.InsertRegionIntoGisCar(info.CarId, base.WorkId, newOrderId, regionAlarmList_0.AlarmRegionDot, regionAlarmList_0.RegionFeature.ToString());
             for (int i = 0; i < regionAlarmList_0.Count; i++)
             {
                 alarm = (RegionAlarm) regionAlarmList_0[i];
                 car.UpdateRegionParam(base.WorkId, newOrderId, int.Parse(info.CarId), alarm.RegionID, alarm.param, alarm.toEndTime, alarm.toBackTime, alarm.RegionType & 15, alarm.BeginTime, alarm.EndTime, regionAlarmList_0.RegionFeature, alarm.AlarmCondition.ToString(), alarm.PlanUpTime, alarm.PlanDownTime, alarm.newRegionId, alarm.AlarmFlag, alarm.MaxSpeed, alarm.HodeTime);
             }
             response.ResultCode = SendBase.CarCmdSend.icar_SetCommonCmd(base.WorkId, newOrderId, info.SimNum, CmdParam.CmdCode.区域报警设置, ref obj2, commMode_0);
             if (response.ResultCode != 0L)
             {
                 base.WriteError(base.WorkId.ToString(), info.SimNum, regionAlarmList_0.OrderCode.ToString());
             }
         }
         response.ResultCode = 0L;
     }
     catch (Exception exception)
     {
         response.ErrorMsg = "下发消息指令时发生错误,错误详细信息:" + exception.Message;
         base.log.WriteError(base.errMsg, exception);
     }
     return response;
 }
예제 #10
0
 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;
 }
예제 #11
0
 private bool getParam()
 {
     if (((this.lbStartPoint.SelectedItem == null) || (this.lbEndPoint.SelectedItem == null)) || (this.lbSelectCar.Items.Count == 0))
     {
         MessageBox.Show("请选择起点站、终点站、车辆!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         return false;
     }
     if (((DataRowView) this.lbStartPoint.SelectedItem).Row[0].ToString().Trim().Equals(((DataRowView) this.lbEndPoint.SelectedItem).Row[0].ToString().Trim()))
     {
         MessageBox.Show("起点站和终点站不能一样!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         return false;
     }
     int num = 0;
     this.m_RegionAlarmList = new RegionAlarmList();
     if (!this.getRegionAlarmList(true, ref this.m_RegionAlarmList))
     {
         return false;
     }
     if (!this.getRegionAlarmList(false, ref this.m_RegionAlarmList))
     {
         return false;
     }
     for (int i = 0; i < this.lbSelectCar.Items.Count; i++)
     {
         this.sValue.Add((this.lbSelectCar.Items[i] as DataRowView)["SimNum"].ToString());
     }
     if (this.sValue.Count == 0)
     {
         MessageBox.Show("请选择车辆!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         return false;
     }
     this.m_RegionAlarmList.RegionFeature = num;
     this.m_RegionAlarmList.OrderCode = this.OrderCode;
     return true;
 }
예제 #12
0
 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;
 }
예제 #13
0
 public Response DownData_SetRegionAlarm_FJYD(CmdParam.ParamType ParamType, string CarValues, string CarPw, CmdParam.CommMode CommMode, RegionAlarmList regionAlarmList)
 {
     try
     {
         return this.myDownDataYD.icar_SetRegionAlarm(ParamType, CarValues, CarPw, CommMode, regionAlarmList);
     }
     catch (Exception exception)
     {
         this.m_LogHelper.WriteError(new ErrorMsg("RemotingServer", "DownData_SetRegionAlarm_FJYD", exception.ToString()));
         return new Response();
     }
 }