Ejemplo n.º 1
0
        public bool ClearFaces()
        {
            Maticsoft.BLL.BST.staff_data dataBll = new Maticsoft.BLL.BST.staff_data();
            SetDbConnectStr(dataBll.dal.DbHelperMySQLP);
            var ids = dataBll.GetAllIds("");

            if (ids.Count > 0)
            {
                dataBll.DeleteAll("");
                ThreadPool.QueueUserWorkItem(new WaitCallback((o) =>
                {
                    try
                    {
                        foreach (var item in ids)
                        {
                            doSendCmd("//@BST_01@//", item, false);
                        }
                    }
                    catch (Exception)
                    {
                    }
                }));
            }
            return(true);
        }
Ejemplo n.º 2
0
 public bool ModifyTextInfo(out string errorMsg, params Maticsoft.Model.BST.staff_data[] datas)
 {
     errorMsg = null;
     Maticsoft.BLL.BST.staff_data bll = new Maticsoft.BLL.BST.staff_data();
     SetDbConnectStr(bll.dal.DbHelperMySQLP);
     foreach (var data in datas)
     {
         try
         {
             bll.UpdateEx(data);
             doSendCmd("//@BST_02@//" + data.id, checkStart: false);
         }
         catch (Exception ex)
         {
             throw new Exception("发生错误:" + ex.Message + ";姓名:" + data.name + " EX:" + ex.Message, ex);
         }
     }
     return(true);
 }
Ejemplo n.º 3
0
 public bool IsFaceExists(string id)
 {
     Maticsoft.BLL.BST.staff_data bll = new Maticsoft.BLL.BST.staff_data();
     SetDbConnectStr(bll.dal.DbHelperMySQLP);
     return(bll.Exists(id));
 }
Ejemplo n.º 4
0
        public bool DeleteFaces(List <string> ids, bool bExcmd)
        {
            try
            {
                Maticsoft.BLL.BST.staff_data dataBll = new Maticsoft.BLL.BST.staff_data();
                SetDbConnectStr(dataBll.dal.DbHelperMySQLP);
                List <string> exits = new List <string>();
                foreach (var id in ids)
                {
                    if (dataBll.Exists(id))
                    {
                        exits.Add(id);
                    }
                }
                if (exits.Count == 0)
                {
                    return(true);
                }
                int start = 0;
                int count = 20;
                while (true)
                {
                    if (start + count > exits.Count)
                    {
                        count = exits.Count - start;
                    }
                    var    rids  = exits.GetRange(start, count);
                    string temps = "";
                    foreach (var rid in rids)
                    {
                        temps += "'" + rid + "',";
                    }
                    temps = temps.TrimEnd(',');
                    dataBll.DeleteList(temps);
                    start += count;
                    if (start >= exits.Count)
                    {
                        break;
                    }
                }
                if (bExcmd)
                {
                    foreach (var item in exits)
                    {
                        doSendCmd("//@BST_01@//", item, false, 500);
                    }
                }
                return(true);
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                log.Error("删除MySQL人脸数据库异常,默认删除成功:", ex);
            }
            catch (Exception ex)
            {
                log.Error("删除MySQL人脸数据库异常,删除失败:", ex);
                return(false);
            }

            return(true);
        }