⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userlist.cs

📁 最好用的站点内容管理系统 全部源代码都有
💻 CS
字号:
//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Data;
using System.Data.SqlClient;
using NetCMS.DALFactory;
using NetCMS.Model;
using System.Text.RegularExpressions;
using System.Text;
using System.Reflection;
using NetCMS.DALProfile;
using NetCMS.Config;

namespace NetCMS.DALSQLServer
{
    public class UserList : DbBase, IUserList
    {
        public string getGroupName(string strGroupNumber)
        {
            SqlParameter param = new SqlParameter("@GroupNumber", strGroupNumber);
            string Sql = "select GroupName from " + Pre + "user_Group where GroupNumber=@GroupNumber";
            return Convert.ToString(DbHelper.ExecuteScalar(CommandType.Text, Sql, param));
        }

        public int singdel(int id)
        {
            //删除投稿
            rootPublic pd = new rootPublic();
            string _user = pd.getUidUserNum(id);
            pd.delUserAllInfo(_user);
            string Sql = "delete " + Pre + "sys_user where id = " + id + NetCMS.Common.Public.getSessionStr() + "";
            return DbHelper.ExecuteNonQuery(CommandType.Text, Sql, null);
        }

        public int dels(string id)
        {
            rootPublic pd = new rootPublic();
            string _user = "";
            if (id.IndexOf(",") == -1)
            {
                _user = pd.getUidUserNum(int.Parse(id));
                pd.delUserAllInfo(_user);
            }
            else
            {
                for (int m = 0; m < id.Split(',').Length; m++)
                {
                    _user = pd.getUidUserNum(int.Parse(id.Split(',')[m]));
                    pd.delUserAllInfo(_user);
                }
            }
            string Sql = "delete " + Pre + "sys_user where id in (" + id + ") " + NetCMS.Common.Public.getSessionStr() + "";
            return DbHelper.ExecuteNonQuery(CommandType.Text, Sql, null);
        }

        public int isLock(string id)
        {
            string Sql = "update " + Pre + "sys_user set islock=1 where id in (" + id.Trim() + ") " + NetCMS.Common.Public.getSessionStr() + "";
            return DbHelper.ExecuteNonQuery(CommandType.Text, Sql, null);
        }

        public int unLock(string id)
        {
            string Sql = "update " + Pre + "sys_user set islock=0 where id in (" + id.Trim() + ") " + NetCMS.Common.Public.getSessionStr() + "";
            return DbHelper.ExecuteNonQuery(CommandType.Text, Sql, null);
        }


        public DataTable GroupList()
        {
            string Sql = "select ID,GroupNumber,GroupName from " + Pre + "user_group where SiteID='" + NetCMS.Global.Current.SiteID + "' order by id desc";
            return DbHelper.ExecuteTable(CommandType.Text, Sql, null);
        }

        public int bIpoint(string uid, int sPoint)
        {
            SqlParameter[] param = new SqlParameter[2];
            param[0] = new SqlParameter("@uid", SqlDbType.Int,4);
            param[0].Value =uid;
            param[1] = new SqlParameter("@sPoint", SqlDbType.Int,4);
            param[1].Value =sPoint;
            string Sql = "update " + Pre + "sys_user set iPoint=iPoint+@sPoint where id in (@uid) " + NetCMS.Common.Public.getSessionStr() + "";
            return DbHelper.ExecuteNonQuery(CommandType.Text, Sql, param);
        }

        public int sIpoint(string uid, int sPoint)
        {
            string Sql = "update " + Pre + "sys_user set iPoint=iPoint-" + sPoint + " where id in (" + uid + ") " + NetCMS.Common.Public.getSessionStr() + "";
            return DbHelper.ExecuteNonQuery(CommandType.Text, Sql, null);
        }

        public int bGpoint(string uid, int sPoint)
        {
            string Sql = "update " + Pre + "sys_user set gPoint=gPoint+" + sPoint + " where id in (" + uid + ") " + NetCMS.Common.Public.getSessionStr() + "";
            return DbHelper.ExecuteNonQuery(CommandType.Text, Sql, null);
        }

        public int sGpoint(string uid, int sPoint)
        {
            string Sql = "update " + Pre + "sys_user set gPoint=gPoint-" + sPoint + " where id in (" + uid + ") " + NetCMS.Common.Public.getSessionStr() + "";
            return DbHelper.ExecuteNonQuery(CommandType.Text, Sql, null);
        }

        public DataTable GetPage(string UserName, string RealName, string UserNum, string Sex, string siPoint, string biPoint, string sgPoint, string bgPoint, string _userlock, string _group, string _iscerts, string _SiteID, int PageIndex, int PageSize, out int RecordCount, out int PageCount, params SQLConditionInfo[] SqlCondition)
        {

            string QSQL = "";
            if (UserName != "" && UserName != null) { QSQL = " and UserName like '%" + UserName + "%'"; }
            if (RealName != "" && RealName != null) { QSQL = " and RealName like '%" + RealName + "%'"; }
            if (UserNum != "" && UserNum != null) { QSQL = " and UserNum = '" + UserNum + "'"; }
            if (Sex != "" && Sex != null)
            {
                int _Sex = int.Parse(Sex.ToString());
                QSQL += " and Sex = " + _Sex + "";
            }
            if (siPoint != "" && siPoint != null)
            {
                int _siPoint = int.Parse(siPoint.ToString());
                QSQL += " and iPoint >= " + _siPoint + "";
            }

            if (biPoint != "" && biPoint != null)
            {
                int _biPoint = int.Parse(biPoint.ToString());
                QSQL += " and iPoint <= " + _biPoint + "";
            }

            if (sgPoint != "" && sgPoint != null)
            {
                int _sgPoint = int.Parse(sgPoint.ToString());
                QSQL += " and gPoint >= " + _sgPoint + "";
            }

            if (bgPoint != "" && bgPoint != null)
            {
                int _bgPoint = int.Parse(bgPoint.ToString());
                QSQL += " and gPoint <= " + _bgPoint + "";
            }

            if (_userlock != null && _userlock != "")
            {
                QSQL += " and islock=" + int.Parse(_userlock) + "";
            }

            if (_group != "" && _group != null)
            {
                QSQL += " and UserGroupNumber='" + _group + "'";
            }

            if (_iscerts != "" && _iscerts != null)
            {
                QSQL += " and isIDcard='" + int.Parse(_iscerts) + "'";
            }

            if (_SiteID != "" && _SiteID != null) { QSQL += " and SiteID='" + _SiteID + "'"; }
            else { QSQL += " and SiteID='" + NetCMS.Global.Current.SiteID + "'"; }
            string AllFields = "id,userNum,username,RealName,UserGroupNumber,islock,RegTime,ipoint,gPoint,LastLoginTime,LastIP,isIDcard,isAdmin";
            string Condition = "" + Pre + "sys_user where  1=1 " + QSQL + "";
            string IndexField = "ID";
            string OrderFields = "order by Id Desc";
            return DbHelper.ExecutePage(AllFields, Condition, IndexField, OrderFields, PageIndex, PageSize, out RecordCount, out PageCount, null);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -