📄 usermisc.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 UserMisc : DbBase, IUserMisc
{
public DataTable getSiteList()
{
string Sql = "select ID,ChannelID,CName from " + Pre + "news_site where IsURL=0 and isRecyle=0 and isLock=0 order by id asc";
return DbHelper.ExecuteTable(CommandType.Text, Sql, null);
}
#region 菜单部分
public IDataReader Navilist(string UserNum)
{
string getS = "";
string SQLTF = "select am_ID from " + Pre + "api_Navi where am_position='99999' and siteID='" + NetCMS.Global.Current.SiteID + "' ";
object obj = DbHelper.ExecuteScalar(CommandType.Text, SQLTF, null);
if (obj != null)
{
getS = " and SiteID='" + NetCMS.Global.Current.SiteID + "'";
}
else
{
getS = " and SiteID='0'";
}
string Sql = "select am_ID,am_ClassID,Am_position,am_Name,am_FilePath,am_target,am_type,siteID,userNum,isSys,mainURL From " + Pre + "api_Navi where Am_position='00000' " + getS + " order by am_orderID asc,am_ID desc";
return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
}
public DataTable sel_Misc(string UserNum,int flag)
{
#region
SqlParameter param = new SqlParameter("@UserNum", UserNum);
string Sql = null;
if (flag == 0)
{
Sql = "Select logID,Title,Content,userNum,LogDateTime From " + Pre + "user_userlogs Where (DATEDIFF(d, LogDateTime, getdate())<=datenum) and Usernum=@UserNum and SiteID='" + NetCMS.Global.Current.SiteID + "'";
}
else if (flag == 1)
{
Sql = "Select id,Rec_UserNum From " + Pre + "user_message Where Rec_UserNum=@UserNum and isRead=0 and isRdel=0 and isRecyle=0 order by id desc";
}
else if (flag == 2)
{
Sql = "select UserNum,NickName,RealName,birthday,Userinfo,UserFace,userFacesize,email,UserName,Sex,marriage,UserGroupNumber,iPoint,gPoint,cPoint,ePoint,aPoint,RegTime,OnlineTime,OnlineTF,LoginNumber,Mobile,BindTF,PassQuestion,PassKey,CertType,CertNumber,Email,isOpen,isLock from " + Pre + "sys_User where UserNum=@UserNum";
}
else if (flag == 3)
{
Sql = "select Nation,nativeplace,character,orgSch,job,education,Lastschool,UserFan,UserNum,id from " + Pre + "sys_userfields where UserNum=@UserNum";
}
else if (flag == 4)
{
Sql = "select province,City,Address,Postcode,FaTel,WorkTel,Fax,QQ,MSN,id from " + Pre + "sys_userfields where UserNum=@UserNum " + NetCMS.Common.Public.getSessionStr() + "";
}
else if (flag == 5)
{
Sql = "select GroupNumber from " + Pre + "user_Group where GroupNumber=@UserNum";
}
else if (flag == 6)
{
Sql = "select id from " + Pre + "sys_user where UserGroupNumber=@UserNum";
}
else if (flag == 7)
{
Sql = "Select am_id,api_IdentID,am_ClassID,Am_position,am_Name,Am_Ename,am_FilePath,am_target,am_ParentID,am_type,am_orderID,isSys From " + Pre + "API_Navi where am_ParentID=@UserNum and SiteID='" + NetCMS.Global.Current.SiteID + "' order by am_orderID desc,am_id asc";
}
else if (flag == 8)
{
Sql = "Select am_ClassID From " + Pre + "API_Navi Where am_ClassID=@UserNum and SiteID='" + NetCMS.Global.Current.SiteID + "'";
}
else if (flag == 9)
{
Sql = "Select am_id,api_IdentID,am_ClassID,Am_position,am_Name,Am_Ename,am_FilePath,am_target,am_ParentID,am_type,am_orderID,siteid,isSys From " + Pre + "API_Navi where SiteID='" + NetCMS.Global.Current.SiteID + "' " + UserNum + " order by am_orderID asc,am_ID desc";
}
else if (flag == 10)
{
Sql = "Select am_id,api_IdentID,am_ClassID,Am_position,am_Name,Am_Ename,am_FilePath,am_target,am_ParentID,am_type,am_orderID,isSys,popCode From " + Pre + "API_Navi where am_ParentID=@UserNum and SiteID='" + NetCMS.Global.Current.SiteID + "' order by am_orderID desc,am_id desc";
}
else if (flag == 11)
{
Sql = "Select Id From " + Pre + "API_Qmenu Where QmID=@UserNum";
}
else if (flag == 12)
{
Sql = "select * from " + Pre + "sys_userfields where UserNum=@UserNum";
}
else if (flag == 13)
{
Sql = "select ID,Ccid,cName,Content from " + Pre + "user_ConstrClass where UserNum=@UserNum order by id desc";
}
else if (flag == 14)
{
Sql = "select ID,ClassName from " + Pre + "user_URLClass where UserNum=@UserNum order by id desc";
}
return DbHelper.ExecuteTable(CommandType.Text, Sql, param);
#endregion
}
public IDataReader ShortcutList(string UserNum, int _num)
{
SqlParameter[] param = new SqlParameter[]
{
new SqlParameter("@UserNum", UserNum),
new SqlParameter("@_num", _num)
};
string Sql = "Select id,QMID,qName,FilePath,usernum,siteid From " + Pre + "API_Qmenu where ismanage=@_num and (UserNum=@UserNum or UserNum='0') order by OrderID desc,id desc";
return DbHelper.ExecuteReader(CommandType.Text, Sql, param);
}
public IDataReader menuNavilist(string stype, string UserNum)
{
SqlParameter[] param = new SqlParameter[]{
new SqlParameter("@stype", stype),
new SqlParameter("@UserNum", UserNum)
};
string getS = "";
string SQLTF = "select am_ID from " + Pre + "api_Navi where am_ParentID=@stype and siteID='" + NetCMS.Global.Current.SiteID + "' ";
object obj = DbHelper.ExecuteScalar(CommandType.Text, SQLTF, param);
if (obj != null)
{
getS = " and SiteID='" + NetCMS.Global.Current.SiteID + "'";
}
else
{
getS = " and SiteID='0'";
}
string Sql = "Select am_ID,am_ClassID,Am_position,am_Name,am_FilePath,am_target,am_type,siteID,userNum,isSys,popCode From " + Pre + "api_Navi where am_ParentID=@stype " + getS + " order by am_orderID asc,am_ID desc";
return DbHelper.ExecuteReader(CommandType.Text, Sql, param);
}
/// <summary>
/// 插入菜单新记录
/// </summary>
/// <param name="uc2"></param>
public void addUpdate_manageMenu(NetCMS.Model.UserInfo7 uc2,int flag)
{
#region
string Sql = null;
if (flag == 0)
{
Sql = "insert into " + Pre + "API_Navi (";
Sql += "api_IdentID,am_ClassID,Am_position,am_Name,am_FilePath,am_target,am_ParentID,am_type,am_creatTime,am_orderID,[isSys],siteID,userNum,popCode";
Sql += ") values (";
Sql += "@api_IdentID,@am_ClassID,@Am_position,@am_Name,@am_FilePath,@am_target,@am_ParentID,@am_type,@am_creatTime,@am_orderID,@isSys,'" + NetCMS.Global.Current.SiteID + "',@userNum,@popCode)";
}
else if (flag == 1)
{
Sql = "Update " + Pre + "API_Navi set am_ParentID=@am_ParentID,Am_position=@Am_position,am_Name=@am_Name,am_FilePath=@am_FilePath,am_target=@am_target,am_type=@am_type,am_orderID=@am_orderID,isSys=@isSys,popCode=@popCode where am_ID=" + uc2.am_ID + " " + NetCMS.Common.Public.getSessionStr() + "";
}
else if (flag == 2)
{
Sql = "Update " + Pre + "API_Navi set am_Name=@am_Name,am_orderID=@am_orderID,popCode=@popCode where am_ID=" + uc2.am_ID + " " + NetCMS.Common.Public.getSessionStr() + "";
}
SqlParameter[] parm = InsertManageMenuParameters(uc2);
DbHelper.ExecuteNonQuery(CommandType.Text, Sql, parm);
#endregion
}
/// <summary>
/// 获取UserInfo7构造
/// </summary>
/// <param name="uc1"></param>
/// <returns></returns>
private SqlParameter[] InsertManageMenuParameters(NetCMS.Model.UserInfo7 uc1)
{
#region
SqlParameter[] param = new SqlParameter[15];
param[0] = new SqlParameter("@api_IdentID", SqlDbType.NVarChar, 30);
param[0].Value = uc1.api_IdentID;
param[1] = new SqlParameter("@am_ClassID", SqlDbType.NVarChar, 12);
param[1].Value = uc1.am_ClassID;
param[2] = new SqlParameter("@Am_position", SqlDbType.NVarChar, 5);
param[2].Value = uc1.Am_position;
param[3] = new SqlParameter("@am_Name", SqlDbType.NVarChar, 20);
param[3].Value = uc1.am_Name;
param[4] = new SqlParameter("@am_FilePath", SqlDbType.NVarChar, 200);
param[4].Value = uc1.am_FilePath;
param[5] = new SqlParameter("@am_target", SqlDbType.NVarChar, 20);
param[5].Value = uc1.am_target;
param[6] = new SqlParameter("@am_ParentID", SqlDbType.NVarChar, 12);
param[6].Value = uc1.am_ParentID;
param[7] = new SqlParameter("@am_type", SqlDbType.TinyInt, 1);
param[7].Value = uc1.am_type;
param[8] = new SqlParameter("@am_creatTime", SqlDbType.DateTime, 8);
param[8].Value = uc1.am_creatTime;
param[9] = new SqlParameter("@am_orderID", SqlDbType.Int, 4);
param[9].Value = uc1.am_orderID;
param[10] = new SqlParameter("@isSys", SqlDbType.TinyInt, 1);
param[10].Value = uc1.isSys;
param[11] = new SqlParameter("@siteID", SqlDbType.NVarChar, 12);
param[11].Value = uc1.siteID;
param[12] = new SqlParameter("@userNum", SqlDbType.NVarChar, 12);
param[12].Value = uc1.userNum;
param[13] = new SqlParameter("@am_ID", SqlDbType.Int, 4);
param[13].Value = uc1.am_ID;
param[14] = new SqlParameter("@popCode", SqlDbType.NVarChar, 50);
param[14].Value = uc1.popCode;
return param;
#endregion
}
/// <summary>
/// 获取UserInfo7构造1
/// </summary>
/// <param name="uc1"></param>
/// <returns></returns>
private SqlParameter[] InsertManageMenuParameters1(NetCMS.Model.UserInfo7 uc1)
{
#region
SqlParameter[] param = new SqlParameter[10];
param[0] = new SqlParameter("@Am_position", SqlDbType.NVarChar, 5);
param[0].Value = uc1.Am_position;
param[1] = new SqlParameter("@am_Name", SqlDbType.NVarChar, 20);
param[1].Value = uc1.am_Name;
param[2] = new SqlParameter("@am_FilePath", SqlDbType.NVarChar, 200);
param[2].Value = uc1.am_FilePath;
param[3] = new SqlParameter("@am_target", SqlDbType.NVarChar, 20);
param[3].Value = uc1.am_target;
param[4] = new SqlParameter("@am_ParentID", SqlDbType.NVarChar, 12);
param[4].Value = uc1.am_ParentID;
param[5] = new SqlParameter("@am_type", SqlDbType.TinyInt, 1);
param[5].Value = uc1.am_type;
param[6] = new SqlParameter("@am_orderID", SqlDbType.Int, 4);
param[6].Value = uc1.am_orderID;
param[7] = new SqlParameter("@isSys", SqlDbType.TinyInt, 1);
param[7].Value = uc1.isSys;
param[8] = new SqlParameter("@am_ID", SqlDbType.Int, 4);
param[8].Value = uc1.am_ID;
param[9] = new SqlParameter("@popCode", SqlDbType.NVarChar, 50);
param[9].Value = uc1.popCode;
return param;
#endregion
}
/// <summary>
/// 获取UserInfo7构造2
/// </summary>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -