Ejemplo n.º 1
0
        public void drivaceDeal(string drivaceID, WarnType wType) //处理设备
        {
            DrivaceWarnMessage drevaceMsg = null;

            if (wType == WarnType.CARD_LOW_ELECTRICITY)
            {
                if (cardLowEleWarnMsgs.ContainsKey(drivaceID))
                {
                    drevaceMsg = cardLowEleWarnMsgs[drivaceID];
                }
            }
            else if (wType == WarnType.CARD_UNANSWERED)
            {
                if (cardUnanswerWranMsgs.ContainsKey(drivaceID))
                {
                    drevaceMsg = cardUnanswerWranMsgs[drivaceID];                                             //.DealWarnTime = XwDataUtils.GetTimeStamp();
                }
            }
            else if (wType == WarnType.NODE_UNANSWERED)
            {
                if (nODEUnanswerWranMsgs.ContainsKey(drivaceID))
                {
                    drevaceMsg = nODEUnanswerWranMsgs[drivaceID];                                             //.DealWarnTime = XwDataUtils.GetTimeStamp();
                }
            }
            if (drevaceMsg != null)
            {
                drevaceMsg.DealWarnTime = XwDataUtils.GetTimeStamp();
                drevaceMsg.IsDeal       = true;
            }
        }
Ejemplo n.º 2
0
 public static void Set(string message, WarnType type)
 {
     _current?.Dispatcher.BeginInvoke(new Action(() =>
     {
         _current.InternalSet(message, type);
     }));
 }
        /// <summary>
        /// 发送邮件方法
        /// </summary>
        /// <param name="sendTo">接受者</param>
        /// <param name="content">发送内容</param>
        /// <param name="title">标题</param>
        /// <param name="warnType">发送优先级</param>
        /// <param name="emaliType">邮件类型</param>
        /// <param name="jsonType">返回参数类型</param>
        /// <param name="Errormessage">发送信息</param>
        /// <returns>返回是否成功标识及信息</returns>
        public static bool SendEmail(string sendTo, string content, string title, WarnType warnType, EmaliType emaliType, JsonType jsonType, out string Errormessage)
        {
            object b = null;

            Errormessage = string.Empty;
            string       emailContext = content;
            const string pv           = "1.0.0";
            var          url          = System.Configuration.ConfigurationManager.AppSettings["SendEmailUrl"];
            var          sign         = Common.Md5Helper.Md5(content + pv + "111");
            var          data         =
                string.Format(
                    "sendTo={0}&content={1}&title={2}&warnType={3}&emaliType={4}&jsonType={5}&sign={6}&pv={7}", sendTo, emailContext, title, (int)warnType, (int)emaliType, (int)jsonType, sign, pv);

            try
            {
                string ret;
                HttpWebAsk.Post(url, data, out ret);
                trade t = Common.JsonSerializeHelper.DeserializeFromJson <trade>(ret);
                if (t.id == 1)
                {
                    b            = true;
                    Errormessage = t.comment;
                }
                else
                {
                    b            = false;
                    Errormessage = t.comment;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return((bool)b);
        }
Ejemplo n.º 4
0
 public WarnForm()
 {
     InitializeComponent();
     warnType     = WarnType.Null;
     haveInitForm = false;
     HaveWarnMsg  = false;
 }
Ejemplo n.º 5
0
        private void clearWarn(ListView listView, int changeIndex, WarnType wType)
        {
            int listCount = listView.Items.Count;

            if (listCount < 1)
            {
                return;
            }
            List <ListViewItem> rListItem = new List <ListViewItem>();

            for (int i = 0; i < listCount; i++)
            {
                try
                {
                    if (!"是".Equals(listView.Items[i].SubItems[changeIndex].Text))
                    {
                        continue;
                    }
                    rListItem.Add(listView.Items[i]);
                }
                catch (Exception e)
                {
                    Debug.Write("clearWarn.." + e.Message);
                }
            }
            foreach (var Item in rListItem)
            {
                listView.Items.Remove(Item);
                //    dealDriWarn();
            }
        }
Ejemplo n.º 6
0
        private void dealDriWarn(string id, WarnType wType)
        {
            if (wType == WarnType.CARD_LOW_ELECTRICITY)
            {
                if (cardLowEleWarnMsgs != null && cardLowEleWarnMsgs.ContainsKey(id))
                {
                    cardLowEleWarnMsgs.Remove(id);
                }
            }
            else if (wType == WarnType.CARD_UNANSWERED)
            {
                if (cardUnanswerWranMsgs != null && cardUnanswerWranMsgs.ContainsKey(id))
                {
                    cardUnanswerWranMsgs.Remove(id);
                }
            }
            else if (wType == WarnType.NODE_UNANSWERED)
            {
                if (nODEUnanswerWranMsgs != null && nODEUnanswerWranMsgs.ContainsKey(id))
                {
                    nODEUnanswerWranMsgs.Remove(id);
                }
            }

            //  private Dictionary<string, DrivaceWarnMessage> cardLowEleWarnMsgs;//
            //      private Dictionary<string, DrivaceWarnMessage> cardUnanswerWranMsgs;//
            //      private Dictionary<string, DrivaceWarnMessage> nODEUnanswerWranMsgs;//
        }
Ejemplo n.º 7
0
 public void setNODEUnanswer(string NODEId, uint sleepTime, string quYuID, string canKaoDianID, long drivaceUpTime)
 {
     setLowEle(NODEId, 0, quYuID, canKaoDianID, drivaceUpTime);
     drivaceName    = getFileNODEName(NODEId);
     drivace        = DrivaceTypeAll.NODE;
     warnTp         = WarnType.NODE_UNANSWERED;
     this.sleepTime = sleepTime;
 }
 /// <summary>
 /// Adds the client to warning list.
 /// </summary>
 /// <param name="clientId">The client id.</param>
 /// <param name="type">The type.</param>
 public void AddClientToWarningList(uint clientId, WarnType type)
 {
     var clientWarning = new ClientWarningEntity(clientId, type);
     lock (Container.lockClientWarningList)
     {
         if (!Container.ClientWarningList.Contains(clientWarning))
             Container.ClientWarningList.Add(clientWarning);
     }
 }
Ejemplo n.º 9
0
    public void Show(WarnType type)
    {
        switch (type)
        {
        case WarnType.SameName: SameNameWarn.SetActive(true); break;

        case WarnType.IsOperation: IsOperationWarn.SetActive(true); break;
        }
    }
Ejemplo n.º 10
0
        /// <summary>
        /// Adds the client to warning list.
        /// </summary>
        /// <param name="clientId">The client id.</param>
        /// <param name="type">The type.</param>
        public void AddClientToWarningList(uint clientId, WarnType type)
        {
            var clientWarning = new ClientWarningEntity(clientId, type);

            lock (Container.lockClientWarningList)
            {
                if (!Container.ClientWarningList.Contains(clientWarning))
                {
                    Container.ClientWarningList.Add(clientWarning);
                }
            }
        }
Ejemplo n.º 11
0
        private void InternalSet(string message, WarnType type)
        {
            if (stackPanel.Children.Count == 200)
            {
                stackPanel.Children.Clear();
            }
            var itemView = new JournaltemView();

            itemView.DataContext = new JournalItemViewModel(message, type);
            stackPanel.Children.Add(itemView);
            scrollView.ScrollToEnd();
        }
Ejemplo n.º 12
0
 public static void Set(string message, WarnType type, Exception e = null, bool showAnyway = false)
 {
     JournalView.Set(message, type);
     if (type <= MaxShowingWarnType || showAnyway)
     {
         JournalLightWindow.Show(message, type);
     }
     if (type == WarnType.Fatal)
     {
         MessageBox.Show(message + "\r\n" + (e?.Message ?? string.Empty), "Критическая ошибка! Lazurite будет закрыт.", MessageBoxButton.OK, MessageBoxImage.Error);
         System.Windows.Application.Current.Shutdown(1);
     }
 }
Ejemplo n.º 13
0
 private void Set(string message, WarnType type)
 {
     if (!string.IsNullOrEmpty(message))
     {
         if (stackPanel.Children.Count == 10)
         {
             stackPanel.Children.Clear();
             Height = 50;
         }
         var itemView = new JournaltemView();
         itemView.DataContext = new JournalItemViewModel(message, type);
         stackPanel.Children.Add(itemView);
         Height += itemView.Height;
     }
 }
Ejemplo n.º 14
0
 public static void Show(string message, WarnType type)
 {
     if (!string.IsNullOrEmpty(message))
     {
         Application.Current?.Dispatcher.BeginInvoke(new Action(() =>
         {
             if (_current == null || _closed)
             {
                 _current = new JournalLightWindow();
                 _current.Show();
             }
             _current.Set(message, type);
         }));
     }
 }
Ejemplo n.º 15
0
        private bool isClear = false;   //是否清理

        public void setLowEle(string cardId, int currentElectricity, string quYuID, string canKaoDianID, long drivaceUpTime)
        {
            drivace                 = DrivaceTypeAll.CARD;
            warnTp                  = WarnType.CARD_LOW_ELECTRICITY;
            drivaceID               = cardId;
            drivaceName             = getFileCardName(cardId);
            this.quYuID             = quYuID;
            this.drivaceUpTime      = drivaceUpTime;
            quYuName                = getFilequYuName(canKaoDianID);
            this.canKaoDianID       = canKaoDianID;
            canKaoDianName          = getFileNODEName(canKaoDianID);
            warnTime                = XwDataUtils.GetTimeStamp();
            this.currentElectricity = currentElectricity;
            dealWarnTime            = 0;
        }
Ejemplo n.º 16
0
 public void Write(WarnType type, string message = null, Exception exception = null)
 {
     if (_maxWritingWarnType == null)
     {
         _maxWritingWarnType = GlobalSettings.Get(WarnType.Info, nameof(_maxWritingWarnType));
     }
     if (type == WarnType.Debug)
     {
         System.Diagnostics.Debug.WriteLine(message);
     }
     if (type <= _maxWritingWarnType)
     {
         InternalWrite(type, message, exception);
     }
     RaiseOnWrite(type, message, exception);
 }
Ejemplo n.º 17
0
 public void drivaceClear(WarnType wType) // 设备清理
 {
     if (wType == WarnType.CARD_LOW_ELECTRICITY)
     {
         drivaceClear(cardLowEleWarnMsgs, cardLowEleWarnHisMsgs);
     }
     else if (wType == WarnType.CARD_UNANSWERED)
     {
         drivaceClear(cardUnanswerWranMsgs, cardUnanswerWranHisMsgs);
     }
     else if (wType == WarnType.NODE_UNANSWERED)
     {
         drivaceClear(nODEUnanswerWranMsgs, nODEUnanswerWranHisMsgs);
     }
     warnMsgCallBack(nODEUnanswerWranMsgs.Count + cardLowEleWarnMsgs.Count + cardUnanswerWranMsgs.Count);
 }
Ejemplo n.º 18
0
        public void Write(WarnType type, string message = null, Exception exception = null)
        {
#if DEBUG
            System.Diagnostics.Debug.WriteLine(message);
            if (exception != null)
            {
                System.Diagnostics.Debug.WriteLine(exception.Message);
                System.Diagnostics.Debug.WriteLine(exception.StackTrace);
            }
#endif
            if (type <= MaxWritingWarnType)
            {
                InternalWrite(type, message, exception);
            }

            RaiseOnWrite(type, message, exception);
        }
Ejemplo n.º 19
0
 public static void Set(string message, WarnType type, Exception e = null, bool showAnyway = false)
 {
     JournalView.Set(message, type);
     if (type <= MaxShowingWarnType || showAnyway)
     {
         JournalLightWindow.Show(message, type);
     }
     if (type == WarnType.Fatal)
     {
         Application.Current.Dispatcher.BeginInvoke(new Action(() =>
         {
             var mainWindow = Application.Current.Windows.Cast <Window>().FirstOrDefault(x => x is MainWindow);
             if (mainWindow != null)
             {
                 MessageView.ShowMessage(message + "\r\n" + e?.Message, "Критическая ошибка!", Icons.Icon.Close, mainWindow.Content as Panel, () => Application.Current.Shutdown(1));
             }
         }));
     }
 }
Ejemplo n.º 20
0
        public async Task <HttpResponseMessage> VerifyNPI(ApiModel inputmodel)
        {
            WarnType data = new WarnType();

            try
            {
                ApiResponseModel <WarnType> model = new ApiResponseModel <WarnType>()
                {
                };
                var client = ServiceFactory.GetService(typeof(Physician));
                data = await client.verifyNPI(inputmodel.npi);

                model.data.records = data;
                return(Response.Success <WarnType>(model));
            }
            catch (Exception ex)
            {
                return(Response.Exception(ex));
            }
        }
Ejemplo n.º 21
0
        public override void InternalWrite(WarnType type, string message = null, Exception exception = null)
        {
            try
            {
                switch (type)
                {
                case WarnType.Debug:
                    _logger.Debug(message, exception);
                    break;

                case WarnType.Error:
                    _logger.Error(message, exception);
                    break;

                case WarnType.Fatal:
                {
                    ExtremeLog(message, exception);
                    _logger.Fatal(message, exception);
                    LogManager.Flush(0);
                }
                break;

                case WarnType.Info:
                    _logger.Info(message, exception);
                    break;

                case WarnType.Warn:
                    _logger.Warn(message, exception);
                    break;
                }
            }
            catch (Exception e)
            {
                ExtremeLog(message + " /// " + exception.Message, e);
            }
        }
Ejemplo n.º 22
0
 public abstract void InternalWrite(WarnType type, string message = null, Exception exception = null);
Ejemplo n.º 23
0
 private void RaiseOnWrite(WarnType type, string message, Exception exception)
 {
     OnWrite?.Invoke(this, new WarningEventArgs(type, message, exception));
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClientWarningEntity"/> class.
 /// </summary>
 /// <param name="clientId">The client id.</param>
 /// <param name="type">The type.</param>
 public ClientWarningEntity(uint clientId, WarnType type)
 {
     Creation = DateTime.UtcNow;
     ClientId = clientId;
     Type = type;
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClientWarningEntity"/> class.
 /// </summary>
 /// <param name="clientId">The client id.</param>
 /// <param name="type">The type.</param>
 public ClientWarningEntity(uint clientId, WarnType type)
 {
     Creation = DateTime.UtcNow;
     ClientId = clientId;
     Type     = type;
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Determines whether [is client warning over] [the specified client id].
 /// </summary>
 /// <param name="clientId">The client id.</param>
 /// <param name="type">The type.</param>
 /// <returns>
 ///     <c>true</c> if [is client warning over] [the specified client id]; otherwise, <c>false</c>.
 /// </returns>
 public bool IsClientWarningOver(uint clientId, WarnType type)
 {
     return(GetClientToWarningList().Any(m => m.ClientId == clientId && m.Type == type &&
                                         m.Creation.AddSeconds(30) < Repository.Static.Now));
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Determines whether [is client warned] [the specified client id].
 /// </summary>
 /// <param name="clientId">The client id.</param>
 /// <param name="type">The type.</param>
 /// <returns>
 ///     <c>true</c> if [is client warned] [the specified client id]; otherwise, <c>false</c>.
 /// </returns>
 public bool IsClientWarned(uint clientId, WarnType type)
 {
     return(GetClientToWarningList().Any(m => m.ClientId == clientId && m.Type == type));
 }
Ejemplo n.º 28
0
 private void Warn(List <string> warnings, WarnType type, string warning)
 {
     warnings.Add(type.ToString() + ": " + warning);
 }
 /// <summary>
 /// Determines whether [is client warning over] [the specified client id].
 /// </summary>
 /// <param name="clientId">The client id.</param>
 /// <param name="type">The type.</param>
 /// <returns>
 /// 	<c>true</c> if [is client warning over] [the specified client id]; otherwise, <c>false</c>.
 /// </returns>
 public bool IsClientWarningOver(uint clientId, WarnType type)
 {
     return GetClientToWarningList().Any(m => m.ClientId == clientId && m.Type == type
                                       && m.Creation.AddSeconds(30) < Repository.Static.Now);
 }
 /// <summary>
 /// Determines whether [is client warned] [the specified client id].
 /// </summary>
 /// <param name="clientId">The client id.</param>
 /// <param name="type">The type.</param>
 /// <returns>
 /// 	<c>true</c> if [is client warned] [the specified client id]; otherwise, <c>false</c>.
 /// </returns>
 public bool IsClientWarned(uint clientId, WarnType type)
 {
     return GetClientToWarningList().Any(m => m.ClientId == clientId && m.Type == type);
 }
Ejemplo n.º 31
0
 private void Warn(List<string> warnings, WarnType type, string warning)
 {
     warnings.Add(type.ToString() + ": " + warning);
 }
Ejemplo n.º 32
0
 public void setCardUnanswer(string cardId, uint sleepTime, string quYuID, string canKaoDianID, long drivaceUpTime)
 {
     setLowEle(cardId, 0, quYuID, canKaoDianID, drivaceUpTime);
     warnTp         = WarnType.CARD_UNANSWERED;
     this.sleepTime = sleepTime;
 }
 public JournalItemViewModel(string message, WarnType type)
 {
     Message  = message;
     WarnType = type;
     Time     = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString();
 }