Beispiel #1
0
        /// <summary>
        /// 加载烟感器的数量
        /// </summary>
        /// <param name="companySysNo"></param>
        /// <returns></returns>
        public static SmokeDetectorCount LoadSmokeDetectorCountInArea(int companySysNo, int?addressId = null)
        {
            string addressCode = string.Empty;

            if (addressId.HasValue)
            {
                var address = AddressDA.LoadAddress(addressId.Value);
                if (address != null)
                {
                    addressCode = address.Code;
                }
            }

            //烟感器按状态分为 三类  在线(除去 离线与未初始化都时在线)  离线(OutNet,Lost,Offline)  未初始化(status is not)
            List <int> offlineStatus = new List <int> {
                (int)SmokeDetectorStatus.Lost, (int)SmokeDetectorStatus.Offline, (int)SmokeDetectorStatus.OutNet
            };

            DataCommand cmd = new DataCommand("LoadSmokeDetectorCountInArea");

            cmd.SetParameter("@CompanySysNo", DbType.Int32, companySysNo);
            cmd.CommandText = cmd.CommandText.Replace("#offlineStatus", string.Join(",", offlineStatus));
            if (!string.IsNullOrWhiteSpace(addressCode))
            {
                cmd.CommandText = cmd.CommandText.Replace("#STRADDRESS#", $" AND AddressCode LIKE '{addressCode}%'");
            }
            else
            {
                cmd.CommandText = cmd.CommandText.Replace("#STRADDRESS#", "");
            }

            SmokeDetectorCount result = cmd.ExecuteEntity <SmokeDetectorCount>();

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 加载用户绑定的烟感器在线&离线数量
        /// </summary>
        /// <param name="companySysNo"></param>
        /// <returns></returns>
        public static SmokeDetectorCount LoadUserSmokeDetectorCount(int clientSysNo)
        {
            DataCommand cmd = new DataCommand("LoadUserSmokeDetectorCount");

            cmd.SetParameter("@ClientSysNo", DbType.Int32, clientSysNo);
            SmokeDetectorCount result = cmd.ExecuteEntity <SmokeDetectorCount>();

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// 加载客户烟感器在线&离线数量
        /// </summary>
        /// <param name="companySysNo"></param>
        /// <returns></returns>
        public static SmokeDetectorCount LoadSmokeDetectorCount(int companySysNo)
        {
            DataCommand cmd = new DataCommand("QuerySmokeDetectorList");

            cmd.SetParameter("@CompanySysNo", DbType.Int32, companySysNo);
            SmokeDetectorCount result = cmd.ExecuteEntity <SmokeDetectorCount>();

            return(result);
        }