📄 user.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 User : DbBase, IUser
{
public DataTable CheckUser(string UserName, string Pwd)
{
string md5Pwd = NetCMS.Common.Input.MD5(Pwd);
SqlParameter[] param = new SqlParameter[] { new SqlParameter("@UserName", UserName), new SqlParameter("@Pwd", md5Pwd) };
string Sql = "select userName,UserPassword,isAdmin,islock,UserNum,SiteID from " + Pre + "sys_User where UserName=@UserName and UserPassword=@Pwd";
return DbHelper.ExecuteTable(CommandType.Text, Sql, param);
}
public DataTable CheckManage(string UserNum)
{
SqlParameter param = new SqlParameter("@UserNum", UserNum);
string Sql = "select UserNum,isSuper,adminGroupNumber,PopList,OnlyLogin,isChannel,isLock,SiteID,isChSupper,Iplimited,verCode from " + Pre + "sys_admin where UserNum=@UserNum";
return DbHelper.ExecuteTable(CommandType.Text, Sql, param);
}
#region 登陆限制开始
///// <summary>
///// 查找是否有此管理员
///// </summary>
///// <param name="strUserName"></param>
///// <returns></returns>
//public DataTable CheckUserTF(string strUserName)
//{
// string Sql = "select id from " + Pre + "sys_User where UserName='" + UserName + "' and isAdmin=1";
// DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Sql, null);
// return dt;
//}
///// <summary>
///// 开始读取管理员是否有限制
///// </summary>
///// <param name="UserNum"></param>
///// <returns></returns>
//public DataTable readAdminlimit(string UserNum)
//{
// string Sql = "select LimitType from " + Pre + "sys_admin where UserNum='" + UserNum + "'";
// DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Sql, null);
// return dt;
//}
///// <summary>
///// 检查是否有登陆记录
///// </summary>
///// <param name="UserNum"></param>
///// <returns></returns>
//public int loginNumTF(string UserNum)
//{
// int intflg = 0;
// string Sql = "select id from " + Pre + "sys_loginnum where UserNum='" + UserNum + "'";
// DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Sql, null);
// if (dt != null)
// {
// if (dt.Rows.Count > 0){intflg = 1;}
// dt.Clear(); dt.Dispose();
// }
//}
///// <summary>
///// 得到已经登陆的次数。
///// </summary>
///// <param name="UserNum"></param>
///// <returns></returns>
//public int getLoginNum(string UserNum)
//{
// int intflg = 0;
// string Sql = "select loginNum from " + Pre + "sys_loginnum where UserNum='" + UserNum + "'";
// DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Sql, null);
// if (dt != null)
// {
// if (dt.Rows.Count > 0) { intflg = int.Parse(dt.Rows[0]["loginNum"].ToString()); }
// dt.Clear(); dt.Dispose();
// }
//}
///// <summary>
///// 插入登陆记录
///// </summary>
///// <param name="UserNum"></param>
//public void insertLoginNum(string UserNum)
//{
// string Sql = "insert into " + Pre + "sys_loginnum(";
// Sql += "UserNum,loginNum,creatTime";
// Sql += ") values (";
// Sql += "'" + UserNum + "',1,'" + DateTime.Now + "')";
// DbHelper.ExecuteNonQuery(CommandType.Text, Sql, null);
//}
#endregion 登陆限制结束
#region 管理员验证
public int Managestate(string strUserNum)
{
int flg = 1;
if (strUserNum != null)
{
}
return flg;
}
#endregion 管理员验证
#region 日历
public void UserLogsDels(int LId)
{
string Sql = "Delete From " + Pre + "user_userlogs where id=" + LId + " and UserNum = '" + NetCMS.Global.Current.UserNum + "'";
DbHelper.ExecuteNonQuery(CommandType.Text, Sql, null);
}
public DataTable getUserLogsValue(int LID)
{
string Sql = "Select id,title,Content,LogDateTime,dateNum From " + Pre + "user_userlogs Where ID=" + LID + " and UserNum='" + NetCMS.Global.Current.UserNum + "'";
return DbHelper.ExecuteTable(CommandType.Text, Sql, null);
}
public DataTable getUserLogsRecord(string LogID)
{
SqlParameter param = new SqlParameter("@LogID", LogID);
string Sql = "Select logID From " + Pre + "user_userlogs Where logID=@LogID";
return DbHelper.ExecuteTable(CommandType.Text, Sql, param);
}
public DataTable getCountselt(string UserName)
{
SqlParameter param = new SqlParameter("@UserName", UserName);
string Sql = "select count(*) from " + Pre + "user_Requestinformation where bUsername=@UserName";
return DbHelper.ExecuteTable(CommandType.Text, Sql, param);
}
public DataTable getIschick(string UserName)
{
SqlParameter param = new SqlParameter("@UserName", UserName);
string Sql = "select ischick from " + Pre + "User_Requestinformation where bUsername=@UserName";
return DbHelper.ExecuteTable(CommandType.Text, Sql, param);
}
public DataTable isAdminUser(string UserNum)
{
SqlParameter param = new SqlParameter("@UserNum", UserNum);
string Sql = "select isAdmin from " + Pre + "sys_User where UserNum=@UserNum";
return DbHelper.ExecuteTable(CommandType.Text, Sql, param);
}
/// <summary>
/// 则插入新记录日历
/// </summary>
/// <param name="uc2"></param>
public void InsertUserLogs(NetCMS.Model.UserLog1 uc2)
{
string Sql = "insert into " + Pre + "user_userlogs(";
Sql += "LogID,title,content,creatTime,dateNum,LogDateTime,usernum,SiteID";
Sql += ") values (";
Sql += "@LogID,@title,@content,@creatTime,@dateNum,@LogDateTime,@usernum,'" + NetCMS.Global.Current.SiteID + "')";
SqlParameter[] parm = InsertUserLogsParameters(uc2);
DbHelper.ExecuteNonQuery(CommandType.Text, Sql, parm);
}
/// <summary>
/// 获取UserLog1构造
/// </summary>
/// <param name="uc1"></param>
/// <returns></returns>
private SqlParameter[] InsertUserLogsParameters(NetCMS.Model.UserLog1 uc1)
{
SqlParameter[] param = new SqlParameter[8];
param[0] = new SqlParameter("@LogID", SqlDbType.NVarChar, 12);
param[0].Value = uc1.LogID;
param[1] = new SqlParameter("@title", SqlDbType.NVarChar, 50);
param[1].Value = uc1.title;
param[2] = new SqlParameter("@content", SqlDbType.NText);
param[2].Value = uc1.content;
param[3] = new SqlParameter("@creatTime", SqlDbType.DateTime, 8);
param[3].Value = uc1.creatTime;
param[4] = new SqlParameter("@dateNum", SqlDbType.SmallInt, 2);
param[4].Value = uc1.dateNum;
param[5] = new SqlParameter("@LogDateTime", SqlDbType.DateTime, 8);
param[5].Value = uc1.LogDateTime;
param[6] = new SqlParameter("@usernum", SqlDbType.NVarChar, 15);
param[6].Value = uc1.usernum;
param[7] = new SqlParameter("@Id", SqlDbType.Int, 4);
param[7].Value = uc1.Id;
return param;
}
/// <summary>
/// 则更新记录日历
/// </summary>
/// <param name="uc2"></param>
public void UpdateUserLogs(NetCMS.Model.UserLog1 uc2)
{
string Sql = "update " + Pre + "user_userlogs set title=@title,content=@content,dateNum=@dateNum,LogDateTime=@LogDateTime where Id=" + uc2.Id + " and userNum='" + NetCMS.Global.Current.UserNum + "' and SiteID='" + NetCMS.Global.Current.SiteID + "'";
SqlParameter[] parm = UpdateUserLogsParameters(uc2);
DbHelper.ExecuteNonQuery(CommandType.Text, Sql, parm);
}
/// <summary>
/// 获取UserLog1构造
/// </summary>
/// <param name="uc1"></param>
/// <returns></returns>
private SqlParameter[] UpdateUserLogsParameters(NetCMS.Model.UserLog1 uc1)
{
SqlParameter[] param = new SqlParameter[5];
param[0] = new SqlParameter("@title", SqlDbType.NVarChar, 50);
param[0].Value = uc1.title;
param[1] = new SqlParameter("@content", SqlDbType.NText);
param[1].Value = uc1.content;
param[2] = new SqlParameter("@dateNum", SqlDbType.SmallInt, 2);
param[2].Value = uc1.dateNum;
param[3] = new SqlParameter("@LogDateTime", SqlDbType.DateTime, 8);
param[3].Value = uc1.LogDateTime;
param[4] = new SqlParameter("@Id", SqlDbType.Int, 4);
param[4].Value = uc1.Id;
return param;
}
#endregion 日历
#region 会员好友添加检查
public DataTable sel_isAdmin(string UserNum)
{
SqlParameter param = new SqlParameter("@UserNum", UserNum);
string selectUserName = "select isAdmin from " + Pre + "sys_User where UserNum=@UserNum";
return DbHelper.ExecuteTable(CommandType.Text, selectUserName, param);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -