示例#1
0
        public static BannedIP Load(Int32 bannedIPId, bool useCache)
        {
            if (bannedIPId == 0)
            {
                return(null);
            }
            BannedIP bannedIP = null;
            string   key      = "BannedIP_" + bannedIPId.ToString();

            if (useCache)
            {
                bannedIP = ContextCache.GetObject(key) as BannedIP;
                if (bannedIP != null)
                {
                    return(bannedIP);
                }
            }
            bannedIP = new BannedIP();
            if (bannedIP.Load(bannedIPId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, bannedIP);
                }
                return(bannedIP);
            }
            return(null);
        }
示例#2
0
        public static bool Delete(Int32 bannedIPId)
        {
            BannedIP bannedIP = new BannedIP();

            if (bannedIP.Load(bannedIPId))
            {
                return(bannedIP.Delete());
            }
            return(false);
        }