Exemplo n.º 1
0
        public List <Maticsoft.Model.BST.staff_log> ReadRecords(int limit = 100)
        {
            Maticsoft.BLL.BST.staff_log logBll = new Maticsoft.BLL.BST.staff_log();
            SetDbConnectStr(logBll.dal.DbHelperMySQLP);

            var list = logBll.GetModelList("data_keepon5!='1' limit " + limit);

            return(list);
        }
Exemplo n.º 2
0
 public bool SetStateReaded(List <Maticsoft.Model.BST.staff_log> list)
 {
     Maticsoft.BLL.BST.staff_log logBll = new Maticsoft.BLL.BST.staff_log();
     SetDbConnectStr(logBll.dal.DbHelperMySQLP);
     if (list.Count > 0)
     {
         logBll.SetStateReaded(list);
     }
     return(true);
 }
Exemplo n.º 3
0
 private void HeartbeatReadCallback(IAsyncResult ar)
 {
     try
     {
         int count = _heartNS.EndRead(ar);
         if (count > 0)
         {
             string str = Encoding.UTF8.GetString(_heartReadBuffer, 0, count);
             if (str == "<BST_02<<000000/BST_02>")//心跳
             {
                 _heartStateTime = DateTime.Now;
             }
             else
             {
                 _heartResultString += str;
             }
         }
         if (!_heartNS.DataAvailable)
         {//无数据可读
             if (_heartResultString != "")
             {
                 try
                 {
                     if (_heartResultString.Contains("<BST_02<<000000/BST_02>"))
                     {
                         _heartStateTime    = DateTime.Now;
                         _heartResultString = _heartResultString.Replace("<BST_02<<000000/BST_02>", "");
                     }
                     if (!string.IsNullOrWhiteSpace(_heartResultString))
                     {
                         if (_heartResultString.StartsWith("<BST_01<<") && _heartResultString.Length > 106)
                         {
                             int    ind   = _heartResultString.IndexOf("<ID/");
                             int    idLen = int.Parse(_heartResultString.Substring(ind + 4, 2));
                             string logid = _heartResultString.Substring(106, idLen);
                             Maticsoft.BLL.BST.staff_log logBll = new Maticsoft.BLL.BST.staff_log();
                             SetDbConnectStr(logBll.dal.DbHelperMySQLP);
                             var model = logBll.GetModel(logid);
                             if (model != null)
                             {
                                 if (_readRecordHandle != null)
                                 {
                                     _readRecordHandle.BeginInvoke(this, model, null, null);
                                 }
                             }
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                     log.Error("解析人脸实时状态数据异常:", ex);
                 }
                 finally
                 {
                     _heartResultString = "";
                 }
             }
         }
         _heartNS.BeginRead(_heartReadBuffer, 0, _heartReadBuffer.Length, HeartbeatReadCallback, null);
     }
     catch (Exception ex)
     {
         log.Error("读取异常:" + ex.Message);
     }
 }