Example #1
0
 protected virtual void SendSMS(AlarmHandleContext context, EBaseAlertReport report)
 {
     this.SendSMS(report.GetReceiveMobiles(), report.DownSendOrderCode, report.GetSMSParamters(),
         report.TenantCode, ConsumeType.SMSAlert, report.GetReceiveUsers());
 }
Example #2
0
        /// <summary>
        /// 是否在用户的接收时间内(手机短信)
        /// </summary>
        /// <param name="_alertReport"></param>
        /// <returns></returns>
        protected virtual bool IsInMobileReceiveTime(EBaseAlertReport _alertReport)
        {
            TimeSpan? beginTime = _alertReport.UserReceiveBeginTime;
            TimeSpan? endTime = _alertReport.UserReceiveEndTime;
            if (!beginTime.HasValue || (!endTime.HasValue))
            {
                return true;
            }

            DateTime aNowHour = DateTime.Now;
            DateTime aBeginHour = DateTime.Parse(beginTime.ToString());
            DateTime aEndHour = DateTime.Parse(endTime.ToString());

            if (aBeginHour == aEndHour)
            {
                return true;
            }
            if (aBeginHour <= aNowHour && aNowHour < aEndHour)
            {
                return true;
            }
            if (aEndHour < aBeginHour && aEndHour.Hour < 9)
            {
                if (aBeginHour <= aNowHour && aNowHour < aEndHour.AddDays(1))
                {
                    return true;
                }
            }

            return false;
        }
Example #3
0
        protected EAlarmInfo CreateAlarmEntity(AlarmHandleContext context, EBaseAlertReport report, EWebSMSInfo webSMS)
        {
            EAlarmInfo eAlarmInfo = new EAlarmInfo();
            eAlarmInfo.ACCState = report.ACCState;
            eAlarmInfo.AlarmGrade = (int)report.EnumAlarmGrade;
          
            eAlarmInfo.GPSTime = report.GPSReportTime;
            eAlarmInfo.IsLock = false;
            eAlarmInfo.ProcessState = (int)EnumProcessState.UnProcess;
            eAlarmInfo.Position = this.GetPlaceName(context, report.Latitude, report.Longitude);
            eAlarmInfo.SMSInfoType = (int)report.EnumSMSInfoType;
            eAlarmInfo.Speed = report.Speed;
            eAlarmInfo.StarkMileage = report.VStarkMileage;
            eAlarmInfo.VehicleCode = report.VehicleCode;
            eAlarmInfo.WebSMSInfoID = webSMS.RecordID;

            return eAlarmInfo;
        }
Example #4
0
        protected string GetMessage(EBaseAlertReport alert)
        {
            string title;
            string content;
            if (alert.EnumAlertState == EnumAlertState.Alerting)
            {
                title = alert.GetAlertTitle();
                content = alert.GetAlertMessage();
            }
            else
            {
                title = alert.GetResumeAlertTitle();
                content = alert.GetResumeAlertMessage();
            }

            return string.Format("[{0}],{1},{2}", title, content, alert.ReceiveUserList);
        }
Example #5
0
        protected virtual void SendWebSiteSMS(AlarmHandleContext context, EBaseAlertReport report)
        {
            try
            {
                var arrUser = report.GetReceiveUsers();
                if (arrUser == null || arrUser.Length == 0)
                    return;

                string title = report.GetAlertTitle();
                string content = report.GetAlertMessage();
                if (report.EnumAlertState == EnumAlertState.Resume)
                {
                    title = report.GetResumeAlertTitle();
                    content = report.GetResumeAlertMessage();
                }

                DateTime dt1 = DateTime.Now;
                EWebSMSInfo webSMS = GPSServiceFacade.Alarm.WebSMS.Add(arrUser, title, content, report.VehicleCode, report.EnumSMSInfoType);
                Logger.Info(string.Format("Static_WebSMSManager.Add()共花销{0}毫秒", (DateTime.Now - dt1).TotalMilliseconds), "Users", string.Join(",", arrUser));

                if (report.EnumAlarmGrade == EnumAlarmGrade.Alarm)
                {
                    DateTime dt2 = DateTime.Now;
                    GPSServiceFacade.Alarm.AlarmInfo.Add(this.CreateAlarmEntity(context, report, webSMS));
                    Logger.Info(string.Format("Static_AlarmInfoManager.Add()共花销{0}毫秒", (DateTime.Now - dt2).TotalMilliseconds));
                }

                Logger.Info(string.Format("WebSiteSMS [{0}],{1},{2}", title, content, report.ReceiveUserList));
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }