示例#1
0
 public void Warning(WarningInfo info)
 {
     if (info.WarningType == WarningType.FontSubstitution)
     {
         Debug.WriteLine("WARNING INFO: " + info.Description);
     }
 }
示例#2
0
 /// <summary>
 /// Called every time a warning occurs during loading/saving.
 /// </summary>
 public void Warning(WarningInfo info)
 {
     if (info.WarningType == WarningType.FontSubstitution)
     {
         FontSubstitutionWarnings.Warning(info);
     }
 }
示例#3
0
 public void Warning(WarningInfo warningInfo)
 {
     if (warningInfo.WarningType == WarningType.DuplicateDefinedName)
     {
         Console.WriteLine("Duplicate Defined Name Warning: " + warningInfo.Description);
     }
 }
 public void Warning(WarningInfo info)
 {
     if (info.WarningType == WarningType.FontSubstitution)
     {
         Debug.WriteLine("WARNING INFO: " + info.Description);
     }
 }
 public void Warning(WarningInfo info)
 {
     Console.WriteLine($"Warning: {info.WarningType}");
     Console.WriteLine($"\tSource: {info.Source}");
     Console.WriteLine($"\tDescription: {info.Description}");
     mWarnings.Add(info);
 }
 /// <summary>
 /// Our callback only needs to implement the "Warning" method. This method is called whenever there is a
 /// potential issue during document procssing. The callback can be set to listen for warnings generated during document
 /// load and/or document save.
 /// </summary>
 public void Warning(WarningInfo info)
 {
     // We are only interested in fonts being substituted.
     if (info.WarningType == WarningType.FontSubstitution)
     {
         Console.WriteLine("Font substitution: " + info.Description);
     }
 }
 /// <summary>
 /// Our callback only needs to implement the "Warning" method. This method is called whenever there is a
 /// Potential issue during document procssing. The callback can be set to listen for warnings generated during document
 /// Load and/or document save.
 /// </summary>
 public void Warning(WarningInfo info)
 {
     // We are only interested in fonts being substituted.
     if (info.WarningType == WarningType.FontSubstitution)
     {
         Console.WriteLine("Font substitution: " + info.Description);
     }
 }
示例#8
0
        public void Test_Write_WarningInfo()
        {
            WarningInfo info = WarningInfo.Create("当前发生了XXX,告警告警。");

            LogHelper.SyncWrite(info);

            // 写入成功就认为通过
        }
示例#9
0
 /// <summary>
 /// Our callback only needs to implement the "Warning" method.
 /// This method is called whenever there is a potential issue during document processing.
 /// The callback can be set to listen for warnings generated during document load and/or document save.
 /// </summary>
 public void Warning(WarningInfo info)
 {
     // We are only interested in fonts being substituted.
     if (info.WarningType == WarningType.FontSubstitution)
     {
         FontWarnings.Warning(info);
     }
 }
 /// <summary>
 /// Our callback only needs to implement the "Warning" method. This method is called whenever there is a
 /// potential issue during document processing. The callback can be set to listen for warnings generated during document
 /// load and/or document save.
 /// </summary>
 public void Warning(WarningInfo info)
 {
     //For now type of warnings about unsupported metafile records changed from DataLoss/UnexpectedContent to MinorFormattingLoss.
     if (info.WarningType == WarningType.MinorFormattingLoss)
     {
         Console.WriteLine("Unsupported operation: " + info.Description);
         mWarnings.Warning(info);
     }
 }
