/// <summary> /// 删除eSight对象,从数据库中。 /// </summary> /// <returns></returns> public bool DeleteESight() { CheckInit();//是否不存在eSight对象。 IHWESightHostDal hwESightHostDal = HWESightHostDal.Instance; if (this.HWESightHost.ID > 0) { hwESightHostDal.DeleteESight(this.HWESightHost.ID); } else { LogUtil.HWLogger.API.WarnFormat("This eSight host has not add to the database,IP:{0}", HWESightHost.HostIP); } return(true); }
/// <summary> /// 根据ID删除一个eSight,删除内存和数据库。 /// </summary> /// <param name="id">eSight id</param> /// <returns>成功失败。</returns> public bool RemoveESSession(int id) { bool isNotFind = true; IList <HWESightHost> hostList = ListESHost(); foreach (HWESightHost host in hostList) { if (host.ID == id) { LogUtil.HWLogger.API.InfoFormat("Begining to delete eSight: [{0}, {1}]", host.HostIP, host.ID); RemoveESSession(host.HostIP); isNotFind = false; } } if (isNotFind) {//多删除一次,在数据库中。 没找到时。 IHWESightHostDal hwESightHostDal = HWESightHostDal.Instance; hwESightHostDal.DeleteESight(id); LogUtil.HWLogger.API.InfoFormat("deleted eSight: [{0}]", id); } return(true); }