コード例 #1
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);
        }
コード例 #2
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);
            }
        }