📄 createhtmlcontent.aspx.cs
字号:
namespace PowerEasy.WebSite.Admin.Contents
{
using PowerEasy.AccessManage;
using PowerEasy.Common;
using PowerEasy.Contents;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.Model.Contents;
using PowerEasy.StaticHtml;
using PowerEasy.Web.UI;
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;
public class CreateHtmlContent : AdminPage
{
protected CompareValidator CompareValidator1;
protected CompareValidator CompareValidator2;
protected DatePicker DpkBeginDate;
protected DatePicker DpkEndDate;
protected Button EBtnAll;
protected Button EBtnAppointId;
protected Button EBtnBoundId;
protected Button EBtnDate;
protected Button EBtnNotCreate;
protected Button EBtnTopNew;
protected ListBox LstNodes;
protected ExtendedSiteMapPath SmpNavigator;
protected TextBox TxtAppointId;
protected TextBox TxtBeginId;
protected TextBox TxtEndId;
protected TextBox TxtTopNew;
protected PowerEasy.Controls.RequiredFieldValidator ValrAppointId;
protected PowerEasy.Controls.RequiredFieldValidator ValrBeginDate;
protected PowerEasy.Controls.RequiredFieldValidator ValrBeginId;
protected PowerEasy.Controls.RequiredFieldValidator ValrEndDate;
protected PowerEasy.Controls.RequiredFieldValidator ValrEndId;
protected PowerEasy.Controls.RequiredFieldValidator ValrTopNew;
protected void EBtnAll_Click(object sender, EventArgs e)
{
if (base.IsValid)
{
HtmlContent content = new HtmlContent();
content.CreateMethod = CreateContentType.CreateAll;
content.NodeIdArray = this.GetCreateHtmlNodesList(this.LstNodes);
content.CommonCreateHtml();
BasePage.ResponseRedirect("CreateHtmlProgress.aspx?workId=" + content.CreateId);
}
}
protected void EBtnAppointId_Click(object sender, EventArgs e)
{
if (base.IsValid)
{
HtmlContent content = new HtmlContent();
content.CreateMethod = CreateContentType.CreateByGeneralId;
content.NodeIdArray = this.GetCreateHtmlNodesList(this.LstNodes);
content.ContentGeneralIdArray = this.TxtAppointId.Text;
content.CommonCreateHtml();
BasePage.ResponseRedirect("CreateHtmlProgress.aspx?workId=" + content.CreateId);
}
}
protected void EBtnBoundId_Click(object sender, EventArgs e)
{
if (base.IsValid)
{
HtmlContent content = new HtmlContent();
content.NodeIdArray = this.GetCreateHtmlNodesList(this.LstNodes);
content.CreateMethod = CreateContentType.CreateBetweenId;
content.ContentMinId = DataConverter.CLng(this.TxtBeginId.Text);
content.ContentMaxId = DataConverter.CLng(this.TxtEndId.Text);
content.CommonCreateHtml();
BasePage.ResponseRedirect("CreateHtmlProgress.aspx?workId=" + content.CreateId);
}
}
protected void EBtnDate_Click(object sender, EventArgs e)
{
if (base.IsValid)
{
HtmlContent content = new HtmlContent();
content.CreateMethod = CreateContentType.CreateByUpdateTime;
content.NodeIdArray = this.GetCreateHtmlNodesList(this.LstNodes);
content.ContentBeginTime = DataConverter.CDate(this.DpkBeginDate.Text);
content.ContentEndTime = DataConverter.CDate(this.DpkEndDate.Text);
content.CommonCreateHtml();
BasePage.ResponseRedirect("CreateHtmlProgress.aspx?workId=" + content.CreateId);
}
}
protected void EBtnNotCreate_Click(object sender, EventArgs e)
{
HtmlContent content = new HtmlContent();
content.CreateMethod = CreateContentType.CreateByNotCreate;
content.NodeIdArray = this.GetCreateHtmlNodesList(this.LstNodes);
content.CommonCreateHtml();
BasePage.ResponseRedirect("CreateHtmlProgress.aspx?workId=" + content.CreateId);
}
protected void EBtnTopNew_Click(object sender, EventArgs e)
{
if (base.IsValid)
{
HtmlContent content = new HtmlContent();
content.CreateMethod = CreateContentType.CreateLatest;
content.NodeIdArray = this.GetCreateHtmlNodesList(this.LstNodes);
content.LatestNumber = DataConverter.CLng(this.TxtTopNew.Text);
content.CommonCreateHtml();
BasePage.ResponseRedirect("CreateHtmlProgress.aspx?workId=" + content.CreateId);
}
}
protected string GetCreateHtmlNodesList(ListControl listName)
{
string str = string.Empty;
for (int i = 0; i < listName.Items.Count; i++)
{
if (listName.Items[i].Selected && !str.Contains(listName.Items[i].Value))
{
NodeInfo cacheNodeById = Nodes.GetCacheNodeById(DataConverter.CLng(listName.Items[i].Value));
if (string.IsNullOrEmpty(str))
{
str = cacheNodeById.ArrChildId + "," + str + ",";
}
else
{
str = str.Replace(cacheNodeById.ArrChildId, "") + "," + cacheNodeById.ArrChildId;
}
}
}
StringBuilder sb = new StringBuilder();
if (!string.IsNullOrEmpty(str))
{
string[] strArray = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
for (int j = 0; j < strArray.Length; j++)
{
NodeInfo info2 = Nodes.GetCacheNodeById(DataConverter.CLng(strArray[j]));
if (info2.IsCreateContentPage && (info2.PurviewType == 0))
{
StringHelper.AppendString(sb, strArray[j], ",");
}
}
}
return sb.ToString();
}
protected void ListDataBind(ListControl listName)
{
IList<NodeInfo> nodeNameForContainerItems = Nodes.GetNodeNameForContainerItems();
listName.Items.Clear();
foreach (NodeInfo info in nodeNameForContainerItems)
{
ListItem item = new ListItem();
item.Text = info.NodeName;
item.Value = info.NodeId.ToString();
if ((info.PurviewType > 0) || !info.IsCreateContentPage)
{
item.Enabled = false;
}
listName.Items.Add(item);
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!this.Page.IsPostBack)
{
RolePermissions.BusinessAccessCheck(OperateCode.CreateHtmlManage);
this.ListDataBind(this.LstNodes);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -