コード例 #1
0
        /// <summary>
        /// 获得总数
        /// </summary>
        /// <param name="Flag"></param>
        /// <param name="FlagLike"></param>
        /// <param name="UserID"></param>
        /// <param name="StartTime"></param>
        /// <param name="EndTime"></param>
        /// <returns></returns>
        public int GetCount(string Flag, int FlagLike, int UserID, string StartTime, string EndTime)
        {
            string strWhere = "";

            if (Flag != "")
            {
                if (strWhere != "")
                {
                    strWhere += " and ";
                }
                if (FlagLike == 1)
                {
                    strWhere += "Flag like '%" + Utils.SqlStringFormat(Flag, 2) + "%'";
                }
                else
                {
                    strWhere += "Flag ='" + Utils.SqlStringFormat(Flag, 1) + "'";
                }
            }

            if (UserID > 0)
            {
                if (strWhere != "")
                {
                    strWhere += " and ";
                }
                strWhere += "UserID =" + UserID + "";
            }

            if (StartTime != "" & Utils.IsDateTime(StartTime))
            {
                if (strWhere != "")
                {
                    strWhere += " and ";
                }
                strWhere += "CreateTime >='" + Utils.SqlStringFormat(StartTime, 1) + "'";
            }

            if (EndTime != "" & Utils.IsDateTime(EndTime))
            {
                if (strWhere != "")
                {
                    strWhere += " and ";
                }
                strWhere += "CreateTime <='" + Utils.SqlStringFormat(EndTime, 1) + "'";
            }
            DAL.Common db = new DAL.Common();
            return(db.GetCount("AdminLog", strWhere));
        }
コード例 #2
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// <param name="BlockModule">限制模块 0系统 1用户</param>
        /// <param name="BlockType">限制方式 0白名单 1黑名单</param>
        /// <param name="IPstr">当前IP</param>
        /// <returns></returns>
        public bool Exists(int BlockModule, int BlockType, string IPstr)
        {
            long   IP       = Sys.Common.IP.BlockIP.CalcIP(IPstr);
            string strWhere = "BlockModule=" + BlockModule + " and BlockType=" + BlockType + " and (" + IP + " BETWEEN IpStart and IpEnd)";

            DAL.Common db = new DAL.Common();
            if (db.GetCount("SysIpBlock", strWhere) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        /// <summary>
        /// 检查是否重复重名
        /// </summary>
        public bool CheckName(int ID, string Name, int BlockType, int BlockModule)
        {
            string strWhere = "BlockModule=" + BlockModule + " and BlockType=" + BlockType + " and Name='" + Utils.SqlStringFormat(Name, 1) + "'";

            if (ID > 0)
            {
                strWhere += "and ID<>" + ID;
            }
            DAL.Common db = new DAL.Common();
            if (db.GetCount("SysIpBlock", strWhere) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
 /// <summary>
 /// 获得数据总数(使用原则:程序内设定数据,非客户端提交数据。使用前提,保证SQL字符串安全,Utils.SqlStringFormat)
 /// </summary>
 /// <param name="tblName">表的名字</param>
 /// <param name="strWhere">搜索条件</param>
 /// <returns></returns>
 public int GetCount(string tblName, string strWhere)
 {
     return(dal.GetCount(tblName, strWhere));
 }
コード例 #5
0
 /// <summary>
 /// 获得用户总数
 /// </summary>
 public int GetCount(string strWhere)
 {
     DAL.Common db = new DAL.Common();
     return(db.GetCount("Member", strWhere));
 }