📄 rootpublic.cs
字号:
param[0].Value = num;
param[1] = new SqlParameter("@_num", SqlDbType.Int, 4);
param[1].Value = _num;
param[2] = new SqlParameter("@UserNum", SqlDbType.NVarChar, 15);
param[2].Value = UserNum;
param[3] = new SqlParameter("@Title", SqlDbType.NVarChar, 50);
param[3].Value = Title;
param[4] = new SqlParameter("@Content", SqlDbType.NText);
param[4].Value = Content;
//string _UserNum = UserNum.Replace("'", "‘");
//string _Title = Title.Replace("'", "‘");
//string _Content = Content.Replace("'", "‘");
string Sql = "insert into " + Pre + "sys_logs (";
Sql += "title,content,creatTime,IP,usernum,SiteID,ismanage";
Sql += ") values (";
Sql += "@Title,@Content,'" + System.DateTime.Now + "','" + NetCMS.Common.Public.getUserIP() + "',@UserNum,'0',@_num )";
DbHelper.ExecuteNonQuery(cn, CommandType.Text, Sql, param);
if (num == 1)
{
NetCMS.Common.Public.saveLogFiles(_num, UserNum, Title, Content);
}
}
/// <summary>
/// 得到会员组DataTable
/// </summary>
/// <returns></returns>
public IDataReader GetGroupList()
{
string Sql = "select id,GroupNumber,GroupName from " + Pre + "user_Group where SiteID='" + NetCMS.Global.Current.SiteID + "'";
return DbHelper.ExecuteReader(CommandType.Text, Sql, null);
}
/// <summary>
/// 得到帮助ID
/// </summary>
/// <param name="helpId"></param>
/// <returns></returns>
public DataTable GetHelpId(string helpId)
{
SqlParameter param = new SqlParameter("@helpId", helpId);
string Sql = "Select TitleCN,ContentCN From "+ Pre +"sys_Help where HelpID=@helpId";
DataTable rdr = DbHelper.ExecuteTable(DBConfig.HelpConString, CommandType.Text, Sql, param);
return rdr;
}
/// <summary>
/// 得到站点列表
/// </summary>
/// <returns></returns>
public DataTable GetselectNewsList()
{
string Sql = "Select id,ChannelID,ParentID,CName from " + Pre + "news_site where isRecyle=0 and isLock=0 and IsURL =0 and ParentID='" + NetCMS.Global.Current.SiteID + "' order by id desc";
DataTable rdr = DbHelper.ExecuteTable(CommandType.Text, Sql, null);
return rdr;
}
/// <summary>
/// 得到标签风格
/// </summary>
/// <returns></returns>
public DataTable GetselectLabelList()
{
string Sql = "Select id,ClassID,Sname,(Select Count(id) from " + Pre + "sys_LabelStyle where a.ClassId=ClassID and isRecyle=0 and siteID='" + NetCMS.Global.Current.SiteID + "') as HasSub from " + Pre + "sys_styleclass a where isRecyle=0 and siteID='" + NetCMS.Global.Current.SiteID + "' order by id desc";
DataTable rdr = DbHelper.ExecuteTable(CommandType.Text, Sql, null);
return rdr;
}
/// <summary>
/// 得到标签风格
/// </summary>
/// <param name="ClassID"></param>
/// <returns></returns>
public DataTable GetselectLabelList1(string ClassID)
{
SqlParameter param = new SqlParameter("@ClassID", ClassID);
string Sql = "select ID,styleID,ClassID,StyleName,Description,Content from " + Pre + "sys_LabelStyle where ClassId=@ClassID and siteID='" + NetCMS.Global.Current.SiteID + "' order by id desc";
DataTable rdr = DbHelper.ExecuteTable(CommandType.Text, Sql, param);
return rdr;
}
/// <summary>
/// 得到栏目
/// </summary>
/// <param name="ParentId"></param>
/// <returns></returns>
public IDataReader GetajaxsNewsList(string ParentId)
{
SqlParameter param = new SqlParameter("@ParentId", ParentId);
string Sql = "Select ClassID,ClassCName,(Select Count(id) from " + Pre + "news_Class where ParentID=a.ClassID and isRecyle=0 and isUrl=0 and isPage=0 and islock=0) as HasSub from " + Pre + "news_Class a where ParentID=@ParentId and isRecyle=0 and isUrl=0 and SiteID='" + NetCMS.Global.Current.SiteID + "' and isPage=0 and islock=0 order by OrderID desc,id desc";
return DbHelper.ExecuteReader(CommandType.Text, Sql, param);
}
/// <summary>
/// 根据栏目得到SiteID
/// </summary>
/// <param name="ClassID"></param>
/// <returns></returns>
public string getSiteIDFromClass(string ClassID)
{
string SiteID = "0";
SqlParameter param = new SqlParameter("@ClassID", ClassID);
string Sql = "Select SiteID from " + Pre + "news_Class where ClassID=@ClassID";
DataTable rdr = DbHelper.ExecuteTable(CommandType.Text, Sql, param);
if (rdr != null && rdr.Rows.Count > 0)
{
SiteID = rdr.Rows[0]["SiteID"].ToString();
rdr.Clear(); rdr.Dispose();
}
return SiteID;
}
/// <summary>
/// 得到新闻表
/// </summary>
/// <returns></returns>
public DataTable getNewsTableIndex()
{
string Sql = "select TableName from " + Pre + "sys_NewsIndex";
DataTable rdr = DbHelper.ExecuteTable(CommandType.Text, Sql, null);
return rdr;
}
/// <summary>
/// 得到专题列表
/// </summary>
/// <param name="ParentId"></param>
/// <returns></returns>
public IDataReader GetajaxsspecialList(string ParentId)
{
SqlParameter param = new SqlParameter("@ParentId", ParentId);
string Sql = "Select SpecialID,SpecialCName,(Select Count(id) from " + Pre + "news_special where ParentID=a.SpecialID and isRecyle=0) as HasSub from " + Pre + "news_special a where ParentID=@ParentId and isRecyle=0 and SiteID='" + NetCMS.Global.Current.SiteID + "' order by id desc";
return DbHelper.ExecuteReader(CommandType.Text, Sql, param);
}
/// <summary>
/// 得到栏目列表
/// </summary>
/// <param name="ParentID"></param>
/// <returns></returns>
public DataTable getClassListPublic(string ParentID)
{
SqlParameter param = new SqlParameter("@ParentID", ParentID);
string Sql = "Select ClassID,ClassCName,ParentID from " + Pre + "news_class where isURL=0 and isLock=0 and isRecyle=0 and isPage!=1 and ParentID=@ParentID and SiteID ='" + NetCMS.Global.Current.SiteID + "' order by OrderID desc,Id desc";
DataTable rdr = DbHelper.ExecuteTable(CommandType.Text, Sql, param);
return rdr;
}
/// <summary>
/// 得到专题列表
/// </summary>
/// <param name="ParentID"></param>
/// <returns></returns>
public DataTable getSpecialListPublic(string ParentID)
{
SqlParameter param = new SqlParameter("@ParentID", ParentID);
string Sql = "Select SpecialID,SpecialCName,ParentID from " + Pre + "news_special where isLock=0 and isRecyle=0 and ParentID=@ParentID and SiteID ='" + NetCMS.Global.Current.SiteID + "' order by Id desc";
DataTable rdr = DbHelper.ExecuteTable(CommandType.Text, Sql, param);
return rdr;
}
public DataTable getUploadInfo()
{
string Sql = "Select UpfilesType,UpFilesSize From " + Pre + "sys_param";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Sql, null);
return dt;
}
public DataTable getGroupUpInfo(string UserNum)
{
string UserGroupNumber = "0";
SqlParameter param = new SqlParameter("@UserNum", UserNum);
string USQL = "select UserGroupNumber from " + Pre + "sys_User where UserNum=@UserNum";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, USQL, param);
if (dt != null && dt.Rows.Count > 0)
{
UserGroupNumber = dt.Rows[0]["UserGroupNumber"].ToString();
dt.Clear(); dt.Dispose();
}
SqlParameter paramType = new SqlParameter("@UserGroupNumber", UserGroupNumber);
string Sql = "select upfileType,upfileSize from " + Pre + "user_Group where GroupNumber=@UserGroupNumber";
return DbHelper.ExecuteTable(CommandType.Text, Sql, paramType);
}
/// <summary>
/// 得到站点中文名称
/// </summary>
/// <param name="SiteID">传入的站点编号</param>
/// <returns>站点名称</returns>
public string getChName(string SiteID)
{
string _Str = "";
SqlParameter param = new SqlParameter("@SiteID", SiteID);
string SQL = "select CName from " + Pre + "news_site where ChannelID=@SiteID";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, SQL, param);
if (dt != null && dt.Rows.Count > 0)
{
_Str = dt.Rows[0]["CName"].ToString();
}
return _Str;
}
public string getResultPage(string _Content, DateTime _DateTime, string ClassID, string EName)
{
string _Str = "";
if (_Content != string.Empty)
{
_Str = _Content.ToLower();
string year02 = ((_DateTime.Year).ToString()).PadRight(2);
string year04 = (_DateTime.Year).ToString();
string month = (_DateTime.Month).ToString();
string day = (_DateTime.Day).ToString();
string hour = (_DateTime.Hour).ToString();
string minute = (_DateTime.Minute).ToString();
string second = (_DateTime.Second).ToString();
_Str = _Str.Replace("{@year02}", year02);
_Str = _Str.Replace("{@year04}", year04);
_Str = _Str.Replace("{@month}", month);
_Str = _Str.Replace("{@day}", day);
_Str = _Str.Replace("{@second}", second);
_Str = _Str.Replace("{@minute}", minute);
_Str = _Str.Replace("{@hour}", hour);
if (ClassID == "0") { _Str = _Str.Replace("{@ename}", EName); }
else { _Str = _Str.Replace("{@ename}", getClassEName(ClassID)); }
if (_Str.IndexOf("{@ram", 0) != -1)
{
for (int i = 0; i <= 9; i++)
{
_Str = _Str.Replace("{@ram" + i + "_0}", NetCMS.Common.Rand.Number(i));
_Str = _Str.Replace("{@ram" + i + "_1}", NetCMS.Common.Rand.Str_char(i));
_Str = _Str.Replace("{@ram" + i + "_2}", NetCMS.Common.Rand.Str(i));
}
}
}
return _Str;
}
/// <summary>
/// 得到英文名称
/// </summary>
/// <param name="ClassID"></param>
/// <returns></returns>
public string getClassEName(string ClassID)
{
string _STR = "";
SqlParameter param = new SqlParameter("@ClassID", ClassID);
string Sql = "Select ClassEName From " + Pre + "news_class where ClassID=@ClassID and SiteID ='" + NetCMS.Global.Current.SiteID + "'";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Sql, param);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
_STR = dt.Rows[0]["ClassEName"].ToString();
}
dt.Clear(); dt.Dispose();
}
return _STR;
}
#region 用户登陆
public int getUserLoginCode()
{
string Sql = "Select UserLoginCodeTF From " + Pre + "sys_PramUser";
object obj = DbHelper.ExecuteScalar(CommandType.Text, Sql, null);
if (obj == null || obj == DBNull.Value)
{
return 0;
}
else
{
return Convert.ToInt32(obj);
}
}
/// <summary>
/// 得到会员用户积分和G币
/// </summary>
/// <param name="UserNum"></param>
/// <returns></returns>
public string getGIPoint(string UserNum)
{
string flg = "0|0";
SqlParameter param = new SqlParameter("@UserNum", UserNum);
string Sql = "Select iPoint,gPoint From " + Pre + "sys_User where UserNum=@UserNum";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Sql, param);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
flg = dt.Rows[0]["iPoint"].ToString() + "|" + dt.Rows[0]["gPoint"].ToString();
}
dt.Clear(); dt.Dispose();
}
return flg;
}
/// <summary>
/// 得到魅力值
/// </summary>
/// <param name="UserNum"></param>
/// <returns></returns>
public int getcPoint(string UserNum)
{
int flg = 0;
SqlParameter param = new SqlParameter("@UserNum", UserNum);
string Sql = "Select cPoint From " + Pre + "sys_User where UserNum=@UserNum";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Sql, param);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
flg = int.Parse(dt.Rows[0]["cPoint"].ToString());
}
dt.Clear(); dt.Dispose();
}
return flg;
}
/// <summary>
/// 得到用户是否允许签名
/// </summary>
/// <param name="UserNum"></param>
/// <returns></returns>
public int getUserUserInfo(string UserNum)
{
int intflg = 0;
string UserGroupNumber = "";
SqlParameter param = new SqlParameter("@UserNum", UserNum);
string Usql = "select UserGroupNumber from " + Pre + "sys_User where UserNum=@UserNum";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Usql, param);
if (dt != null && dt.Rows.Count > 0)
{
UserGroupNumber = dt.Rows[0]["UserGroupNumber"].ToString();
dt.Clear(); dt.Dispose();
}
SqlParameter paramGroup = new SqlParameter("@UserGroupNumber", UserGroupNumber);
string SQL = "select CharTF from " + Pre + "user_Group where GroupNumber=@UserGroupNumber";
DataTable dts = DbHelper.ExecuteTable(CommandType.Text, SQL, paramGroup);
if (dts != null && dts.Rows.Count > 0)
{
intflg = int.Parse(dts.Rows[0]["CharTF"].ToString());
dts.Clear(); dts.Dispose();
}
return intflg;
}
#endregion 用户登陆
#region 删除所有用户信息
public void delUserAllInfo(string UserNum)
{
//删除投稿
SqlParameter param = new SqlParameter("@UserNum", UserNum);
string consql = "delete " + Pre + "user_Constr where UserNum = @UserNum and SiteID='" + NetCMS.Global.Current.SiteID + "'";
DbHelper.ExecuteNonQuery(CommandType.Text, consql, param);
//投稿分类
SqlParameter paramClass = new SqlParameter("@UserNum", UserNum);
string concsql = "delete " + Pre + "user_ConstrClass where UserNum = @UserNum";
DbHelper.ExecuteNonQuery(CommandType.Text, concsql, paramClass);
//支付记录
SqlParameter paramPay = new SqlParameter("@UserNum", UserNum);
string constrPaysql = "delete " + Pre + "user_constrPay where UserNum =@UserNum";
DbHelper.ExecuteNonQuery(CommandType.Text, constrPaysql, paramPay);
}
#endregion
#region 删除所有的频道资料
public void delSiteAllInfo(string SiteID)
{
}
#endregion 删除所有的频道资料
#region 删除所有的新闻/静态文件
public void delNewsAllInfo(string SiteID)
{
}
#endregion 删除所有的新闻
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -