コード例 #1
0
        /// <summary>
        /// 判断负载电源是否和其他设备有关系
        /// </summary>
        /// <param name="loadpowerId">负载电源id</param>
        /// <returns></returns>
        public bool HasRelation(string loadpowerId)
        {
            try
            {
                Log.Info("BllDEV_LOADPOWER_INFO->HasRelation---START");

                bool result = false;

                //声明一个变量
                DataSet dstemp = new DataSet();

                ConnectionOpen();

                //负载电源和供电柜输入开关关系
                DalDEV_LOADPOW_TO_SWITCH dalDevLoadpowToSwitch = new DalDEV_LOADPOW_TO_SWITCH();

                dalDevLoadpowToSwitch.SetDBAccess(GetDBAccess());


                dstemp = dalDevLoadpowToSwitch.GetList("F_LOADPOWER_ID='" + loadpowerId + "'");

                if (dstemp != null && dstemp.Tables.Count > 0)
                {
                    result |= dstemp.Tables[0].Rows.Count > 0;
                }



                return(result);
            }
            catch (Exception ex)
            {
                Log.Error("BllDEV_LOADPOWER_INFO->HasRelation---FAILED", ex);
                throw ex;
            }
            finally
            {
                ConnectionClose();
                Log.Info("BllDEV_LOADPOWER_INFO->HasRelation---finally");
            }
        }
コード例 #2
0
        /// <summary>
        /// 判断供电柜开关是否和其他设备有关系
        /// </summary>
        /// <param name="powerId"></param>
        /// <param name="switchId">供电柜开关编号</param>
        /// <returns></returns>
        public bool HasRelation(string powerId, string switchId)
        {
            try
            {
                Log.Info("BllDEV_POWER_SWITCH->HasRelation---START");

                bool result = false;

                //声明一个变量
                DataSet dstemp = new DataSet();

                ConnectionOpen();

                //供电柜输入输出关系
                DalDEV_SWITCH_INOUT dalDevSwitchInout = new DalDEV_SWITCH_INOUT();

                dalDevSwitchInout.SetDBAccess(GetDBAccess());


                dstemp = dalDevSwitchInout.GetList("F_POWER_ID='" + powerId + "' AND (F_POWER_SWITCH_ID_IN='" + switchId + "' OR F_POWER_SWITCH_ID_OUT='" + switchId + "')");

                if (dstemp != null && dstemp.Tables.Count > 0)
                {
                    result |= dstemp.Tables[0].Rows.Count > 0;
                }

                //供电柜输入开关与负载电源柜关系
                DalDEV_LOADPOW_TO_SWITCH dalDevLoadpowToSwitch = new DalDEV_LOADPOW_TO_SWITCH();

                dalDevLoadpowToSwitch.SetDBAccess(GetDBAccess());


                dstemp = dalDevLoadpowToSwitch.GetList("F_POWER_ID='" + powerId + "' AND F_POWER_SWITCH_ID='" + switchId + "'");

                if (dstemp != null && dstemp.Tables.Count > 0)
                {
                    result |= dstemp.Tables[0].Rows.Count > 0;
                }

                //供电柜输出开关与负载柜关系
                DalDEV_SWITCH_TO_LOAD dalDevSwitchToLoad = new DalDEV_SWITCH_TO_LOAD();

                dalDevSwitchToLoad.SetDBAccess(GetDBAccess());


                dstemp = dalDevSwitchToLoad.GetList("F_POWER_ID='" + powerId + "' AND F_POWER_SWITCH_ID='" + switchId + "'");

                if (dstemp != null && dstemp.Tables.Count > 0)
                {
                    result |= dstemp.Tables[0].Rows.Count > 0;
                }


                return(result);
            }
            catch (Exception ex)
            {
                Log.Error("BllDEV_POWER_SWITCH->HasRelation---FAILED", ex);
                throw ex;
            }
            finally
            {
                ConnectionClose();
                Log.Info("BllDEV_POWER_SWITCH->HasRelation---finally");
            }
        }