Example #1
0
        private string GetAlarmSetting(Guid code, out VMultipleSettingAlert multiplePara)
        {
            multiplePara = ModelFacade.AlarmSetting.AlarmSettingModel.GetSingleVehicleMutiSetting(code);

            string strFormat = "{{Enable:{0},EnableSMS:{1}}}";
            string robAlarm = "null";
            if (multiplePara.RobAlertSetting != null && multiplePara.RobAlertSetting.viewModel != null)
            {
                robAlarm = string.Format(strFormat,
                              multiplePara.RobAlertSetting.viewModel.Enable.ToString().ToLower(),
                              multiplePara.RobAlertSetting.viewModel.EnableSMS.ToString().ToLower()
                              );
            }

            string powerDownAlarm = "null";
            if (multiplePara.PowerDownAlertSetting != null && multiplePara.PowerDownAlertSetting.viewModel != null)
            {
                powerDownAlarm = string.Format(strFormat,
                              multiplePara.PowerDownAlertSetting.viewModel.Enable.ToString().ToLower(),
                              multiplePara.PowerDownAlertSetting.viewModel.EnableSMS.ToString().ToLower()
                              );
            }

            string fatigueAlarm = "null";
            if (multiplePara.FatigueDrivingAlertSetting != null && multiplePara.FatigueDrivingAlertSetting.viewModel != null)
            {
                fatigueAlarm = string.Format(strFormat,
                              multiplePara.FatigueDrivingAlertSetting.viewModel.Enable.ToString().ToLower(),
                              multiplePara.FatigueDrivingAlertSetting.viewModel.EnableSMS.ToString().ToLower()
                              );
            }

            string overSpeedAlarm = "null";
            if (multiplePara.OverSpeedAlertSetting != null && multiplePara.OverSpeedAlertSetting.viewModel != null)
            {
                overSpeedAlarm = string.Format(strFormat,
                              multiplePara.OverSpeedAlertSetting.viewModel.Enable.ToString().ToLower(),
                              multiplePara.OverSpeedAlertSetting.viewModel.EnableSMS.ToString().ToLower()
                              );
            }

            string offlineTimeoutAlarm = "null";
            if (multiplePara.OfflineTimeoutAlertSetting != null && multiplePara.OfflineTimeoutAlertSetting.viewModel != null)
            {
                offlineTimeoutAlarm = string.Format(strFormat,
                              multiplePara.OfflineTimeoutAlertSetting.viewModel.Enable.ToString().ToLower(),
                              multiplePara.OfflineTimeoutAlertSetting.viewModel.EnableSMS.ToString().ToLower()
                              );
            }

            string stopCarAlarm = "null";
            if (multiplePara.StopCarAlertSetting != null && multiplePara.StopCarAlertSetting.viewModel != null)
            {
                stopCarAlarm = string.Format(strFormat,
                              multiplePara.StopCarAlertSetting.viewModel.Enable.ToString().ToLower(),
                              multiplePara.StopCarAlertSetting.viewModel.EnableSMS.ToString().ToLower()
                              );
            }

            string stopCarAccOnAlarm = "null";
            if (multiplePara.StopCarAccOnAlertSetting != null && multiplePara.StopCarAccOnAlertSetting.viewModel != null)
            {
                stopCarAccOnAlarm = string.Format(strFormat,
                              multiplePara.StopCarAccOnAlertSetting.viewModel.Enable.ToString().ToLower(),
                              multiplePara.StopCarAccOnAlertSetting.viewModel.EnableSMS.ToString().ToLower()
                              );
            }

            string areaAlarm = "null";
            if (multiplePara.AreaAlertSetting != null && multiplePara.AreaAlertSetting.ViewModels != null && multiplePara.AreaAlertSetting.ViewModels.Count > 0)
            {
                areaAlarm = string.Format(strFormat,
                              multiplePara.AreaAlertSetting.ViewModels[0].Enable.ToString().ToLower(),
                              multiplePara.AreaAlertSetting.ViewModels[0].EnableSMS.ToString().ToLower()
                              );
            }

            string traceAlarm = "null";
            if (multiplePara.TraceAlertSetting != null && multiplePara.TraceAlertSetting.ViewModels != null && multiplePara.TraceAlertSetting.ViewModels.Count > 0)
            {
                traceAlarm = string.Format(strFormat,
                              multiplePara.TraceAlertSetting.ViewModels[0].Enable.ToString().ToLower(),
                              multiplePara.TraceAlertSetting.ViewModels[0].EnableSMS.ToString().ToLower()
                              );
            }

            string timingAlarm = "null";
            if (multiplePara.TimingAlertSetting != null && multiplePara.TimingAlertSetting.ViewModels != null && multiplePara.TimingAlertSetting.ViewModels.Count > 0)
            {
                timingAlarm = string.Format(strFormat,
                              multiplePara.TimingAlertSetting.ViewModels[0].Enable.ToString().ToLower(),
                              multiplePara.TimingAlertSetting.ViewModels[0].EnableSMS.ToString().ToLower()
                              );
            }

            string fortifyAlarm = "null";
            if (multiplePara.FortifyAlertSetting != null && multiplePara.FortifyAlertSetting.viewModel != null)
            {
                fortifyAlarm = string.Format(strFormat,
                              multiplePara.FortifyAlertSetting.viewModel.Enable.ToString().ToLower(),
                              multiplePara.FortifyAlertSetting.viewModel.EnableSMS.ToString().ToLower()
                              );
            }

            string result = string.Format(@"{{code:'{0}',
            robAlarm:{1},powerDownAlarm:{2},fatigueAlarm:{3},overSpeedAlarm:{4},offlineTimeoutAlarm:{5},
            stopCarAlarm:{6},stopCarAccOnAlarm:{7},
            areaAlarm:{8},traceAlarm:{9},timingAlarm:{10},fortifyAlarm:{11} }}",
             code.ToString(),
             robAlarm,
             powerDownAlarm,
             fatigueAlarm,
             overSpeedAlarm,
             offlineTimeoutAlarm,
             stopCarAlarm,
             stopCarAccOnAlarm,
             areaAlarm,
             traceAlarm,
             timingAlarm,
             fortifyAlarm
             );
            return result;
        }