示例#11
0
        /// <summary>
        /// 数据处理线程
        /// </summary>
        /// <param name="objectPar"></param>
        private void DoWithData(object objectPar)
        {
            DataPar par = objectPar as DataPar;

            if (par == null)
            {
                return;
            }
            try
            {
                ////保存数据到数据库
                //IoT_MeterDataHistory meterData = new IoT_MeterDataHistory();
                ////累计用量
                //meterData.Gas = par.DataItem.LJGas;
                ////
                //meterData.MeterID = par.Meter.MeterID;
                //meterData.MeterNo = par.Meter.Mac;
                //meterData.ReadDate = par.DataItem.ReadDate;
                //meterData.RemainingAmount = par.DataItem.SYMoney;
                //meterData.LastTotal = par.DataItem.LastLJGas;
                //meterData.ST1 = par.DataItem.ST1.ToString();
                //meterData.ST2 = par.DataItem.ST2.ToString();

                ReadDataInfo readdatainfo = new ReadDataInfo();
                readdatainfo._Gas             = par.DataItem.LJGas;
                readdatainfo._MeterID         = par.Meter.MeterID;
                readdatainfo._MeterNo         = par.Meter.Mac;
                readdatainfo._ReadDate        = par.DataItem.ReadDate;
                readdatainfo._RemainingAmount = par.DataItem.SYMoney;
                readdatainfo._LastTotal       = par.DataItem.LastLJGas;
                readdatainfo._ST1             = par.DataItem.ST1.ToString();
                readdatainfo._ST2             = par.DataItem.ST2.ToString();


                WarningInfo warninginfo = new WarningInfo();
                warninginfo.MeterID  = par.Meter.MeterID;
                warninginfo.meterNo  = par.Meter.Mac;
                warninginfo.readDate = par.DataItem.ReadDate;
                warninginfo.st1      = par.DataItem.ST1.ToString();
                warninginfo.st2      = par.DataItem.ST2.ToString();
                //InsertReadData(meterData);
                // //分析报警信息
                //InsertWariningData(par.Meter.MeterID, par.Meter.Mac, par.DataItem.ReadDate, par.DataItem.ST1.ToString(), par.DataItem.ST2.ToString());

                ///向业务服务器 队列中添加对象
                Log.getInstance().Write(MsgType.Information, $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}上报采集记录到数据中心,DataType:{DataType.ReadData} MeterNo:{readdatainfo._MeterNo} ReadDate:{readdatainfo._ReadDate}");
                Log.getInstance().Write(MsgType.Information, $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}上报采集记录到数据中心,DataType:{DataType.WarningData} MeterNo:{readdatainfo._MeterNo} ReadDate:{readdatainfo._ReadDate} ST1:{par.DataItem.ST1.ToString()} ST2:{ warninginfo.st2}");
                DDService.getInstance().InsertDataRecord(new DataArge(DataType.ReadData, readdatainfo));
                DDService.getInstance().InsertDataRecord(new DataArge(DataType.WarningData, warninginfo));
            }
            catch (Exception er)
            {
                Log.getInstance().Write(MsgType.Information, "DoWithData:" + er.ToString());
            }
        }
示例#12
0
        private void ProcessWarning(BaseResult rs, byte[] payload)
        {
            Warning     w       = Warning.Parser.ParseFrom(payload);
            WarningInfo warning = new WarningInfo(w.Code, w.Msg);

            if (w.Level != Warning.Types.Level.None)
            {
                warning.Level = (uint)w.Level;
            }
            rs.AddWarning(warning);
        }
示例#13
0
 /// <summary>
 /// 添加数据队列处理任务  报警信息
 /// </summary>
 /// <returns></returns>
 public void AddWork(WarningInfo work)
 {
     if (WarningDataQueueServices == null)
     {
         return;
     }
     foreach (IWarningDataQueue dc in WarningDataQueueServices)
     {
         dc.workQueue_AddWork(work);
     }
 }
        public void GetEnumeratorEx()
        {
            //ExStart
            //ExFor:WarningInfoCollection.GetEnumerator
            //ExFor:WarningInfoCollection.Clear
            //ExSummary:Shows how to read and clear a collection of warnings.
            WarningInfoCollection wic = new WarningInfoCollection();

            var enumerator = wic.GetEnumerator();

            while (enumerator.MoveNext())
            {
                WarningInfo wi = (WarningInfo)enumerator.Current;
                Console.WriteLine(wi.Description);
            }

            wic.Clear();
            //ExEnd
        }
