📄 anonymouscontent.cs
字号:
namespace PowerEasy.WebSite.User.Contents
{
using PowerEasy.Common;
using PowerEasy.CommonModel;
using PowerEasy.Contents;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.Model.CommonModel;
using PowerEasy.Model.Contents;
using PowerEasy.Web.UI;
using System;
using System.Collections.Generic;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class AnonymousContent : DynamicPage
{
protected Button BtnBack;
protected Button BtnSave;
protected DropDownList DropModelId;
protected DropDownList DropNodeId;
protected HtmlForm form1;
protected HtmlHead Head1;
protected Label LblTitle;
protected PowerEasy.Controls.RequiredFieldValidator ValeModelId;
protected PowerEasy.Controls.RequiredFieldValidator ValeNodeId;
protected void BtnBack_Click(object sender, EventArgs e)
{
BasePage.ResponseRedirect("../../Default.aspx");
}
protected void BtnSave_Click(object sender, EventArgs e)
{
if (this.Page.IsValid)
{
int num = DataConverter.CLng(this.DropNodeId.SelectedValue);
int num2 = DataConverter.CLng(this.DropModelId.SelectedValue);
if (num == 0)
{
DynamicPage.WriteErrMsg("<li>您没有指定要匿名投稿的所属栏目</li>");
}
if (num2 == 0)
{
DynamicPage.WriteErrMsg("<li>您没有指定要匿名投稿的所属模型</li>");
}
BasePage.ResponseRedirect("AnonymousContent2.aspx?NodeID=" + num.ToString() + "&ModelID=" + num2.ToString());
}
}
protected void DropNode_SelectedIndexChanged(object sender, EventArgs e)
{
this.SetModelList(DataConverter.CLng(this.DropNodeId.SelectedValue));
}
protected void Page_Load(object sender, EventArgs e)
{
if (!base.IsPostBack)
{
this.DropNodeId.Items.Clear();
IList<NodeInfo> anonymousNodeId = Nodes.GetAnonymousNodeId(-2, OperateCode.NodeContentInput);
if (anonymousNodeId.Count <= 0)
{
DynamicPage.WriteErrMsg("<li>没有允许匿名发表的栏目!</li>");
}
this.DropNodeId.DataSource = anonymousNodeId;
this.DropNodeId.DataBind();
this.SetModelList(DataConverter.CLng(this.DropNodeId.Items[0].Value));
}
}
protected void SetModelList(int nodeId)
{
this.DropModelId.Items.Clear();
foreach (NodesModelTemplateRelationShipInfo info2 in ModelManager.GetNodesModelTemplateList(nodeId))
{
ModelInfo cacheModelById = ModelManager.GetCacheModelById(info2.ModelId);
if (!cacheModelById.IsNull && !cacheModelById.IsEshop)
{
this.DropModelId.Items.Add(new ListItem("添加" + cacheModelById.ItemName + " (" + cacheModelById.ModelName + ")", cacheModelById.ModelId.ToString()));
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -