📄 label.cs
字号:
}
public DataTable getRuleID()
{
string str_Sql = "Select DISTINCT UnID,(Select top 1 UnName from [" + Pre + "News_unNews] where unid=a.unid order by [rows],id desc) as UnName From " + Pre + "News_unNews a Where 1=1 " + NetCMS.Common.Public.getSessionStr() + "";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
public DataTable getTodayPicID()
{
string str_Sql = "Select NewsID,NewsTitle From " + Pre + "News Where isRecyle=0 And isLock=0 And substring(NewsProperty,9,1)='1' and newspictopline=1 " + NetCMS.Common.Public.getSessionStr() + "";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
public DataTable getfreeJSInfo()
{
string str_Sql = "Select JsID,JSName From " + Pre + "News_JS Where jsType=1 " + NetCMS.Common.Public.getSessionStr() + "";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
public DataTable getsysJSInfo()
{
string str_Sql = "Select JsID,JSName From " + Pre + "News_JS Where jsType=0 " + NetCMS.Common.Public.getSessionStr() + "";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
public DataTable getadsJsInfo()
{
string str_Sql = "Select AdID,adName From " + Pre + "ads Where isLock=0 " + NetCMS.Common.Public.getSessionStr() + "";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
public DataTable getsurveyJSInfo()
{
string str_Sql = "Select TID,Title From " + Pre + "vote_Topic Where 1=1 " + NetCMS.Common.Public.getSessionStr() + "";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
public DataTable getstatJSInfo()
{
string str_Sql = "Select Statid,classname From " + Pre + "stat_class Where 1=1 " + NetCMS.Common.Public.getSessionStr() + "";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
public DataTable getDiscussInfo()
{
string str_Sql = "Select DisID,Cname From " + Pre + "user_Discuss Where 1=1 " + NetCMS.Common.Public.getSessionStr() + "";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
public DataTable getLableList(string SiteID, int intsys)
{
string siteWhere = "";
string topstr = "";
string stringintsys = "";
if (intsys != 1)
{
siteWhere = " and SiteID='" + SiteID + "'";
stringintsys = " and isSys=" + intsys + "";
if (intsys == 2)
{
topstr = "top 20";
stringintsys = " and isSys=0";
}
}
else
{
stringintsys = " and isSys=1";
}
string str_Sql = "Select " + topstr + " Label_Name,Label_Content,Description From " + Pre + "sys_Label Where 1=1 " + siteWhere + " " +
"And isBack=0 And isRecyle=0 " + stringintsys + " Order By CreatTime Desc,id desc";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
public DataTable getfreeLableList()
{
string str_Sql = "Select LabelName,StyleContent From " + Pre + "sys_LabelFree Where SiteID='0' Order By CreatTime Desc,id desc";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
public DataTable getFreeLabelInfo()
{
string str_Sql = "Select LabelName From " + Pre + "sys_LabelFree Where 1=1 " + NetCMS.Common.Public.getSessionStr() + "";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
private SqlParameter[] GetLabelClassParameters(NetCMS.Model.LabelClassInfo lbcc)
{
SqlParameter[] param = new SqlParameter[5];
param[0] = new SqlParameter("@ClassName", SqlDbType.NVarChar, 30);
param[0].Value = lbcc.ClassName;
param[1] = new SqlParameter("@Content", SqlDbType.NVarChar, 200);
param[1].Value = lbcc.Content;
param[2] = new SqlParameter("@CreatTime", SqlDbType.DateTime, 8);
param[2].Value = lbcc.CreatTime;
param[3] = new SqlParameter("@SiteID", SqlDbType.NVarChar, 12);
param[3].Value = lbcc.SiteID;
param[4] = new SqlParameter("@isRecyle", SqlDbType.TinyInt, 1);
param[4].Value = lbcc.isRecyle;
return param;
}
private SqlParameter[] GetLabelParameters(NetCMS.Model.LabelInfo lbc)
{
SqlParameter[] param = new SqlParameter[9];
param[0] = new SqlParameter("@ClassID", SqlDbType.NVarChar, 12);
param[0].Value = lbc.ClassID;
param[1] = new SqlParameter("@Label_Name", SqlDbType.NVarChar, 30);
param[1].Value = lbc.Label_Name;
param[2] = new SqlParameter("@Label_Content", SqlDbType.NText);
param[2].Value = lbc.Label_Content;
param[3] = new SqlParameter("@Description", SqlDbType.NVarChar, 200);
param[3].Value = lbc.Description;
param[4] = new SqlParameter("@CreatTime", SqlDbType.DateTime, 8);
param[4].Value = lbc.CreatTime;
param[5] = new SqlParameter("@isBack", SqlDbType.TinyInt, 1);
param[5].Value = lbc.isBack;
param[6] = new SqlParameter("@isRecyle", SqlDbType.TinyInt, 1);
param[6].Value = lbc.isRecyle;
param[7] = new SqlParameter("@isSys", SqlDbType.TinyInt, 1);
param[7].Value = lbc.isSys;
param[8] = new SqlParameter("@SiteID", SqlDbType.NVarChar, 12);
param[8].Value = lbc.SiteID;
return param;
}
/// <summary>
/// 导出标签获得所有
/// </summary>
/// <returns></returns>
public DataTable outLabelALL(int Num)
{
string sysTF = "";
if (Num != 2) { sysTF = " and isSys=" + Num + ""; }
// else { sysTF = " and isSys=0"; }
string str_Sql = "Select LabelID,ClassID,Label_Name,Label_Content,Description,CreatTime,isSys,SiteID From " + Pre + "sys_Label Where 1=1 " + NetCMS.Common.Public.getSessionStr() + sysTF + "";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
/// <summary>
/// 批量获得导出标签
/// </summary>
/// <param name="LabelID"></param>
/// <returns></returns>
public DataTable outLabelmutile(string LabelID)
{
string _LabelID = LabelID;
if (LabelID.IndexOf(",") > 0) { _LabelID = LabelID.Replace(",", ""); }
string str_Sql = "Select LabelID,ClassID,Label_Name,Label_Content,Description,CreatTime,isSys,SiteID From " + Pre + "sys_Label Where LabelID in ('" + _LabelID + "') " + NetCMS.Common.Public.getSessionStr() + "";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, str_Sql, null);
return dt;
}
/// <summary>
/// 导入标签
/// </summary>
/// <param name="Classid"></param>
/// <param name="Label_Name"></param>
/// <param name="Label_Content"></param>
/// <param name="Description"></param>
/// <param name="isSys"></param>
public void inserLabelLocal(string LabelID, string Classid, string Label_Name, string Label_Content, string Description, string isSystem)
{
string _Label_Name = Label_Name;
string SQLTF = "select ID from " + Pre + "sys_Label where Label_Name ='" + Label_Name.Trim() + "'";
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, SQLTF, null);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
_Label_Name = Label_Name.Replace("}", "_导入的重名标签}");
}
dt.Clear(); dt.Dispose();
}
string _LabelID = LabelID;
string SQLTF1 = "select ID from " + Pre + "sys_Label where LabelID ='" + LabelID + "'";
DataTable dt1 = DbHelper.ExecuteTable(CommandType.Text, SQLTF1, null);
if (dt1 != null&&dt1.Rows.Count > 0)
{
_LabelID = NetCMS.Common.Rand.Number(12, true);
dt1.Clear(); dt1.Dispose();
}
if (isSystem == "1") { Classid = "99999999"; }
string Sql = "insert into " + Pre + "sys_Label (";
Sql += "LabelID,ClassID,Label_Name,Label_Content,Description,CreatTime,isBack,isRecyle,isSys,SiteID";
Sql += ") values (";
Sql += "'" + _LabelID + "','" + Classid + "','" + _Label_Name + "','" + Label_Content + "','" + Description + "','" + DateTime.Now + "',0,0," + int.Parse(isSystem) + ",'" + NetCMS.Global.Current.SiteID + "')";
DbHelper.ExecuteNonQuery(CommandType.Text, Sql, null);
}
public DataTable getLableListM(int Num, string ParentID)
{
string Sql = "";
if (Num == 0)
{
Sql = "select ClassID,ClassCName,ClassEName from " + Pre + "news_class where ParentID='" + ParentID + "' and isLock=0 and isRecyle=0 and isURL=0 and isPage=0 order by OrderID desc,id desc";
}
else
{
Sql = "select SpecialID,specialEName,SpecialCName from " + Pre + "news_special where ParentID='" + ParentID + "' and isLock=0 and isRecyle=0";
}
DataTable dt = DbHelper.ExecuteTable(CommandType.Text, Sql, null);
return dt;
}
public int getClassLabelCount(string ClassID,int num)
{
SqlParameter param = new SqlParameter("@ClassID", ClassID);
string Sql = "";
if (num == 0)
{
Sql = "Select count(id) From " + Pre + "sys_Label Where ClassID=@ClassID and isBack=0 and isRecyle=0 and SiteID='" + NetCMS.Global.Current.SiteID + "'";
}
else
{
Sql = "Select count(id) From " + Pre + "sys_LabelStyle Where ClassID=@ClassID and isRecyle=0 and SiteID='" + NetCMS.Global.Current.SiteID + "'";
}
return Convert.ToInt32(DbHelper.ExecuteScalar(CommandType.Text, Sql, param));
}
public IDataReader GetStyleList(string SiteID)
{
SqlParameter param = new SqlParameter("@SiteID", SiteID);
string sql = "select ClassID,Sname from " + Pre + "sys_styleclass where SiteID=@SiteID and isRecyle=0";
return DbHelper.ExecuteReader(CommandType.Text, sql, param);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -