Пример #1
0
        public List <SysAccountInfoEntity> GetSysAccountInfoList(SysAccountInfoQuery query)
        {
            List <SysAccountInfoEntity> list = new List <SysAccountInfoEntity>();
            StringBuilder sqlCommandText     = new StringBuilder();

            sqlCommandText.Append("SELECT AdminID,UserName,LoginName,Pwd,Gender,Email,Mobile,Status,LastIP,LoginDate,LogOnTimes,AddDate FROM dbo.SysAccountInfo WITH(NOLOCK)");
            string whereSQL = SysAccountInfoQueryToSQLWhere(query);
            string orderBy  = SysAccountInfoQueryToSQLOrder(query);

            if (!string.IsNullOrEmpty(whereSQL))
            {
                sqlCommandText.Append(" WHERE " + whereSQL);
            }
            if (!string.IsNullOrEmpty(orderBy))
            {
                sqlCommandText.Append(" ORDER BY " + orderBy);
            }
            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                list = MakeSysAccountInfoList(dr);
            }
            return(list);
        }
Пример #2
0
        public Pager <SysAccountInfoEntity> GetSysAccountInfoPageList(SysAccountInfoQuery query)
        {
            int     recordCount = 0;
            string  whereSQL    = SysAccountInfoQueryToSQLWhere(query);
            string  orderBy     = SysAccountInfoQueryToSQLOrder(query);
            DataSet ds          = db.GetPagingData("SysAccountInfo", "AdminID,UserName,LoginName,Pwd,Gender,Email,Mobile,Status,LastIP,LoginDate,LogOnTimes,AddDate", orderBy, whereSQL, query.CurrentPage, query.PageSize, out recordCount);
            Pager <SysAccountInfoEntity> pager = new Pager <SysAccountInfoEntity>();

            if (ds != null && ds.Tables.Count > 0)
            {
                pager.ItemList = MakeSysAccountInfoList(ds.Tables[0]);
            }
            pager.CurrentPage  = query.CurrentPage;
            pager.PageSize     = query.PageSize;
            pager.TotalRecords = recordCount;
            return(pager);
        }
Пример #3
0
        /// <summary>
        /// 将查询实体转换为Where语句
        /// <param name="query">查询实体</param>
        /// <returns>获取Where语句,不包含Where</returns>
        /// </summary>
        public string SysAccountInfoQueryToSQLWhere(SysAccountInfoQuery query)
        {
            StringBuilder sbWhere = new StringBuilder(" 1=1 ");

            if (query.Status != null)
            {
                sbWhere.Append(" AND Status= ").Append(query.Status.Value);
            }
            if (!string.IsNullOrEmpty(query.LoginName))
            {
                sbWhere.AppendFormat(" AND LoginName='{0}'", WKT.Common.Security.SecurityUtils.SafeSqlString(query.LoginName));
            }
            if (sbWhere.ToString() == " 1=1 ")
            {
                return(string.Empty);
            }
            else
            {
                return(sbWhere.ToString());
            }
        }
Пример #4
0
 /// <summary>
 /// 将查询实体转换为Order语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Order语句,不包含Order</returns>
 /// </summary>
 public string SysAccountInfoQueryToSQLOrder(SysAccountInfoQuery query)
 {
     return(" AdminID DESC");
 }
Пример #5
0
 /// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="sysAccountInfoQuery">SysAccountInfoQuery查询实体对象</param>
 /// <returns>Pager<SysAccountInfoEntity></returns>
 public Pager <SysAccountInfoEntity> GetSysAccountInfoPageList(SysAccountInfoQuery sysAccountInfoQuery)
 {
     return(SysAccountInfoDataAccess.Instance.GetSysAccountInfoPageList(sysAccountInfoQuery));
 }
Пример #6
0
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="sysAccountInfoQuery">SysAccountInfoQuery查询实体对象</param>
 /// <returns>List<SysAccountInfoEntity></returns>
 public List <SysAccountInfoEntity> GetSysAccountInfoList(SysAccountInfoQuery sysAccountInfoQuery)
 {
     return(SysAccountInfoBusiness.GetSysAccountInfoList(sysAccountInfoQuery));
 }