📄 label_add.aspx.cs
字号:
//======================================================
//== (c)2008 aspxcms inc by NeTCMS v1.0 ==
//== Forum:bbs.aspxcms.com ==
//== Website:www.aspxcms.com ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NetCMS.Content;
public partial class manage_channel_Label_add : NetCMS.Web.UI.ManagePage
{
public manage_channel_Label_add()
{
this.Authority_Code = "D008";
}
Channel rd = new Channel();
protected void Page_Load(object sender, EventArgs e)
{
string Action = Request.QueryString["Action"];
if (Action != null && Action != string.Empty)
{
this.Authority_Code = "D008";
this.CheckAdminAuthority();
}
if (!IsPostBack)
{
if (SiteID != "0")
{
PageError("分站没权限操作", "javascript:history.back();", true);
}
copyright.InnerHtml = CopyRight;
string ChID = Request.QueryString["ChID"];
if (ChID != string.Empty && ChID != null)
{
string ClassID = Request.QueryString["ClassID"];
int sClassID = 0;
if (ClassID != null && ClassID != string.Empty)
{
sClassID = int.Parse(ClassID.ToString());
}
GetLabelClassList((this.gClassID), 0, 0, sClassID);
if (Action != null && Action != string.Empty)
{
int ID = int.Parse(Request.QueryString["id"]);
IDataReader dr = rd.GetLabelContent(int.Parse(ChID.ToString()), ID);
if (dr.Read())
{
this.LabelName.Text = dr["LabelName"].ToString();
this.GLabelContent.Value = dr["LabelContent"].ToString();
if (dr["islock"].ToString() == "1")
{
this.islock.Checked = true;
}
this.LabelDescript.Text = dr["LabelDescript"].ToString();
}
dr.Close();
}
}
else
{
PageError("错误的频道", "javascript:history.back();", true);
}
}
}
protected void GetLabelClassList(DropDownList lst, int ParentID, int Layer, int sClassID)
{
IDataReader dr = rd.GetLabelClassList(int.Parse(Request.QueryString["ChID"]), ParentID);
while (dr.Read())
{
ListItem it = new ListItem();
it.Value = dr["ID"].ToString();
it.Text = dr["ClassName"].ToString();
if (sClassID == int.Parse(dr["id"].ToString()))
{
it.Selected = true;
}
lst.Items.Add(it);
//GetLabelClassList(lst, int.Parse(dr["ID"].ToString()), (Layer + 1), sClassID);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
int ID = 0;
string GID = Request.QueryString["id"];
if (GID != null && GID != string.Empty)
{
ID = int.Parse(GID.ToString());
}
int ChID = int.Parse(Request.QueryString["ChID"]);
int ClassID = 0;
if (NetCMS.Common.Input.IsInteger(this.gClassID.SelectedValue))
{
ClassID = int.Parse(this.gClassID.SelectedValue);
}
else
{
PageError("为方便管理,请选择标签栏目。", "javascript:history.back();", true);
}
string LabelName = this.LabelName.Text;
if (rd.GetLabelNameTF(ChID, LabelName, ID) > 0)
{
PageError("标签名称已经存在。", "javascript:history.back();", true);
}
string LabelContent = this.GLabelContent.Value;
string LabelDescript = this.LabelDescript.Text;
if (LabelDescript.Length > 200)
{
PageError("标签描述不能超过200个字符。", "javascript:history.back();", true);
}
int isLock = 0;
if (this.islock.Checked)
{
isLock = 1;
}
NetCMS.Model.LabelChContent uc = new NetCMS.Model.LabelChContent();
uc.Id = ID;
uc.ClassID = ClassID;
uc.LabelName = LabelName;
uc.LabelContent = LabelContent;
uc.LabelDescript = LabelDescript;
uc.isLock = isLock;
uc.SiteID = SiteID;
uc.ChID = ChID;
uc.CreatTime = DateTime.Now;
if (ID != 0)
{
//修改
rd.UpdateLabelContent(uc);
PageRight("更新标签成功", "Label_list.aspx?ChID=" + ChID + "&ClassID=" + ClassID + "", true);
}
else
{
//增加
rd.InsertLabelContent(uc);
PageRight("插入标签成功", "Label_list.aspx?ChID=" + ChID + "&ClassID=" + ClassID + "", true);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -