/// <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="loadId">负载id</param> /// <returns></returns> public bool HasRelation(string loadId) { try { Log.Info("BllDEV_LOAD_INFO->HasRelation---START"); bool result = false; //声明一个变量 DataSet dstemp = new DataSet(); ConnectionOpen(); //负载和供电柜输入开关关系 DalDEV_SWITCH_TO_LOAD dalloSwitchToLoad = new DalDEV_SWITCH_TO_LOAD(); dalloSwitchToLoad.SetDBAccess(GetDBAccess()); dstemp = dalloSwitchToLoad.GetList("F_LOAD_ID='" + loadId + "'"); if (dstemp != null && dstemp.Tables.Count > 0) { result |= dstemp.Tables[0].Rows.Count > 0; } //负载和下位机关系 DalDEV_LOAD_TO_SUB dalDevLoadToSub = new DalDEV_LOAD_TO_SUB(); dalDevLoadToSub.SetDBAccess(GetDBAccess()); dstemp = dalDevLoadToSub.GetList("F_LOAD_ID='" + loadId + "'"); if (dstemp != null && dstemp.Tables.Count > 0) { result |= dstemp.Tables[0].Rows.Count > 0; } //负载和线圈电源关系 DalDEV_COILPOWER_TO_LOAD dalDevCoilpowerToLoad = new DalDEV_COILPOWER_TO_LOAD(); dalDevCoilpowerToLoad.SetDBAccess(GetDBAccess()); dstemp = dalDevCoilpowerToLoad.GetList("F_LOAD_ID='" + loadId + "'"); if (dstemp != null && dstemp.Tables.Count > 0) { result |= dstemp.Tables[0].Rows.Count > 0; } return(result); } catch (Exception ex) { Log.Error("BllDEV_LOAD_INFO->HasRelation---FAILED", ex); throw ex; } finally { ConnectionClose(); Log.Info("BllDEV_LOAD_INFO->HasRelation---finally"); } }