Esempio n. 1
0
        /// <summary>
        /// 组装MessageQueue数据 风电机组故障告警 WeChat
        /// </summary>
        public int BuilderMessageData_WeChatAlarmCrew(E故障事件历史库 alarm, VAlarmLevelUser user)
        {
            int resultId = 0;

            try
            {
                EMessageQueue mQueue = new EMessageQueue();

                mQueue.AlarmLevel     = alarm.等级;
                mQueue.CreateTime     = DateTime.Now;
                mQueue.MessageContent = BuilderSMSAlarmCrew(alarm).ToJson();
                mQueue.Status         = (int)eSendStatus.WaitSend;//等待发送
                mQueue.OpenId         = user.OpenId;
                mQueue.MessageType    = (int)eMessageType.WeChat;
                mQueue.Mobile         = user.Mobile;
                mQueue.AlarmType      = (int)eAlarmType.CrewAlarm;
                mQueue.FaultCount     = 0;
                mQueue.UserID         = user.UserID;
                mQueue.MessageData    = alarm.ToJson();

                resultId = JobDbAssist.Instance.InsertMessageQueue(mQueue);
            }
            catch (Exception ex)
            {
                Log.WriteFormat("C-【BuilderMessageData_WeChatAlarmCrew】Job异常:{0}", ex.Message);
                JobDispatch.UIDispalyTask("【风电机组故障告警Builder异常】JobDataBuilder.BuilderMessageData_WeChatAlarmCrew", ex.Message, (int)eJobStatus.Exception);
            }
            return(resultId);
        }
Esempio n. 2
0
        /// <summary>
        /// 已处理的数据 插入到发送队列
        /// </summary>
        /// <returns></returns>
        public int InsertMessageQueue(EMessageQueue eMessageQueue)
        {
            using (var db = DB.AlarmDBConnection)
            {
                string sql = "insert into MessageQueue(MessageContent,AlarmLevel,MessageType,AlarmType," +
                             "MessageData,Mobile,OpenId,CreateTime,FaultCount,Status,ResultMessage)" +
                             " values(@MessageContent,@AlarmLevel,@MessageType,@AlarmType," +
                             "@MessageData,@Mobile,@OpenId,@CreateTime,@FaultCount,@Status,@ResultMessage);" +
                             "select @@Identity;";

                return(db.ExecuteScalar <int>(sql, eMessageQueue));
            }
        }