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)); }
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); }