Example #2
0
        /// <summary>
        /// 获取单车多设置
        /// </summary>
        /// < name="vehicleCode"></>
        /// <returns></returns>
        public VMultipleSettingAlert GetSingleVehicleMutiSetting(Guid vehicleCode)
        {
            IList<Guid> vehicleCodeList = new List<Guid>();
            vehicleCodeList.Add(vehicleCode);
            VMultipleSettingAlert para = new VMultipleSettingAlert();
            para.VehicleCode = vehicleCode;

            //劫车
            IList<ERobAlertSetting> robAlertList = DACFacade.Gps.RobAlertSettingDAC.SelectListByVehicleCodes(vehicleCodeList.ToList());
            para.RobAlertSetting = new VRobAlertSetting();
            para.RobAlertSetting.vehicleCodes = vehicleCodeList.ToList();
            para.RobAlertSetting.viewModel = new ERobAlertSetting();
            if (robAlertList != null && robAlertList.Count > 0)
            {
                para.RobAlertSetting.viewModel = robAlertList[0];
            }

            //断电
            IList<EPowerDownAlertSetting> powerDownAlertList = DACFacade.Gps.PowerDownAlertSettingDAC.SelectListByVehicleCodes(vehicleCodeList.ToList());
            para.PowerDownAlertSetting = new VPowerDownAlertSetting();
            para.PowerDownAlertSetting.vehicleCodes = vehicleCodeList.ToList();
            para.PowerDownAlertSetting.viewModel = new EPowerDownAlertSetting();
            if (powerDownAlertList != null && powerDownAlertList.Count > 0)
            {
                para.PowerDownAlertSetting.viewModel = powerDownAlertList[0];
            }

            //超速
            IList<EOverSpeedAlertSetting> overSpeedAlertList = DACFacade.Gps.OverSpeedAlertSettingDAC.SelectListByVehicleCodes(vehicleCodeList.ToList());
            para.OverSpeedAlertSetting = new VOverSpeedAlertSetting();
            para.OverSpeedAlertSetting.vehicleCodes = vehicleCodeList.ToList();
            para.OverSpeedAlertSetting.viewModel = new EOverSpeedAlertSetting();
            if (overSpeedAlertList != null && overSpeedAlertList.Count > 0)
            {
                para.OverSpeedAlertSetting = new VOverSpeedAlertSetting();
                para.OverSpeedAlertSetting.viewModel = overSpeedAlertList[0];
            }

            //离线超时报警
            IList<EOfflineTimeoutAlertSetting> offAlertList = DACFacade.Gps.OfflineTimeoutAlertSettingDAC.SelectListByVehicleCodes(vehicleCodeList.ToList());
            para.OfflineTimeoutAlertSetting = new VOfflineTimeoutAlertSetting();
            para.OfflineTimeoutAlertSetting.vehicleCodes = vehicleCodeList.ToList();
            para.OfflineTimeoutAlertSetting.viewModel = new EOfflineTimeoutAlertSetting();
            if (offAlertList != null && offAlertList.Count > 0)
            {
                para.OfflineTimeoutAlertSetting.viewModel = offAlertList[0];
            }

            //停车
            IList<EStopCarAlertSetting> stopCarbAlertList = DACFacade.Gps.StopCarAlertSettingDAC.SelectListByVehicleCodes(vehicleCodeList.ToList());
            para.StopCarAlertSetting = new VStopCarAlertSetting();
            para.StopCarAlertSetting.vehicleCodes = vehicleCodeList.ToList();
            para.StopCarAlertSetting.viewModel = new EStopCarAlertSetting();
            if (stopCarbAlertList != null && stopCarbAlertList.Count > 0)
            {
                para.StopCarAlertSetting.viewModel = stopCarbAlertList[0];
            }

            //停车未熄火
            IList<EStopCarAccOnAlertSetting> stopCarAccOnAlertList = DACFacade.Gps.StopCarAccOnAlertSettingDAC.SelectListByVehicleCodes(vehicleCodeList.ToList());
            para.StopCarAccOnAlertSetting = new VStopCarAccOnAlertSetting();
            para.StopCarAccOnAlertSetting.vehicleCodes = vehicleCodeList.ToList();
            para.StopCarAccOnAlertSetting.viewModel = new EStopCarAccOnAlertSetting();
            if (stopCarAccOnAlertList != null && stopCarAccOnAlertList.Count > 0)
            {
                para.StopCarAccOnAlertSetting.viewModel = stopCarAccOnAlertList[0];
            }

            //定点提醒
            IList<ETraceAlertSetting> traceAlertList = DACFacade.Gps.TraceAlertSettingDAC.SelectListByVehicleCodes(vehicleCodeList.ToList());
            para.TraceAlertSetting = new VTraceAlertSetting();
            para.TraceAlertSetting.VehicleCodes = vehicleCodeList.ToList();
            para.TraceAlertSetting.ViewModels = new List<ETraceAlertSetting>() { new ETraceAlertSetting() };
            if (traceAlertList != null && traceAlertList.Count > 0)
            {
                para.TraceAlertSetting.ViewModels = traceAlertList.ToList();
            }

            //定时提醒
            IList<ETimingAlertSetting> timingAlertList = DACFacade.Gps.TimingAlertSettingDAC.SelectListByVehicleCodes(vehicleCodeList.ToList());
            para.TimingAlertSetting = new VTimingAlertSetting();
            para.TimingAlertSetting.VehicleCodes = vehicleCodeList.ToList();
            para.TimingAlertSetting.ViewModels = new List<ETimingAlertSetting>() { new ETimingAlertSetting() };
            if (timingAlertList != null && timingAlertList.Count > 0)
            {
                para.TimingAlertSetting.ViewModels = timingAlertList.ToList();
            }

            //区域出入提醒设置
            IList<EAreaAlertSetting> areaAlertList = DACFacade.Gps.AreaAlertSettingDAC.SelectListByVehicleCodes(vehicleCodeList.ToList());
            para.AreaAlertSetting = new VAreaAlertSetting();
            para.AreaAlertSetting.VehicleCodes = vehicleCodeList.ToList();
            para.AreaAlertSetting.ViewModels = new List<EAreaAlertSetting>() { new EAreaAlertSetting() };
            if (areaAlertList != null && areaAlertList.Count > 0)
            {
                para.AreaAlertSetting.ViewModels = areaAlertList.ToList();
            }

            //疲劳驾驶提醒
            IList<EFatigueDrivingAlertSetting> fatAlertList = DACFacade.Gps.FatigueDrivingAlertSettingDAC.SelectListByVehicleCodes(vehicleCodeList.ToList());
            para.FatigueDrivingAlertSetting = new VFatigueDrivingAlertSetting();
            para.FatigueDrivingAlertSetting.vehicleCodes = vehicleCodeList.ToList();
            para.FatigueDrivingAlertSetting.viewModel = new EFatigueDrivingAlertSetting();
            if (fatAlertList != null && fatAlertList.Count > 0)
            {
                para.FatigueDrivingAlertSetting.viewModel = fatAlertList[0];
            }

            //设防提醒
            IList<EFortifyAlertsetting> fortifyAlertList = DACFacade.Gps.FortifyAlertSettingDAC.SelectListByVehicleCodes(vehicleCodeList.ToList());
            para.FortifyAlertSetting = new VFortifyAlertSetting();
            para.FortifyAlertSetting.vehicleCodes = vehicleCodeList.ToList();
            para.FortifyAlertSetting.viewModel = new EFortifyAlertsetting();
            if (fortifyAlertList != null && fortifyAlertList.Count > 0)
            {
                para.FortifyAlertSetting.viewModel = fortifyAlertList[0];
            }

            return para;
        }