/// <summary> /// 判断线圈电源是否和其他设备有关系 /// </summary> /// <param name="coilpowerId">线圈电源id</param> /// <returns></returns> public bool HasRelation(string coilpowerId) { try { Log.Info("BllDEV_COILPOWER_INFO->HasRelation---START"); bool result = false; //声明一个变量 DataSet dstemp = new DataSet(); ConnectionOpen(); //负载和线圈电源关系 DalDEV_COILPOWER_TO_LOAD dalDevCoilpowerToLoad = new DalDEV_COILPOWER_TO_LOAD(); dalDevCoilpowerToLoad.SetDBAccess(GetDBAccess()); dstemp = dalDevCoilpowerToLoad.GetList("F_COILPOWER_ID='" + coilpowerId + "'"); if (dstemp != null && dstemp.Tables.Count > 0) { result |= dstemp.Tables[0].Rows.Count > 0; } //负载和线圈电源关系 DalDEV_WORK_TO_COILPOWER dalDevWorkToCoilpower = new DalDEV_WORK_TO_COILPOWER(); dalDevWorkToCoilpower.SetDBAccess(GetDBAccess()); dstemp = dalDevWorkToCoilpower.GetList("F_COILPOWER_ID='" + coilpowerId + "'"); if (dstemp != null && dstemp.Tables.Count > 0) { result |= dstemp.Tables[0].Rows.Count > 0; } return(result); } catch (Exception ex) { Log.Error("BllDEV_COILPOWER_INFO->HasRelation---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllDEV_COILPOWER_INFO->HasRelation---finally"); } }
/// <summary> /// 判断上位机是否和其他设备有关系 /// </summary> /// <param name="workstationId">工作站id</param> /// <returns></returns> public bool HasRelation(string workstationId) { try { Log.Info("BllDEV_WORKSTATION_INFO->HasRelation---START"); bool result = false; //声明一个变量 DataSet dstemp = new DataSet(); ConnectionOpen(); //工作站和线圈电源关系 DalDEV_WORK_TO_COILPOWER dalDevWorkToCoilpower = new DalDEV_WORK_TO_COILPOWER(); dalDevWorkToCoilpower.SetDBAccess(GetDBAccess()); dstemp = dalDevWorkToCoilpower.GetList("F_WORKSTATION_ID='" + workstationId + "'"); if (dstemp != null && dstemp.Tables.Count > 0) { result |= dstemp.Tables[0].Rows.Count > 0; } //工作站和供电柜关系 DalDEV_WORK_TO_POWER dalDevWorkToPower = new DalDEV_WORK_TO_POWER(); dalDevWorkToPower.SetDBAccess(GetDBAccess()); dstemp = dalDevWorkToPower.GetList("F_WORKSTATION_ID='" + workstationId + "'"); if (dstemp != null && dstemp.Tables.Count > 0) { result |= dstemp.Tables[0].Rows.Count > 0; } //工作站和下位机关系 DalDEV_WORK_TO_SUB dalDevWorkToSub = new DalDEV_WORK_TO_SUB(); dalDevWorkToSub.SetDBAccess(GetDBAccess()); dstemp = dalDevWorkToSub.GetList("F_WORKSTATION_ID='" + workstationId + "'"); if (dstemp != null && dstemp.Tables.Count > 0) { result |= dstemp.Tables[0].Rows.Count > 0; } //工作站和温度传感器关系 DalDEV_WORK_TO_SENSOR dalDevWorkToSensor = new DalDEV_WORK_TO_SENSOR(); dalDevWorkToSensor.SetDBAccess(GetDBAccess()); dstemp = dalDevWorkToSensor.GetList("F_WORKSTATION_ID='" + workstationId + "'"); if (dstemp != null && dstemp.Tables.Count > 0) { result |= dstemp.Tables[0].Rows.Count > 0; } return(result); } catch (Exception ex) { Log.Error("BllDEV_WORKSTATION_INFO->HasRelation---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllDEV_WORKSTATION_INFO->HasRelation---finally"); } }