示例#15
0
        public void GetEnumeratorEx()
        {
            //ExStart
            //ExFor:WarningInfoCollection.GetEnumerator
            //ExFor:WarningInfoCollection.Clear
            //ExSummary:Shows how to read and clear a collection of warnings.
            WarningInfoCollection wic = new WarningInfoCollection();

            using (IEnumerator <WarningInfo> enumerator = wic.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    WarningInfo wi = enumerator.Current;
                    if (wi != null)
                    {
                        Console.WriteLine(wi.Description);
                    }
                }

                wic.Clear();
            }
            //ExEnd
        }
        /// <summary>
        /// 向队列中添加对象
        /// </summary>
        /// <param name="item"></param>
        public void workQueue_AddWork(WarningInfo item)
        {
            Log.getInstance().Write(MsgType.Information, $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}添加数据到报警处理队列,this.Queue.Count:{this.Queue.QueueCount()},表号:{item.meterNo} 数据采集时间:{item.readDate} ST1:{item.st1} ST2:{item.st2}");

            this.Queue.EnqueueItem(item);
        }
示例#17
0
 public void Warning(WarningInfo info)
 {
     // Prints warnings and their details as they arise during document loading.
     Console.WriteLine($"WARNING: {info.WarningType}, source: {info.Source}");
     Console.WriteLine($"\tDescription: {info.Description}");
 }
示例#18
0
        /// <summary>
        ///     短消息构建
        /// </summary>
        /// <param name="alarm"></param>
        /// <param name="userType"></param>
        /// <returns></returns>
        private string CreateSMS(WarningInfo alarm, ContactType userType)
        {
            string result = string.Empty;
            // 结构物名称
            StructureInfo structs = _structureInfos.FirstOrDefault(m => m.Id == Convert.ToInt32(alarm.StructId));
            // 告警原因
            WarningType warningtype   = _warningTypes.FirstOrDefault(m => m.TypeId == alarm.WarningTypeId);
            string      warningReason = string.Empty;
            // 设备信息
            int deviceTypeId = Convert.ToInt32(alarm.DeviceTypeId);

            if (userType == ContactType.Support)
            {
                if (warningtype != null)
                {
                    warningReason = "告警原因:" + warningtype.Reason;
                }
            }
            switch (deviceTypeId)
            {
            case (int)DeviceType.Dtu:
                List <RemoteDtu> dtus =
                    _remoteDtus.Where(m => Convert.ToInt32(m.RemoteDtuNumber) == Convert.ToInt32(alarm.DeviceId))
                    .ToList();
                if (dtus.Count == 0)
                {
                    throw new CreateSMSException(string.Format("Unknown DTU({0}) of alarm({1}).", alarm.DeviceId,
                                                               alarm.Id));
                }
                result = string.Format("{0},{1}: {2}-{3}-{4} 产生 {5} 级告警, 告警描述: {6}. {7} {8}",
                                       Convert.ToDateTime(alarm.Time).ToString("yyyy-MM-dd HH:mm:ss"), "DTU设备",
                                       dtus.First().Description, dtus.First().RemoteDtuNumber,
                                       structs != null ? structs.StructureNameCn : "", alarm.WarningLevel,
                                       alarm.Description, alarm.Content, warningReason);
                break;

            case (int)DeviceType.Sensor:
                string        sensorInfo = string.Empty; // 传感器归属dtu、模块号、通道号
                List <Sensor> sensor     = _sensors.Where(m => m.Sensor_Id == alarm.DeviceId).ToList();
                if (sensor.Count == 0)
                {
                    throw new CreateSMSException(string.Format("Unknown Sensor({0}) of alarm({1}).", alarm.DeviceId,
                                                               alarm.Id));
                }
                if (userType == ContactType.Support)
                {
                    List <RemoteDtu> rdtus =
                        _remoteDtus.Where(m => Convert.ToString(m.Id) == sensor.First().Dtu_Id).ToList();
                    if (rdtus.Count > 0)
                    {
                        sensorInfo = string.Format("传感器归属DTU: {0} {1}, 模块号: {2}, 通道号: {3}",
                                                   rdtus.First().Description,
                                                   rdtus.First().RemoteDtuNumber,
                                                   Convert.ToString(sensor.First().Module_No),
                                                   Convert.ToString(sensor.First().Dai_Channel_Number));
                    }
                }
                result = string.Format("{0},{1} {2} {3} 产生 {4} 级告警, 告警描述:{5}. {6} {7} {8} ",
                                       Convert.ToDateTime(alarm.Time).ToString("yyyy-MM-dd HH:mm:ss"),
                                       structs != null ? structs.StructureNameCn : "",
                                       sensor.First().SensorLocationDs,
                                       "传感器设备", alarm.WarningLevel, alarm.Description, alarm.Content,
                                       warningReason, sensorInfo);
                break;
            }
            return(result);
        }
示例#19
0
 public void Warning(WarningInfo info)
 {
     Console.WriteLine(info.Description);
 }
 public void Warning(WarningInfo info)
 {
     mWarnings.Add(info);
 }
示例#21
0
 /// <summary>
 /// Create instance of CampaignConfigurationServiceResponse with error info based on exception.
 /// </summary>
 public CampaignConfigurationServiceResponse(Exception e) : base(e)
 {
     WarningInfo = new WarningInfo();
 }
示例#22
0
 /// <summary>
 /// Default constructor to create instance of CampaignConfigurationServiceResponse.
 /// </summary>
 public CampaignConfigurationServiceResponse()
 {
     WarningInfo = new WarningInfo();
 }
        public void ProcessRequest(HttpContext context)
        {
            string             url             = context.Request.QueryString["Url"];
            string             urlParams       = context.Request.QueryString["Url_params"];
            var                jsonParams      = JsonConvert.DeserializeObject <AlarmModel>(urlParams);
            string             json            = AlarmSupport.HttpPost(url, context, jsonParams);
            StructWarn         structWarnLists = JsonConvert.DeserializeObject <StructWarn>(json);
            List <Warn>        structWarn      = structWarnLists.warnings;
            List <WarningInfo> warnList        = new List <WarningInfo>();

            foreach (Warn warn in structWarn)
            {
                WarningInfo warnInfo = new WarningInfo();
                warnInfo.warning_source      = warn.source;
                warnInfo.warning_level       = warn.level.ToString();
                warnInfo.warning_time        = warn.time.ToString();
                warnInfo.warning_reason      = warn.reason;
                warnInfo.warning_information = warn.content;
                switch (warn.dealFlag)
                {
                case WarningSupportUnprocessed:
                    warnInfo.warning_dealFlag    = "未处理";
                    warnInfo.warning_confirmInfo = "N/A";
                    warnInfo.warning_send        = "确认 | 下发至用户";
                    break;

                case WarningSupportProcessed:
                    warnInfo.warning_dealFlag    = "已确认";
                    warnInfo.warning_confirmInfo = "确认人:" + warn.confirmor + "  确认信息: " + warn.suggestion + "  确认时间: " +
                                                   warn.confirmTime.ToString();
                    warnInfo.warning_send = "下发至用户";
                    break;

                case  WarningClientProcessed:
                case  WarningClientUnprocessed:
                    warnInfo.warning_dealFlag    = "已下发";
                    warnInfo.warning_confirmInfo = "N/A";
                    warnInfo.warning_send        = "N/A";
                    break;

                default:
                    warnInfo.warning_dealFlag    = "";
                    warnInfo.warning_confirmInfo = "";
                    warnInfo.warning_send        = "";
                    break;
                }
                warnList.Add(warnInfo);
            }

            var ListToJson = new JArray(
                warnList.Select(
                    d => new JObject(
                        new JProperty("告警源", d.warning_source),
                        new JProperty("等级", d.warning_level),
                        new JProperty("产生时间", d.warning_time),
                        new JProperty("可能原因", d.warning_reason),
                        new JProperty("告警信息", d.warning_information),
                        new JProperty("状态", d.warning_dealFlag),
                        new JProperty("确认信息", d.warning_confirmInfo),
                        new JProperty("操作", d.warning_send)
                        )));

            JsonToCsv(ListToJson.ToString());
        }
示例#24
0
        public List <List <WarningInfo> > GetGDWarningInfo()
        {
            List <List <WarningInfo> > newList = new List <List <WarningInfo> >();

            try
            {
                string strSQL = "select * from T_GDALARM "
                                + " where  sysdate-ddatetime<530 and signcolor<>'0' and keyid not in ("
                                + " select a.keyid from (select ddatetime,citycode,signname,signcolor,keyid from T_GDALARM "
                                + " where sysdate-ddatetime<530 and signcolor<>'0')a,(select ddatetime,citycode,signname,signcolor,keyid from T_GDALARM "
                                + " where sysdate-ddatetime<530 and signcolor='0') b"
                                + " where a.ddatetime<b.ddatetime and a.citycode =b.citycode and a.signname=b.signname"
                                + " ) "
                                + " order by  citycode,ddatetime ";
                var ds = DbHelperOra.Query(strSQL, CommonClass.GetconnectionStringsValue("SZQX13ConnectionString"));
                if (ds == null)
                {
                    return(null);
                }
                DataTable dbWarning = ds.Tables[0];
                strSQL = " select * from T_AREACODE ";

                DataTable dbArea = DbHelperOra.Query(strSQL, CommonClass.GetconnectionStringsValue("OraConString")).Tables[0];
                for (int i = 0; i < dbWarning.Rows.Count; i++)
                {
                    bool        isExist = false;
                    WarningInfo newInfo = new WarningInfo();
                    newInfo.IssueContent = dbWarning.Rows[i]["citycode"].ToString();
                    // newInfo.IssueState = dbWarning.Rows[i]["areaname"].ToString();
                    newInfo.IssueTime   = DateTime.Parse(dbWarning.Rows[i]["ddatetime"].ToString());
                    newInfo.SignalType  = dbWarning.Rows[i]["signname"].ToString();
                    newInfo.SignalLevel = dbWarning.Rows[i]["signcolor"].ToString();

                    foreach (List <WarningInfo> listW in newList)
                    {
                        if (listW.Count > 0)
                        {
                            if (listW[0].IssueContent.Equals(newInfo.IssueContent))
                            {
                                listW.Add(newInfo);
                                isExist = true;
                            }
                        }
                        if (isExist)
                        {
                            break;
                        }
                    }
                    if (!isExist)
                    {
                        List <WarningInfo> infoW = new List <WarningInfo>();
                        infoW.Add(newInfo);
                        newList.Add(infoW);
                    }
                }

                foreach (List <WarningInfo> listW in newList)
                {
                    if (listW.Count > 0)
                    {
                        bool isExist = false;
                        for (int i = 0; i < dbArea.Rows.Count; i++)
                        {
                            if (listW[0].IssueContent.Equals(dbArea.Rows[i]["citycode"].ToString()))
                            {
                                foreach (WarningInfo info in listW)
                                {
                                    info.IssueState = dbArea.Rows[i]["areaname"].ToString();
                                    info.Diff       = dbArea.Rows[i]["LONGITUDE"].ToString();
                                    info.District   = dbArea.Rows[i]["LATITUDE"].ToString();
                                }
                                isExist = true;
                                break;
                            }
                        }
                        if (!isExist)
                        {
                            string Error = listW[0].IssueContent;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                string LastErrorMsg = e.Message;
            }
            return(newList);
        }
示例#25
0
 public static extern int Warning_function(ref WarningInfo w);