📄 contentbatchmodfiy.aspx.cs
字号:
namespace PowerEasy.WebSite.Admin.Contents
{
using PowerEasy.Common;
using PowerEasy.CommonModel;
using PowerEasy.Contents;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.Web.UI;
using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
public class ContentBatchModfiy : AdminPage
{
protected Button BtnBatch;
protected DropDownList DropModel;
protected ListBox ListModelField;
protected ListBox ListNode;
protected ScriptManager ScriptManageContent;
protected ExtendedSiteMapPath SmpNavigator;
protected TextBox TxtNewContent;
protected TextBox TxtTargetContent;
protected PowerEasy.Controls.RequiredFieldValidator ValrNodeName;
protected void BtnBatch_Click(object sender, EventArgs e)
{
string str = base.Request.Form["ctl00$CphContent$ListModelField"];
int modelId = DataConverter.CLng(this.DropModel.SelectedValue);
string nodeIds = base.Request.Form["ctl00$CphContent$ListNode"];
string oldValue = this.TxtTargetContent.Text.Trim();
string text = this.TxtNewContent.Text;
if (string.IsNullOrEmpty(str))
{
AdminPage.WriteErrMsg("请选择要替换的字段!", "ContentBatchModfiy.aspx");
}
DataSet contentList = ContentManage.GetContentList(modelId, nodeIds);
string[] strArray = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (DataRow row in contentList.Tables[0].Rows)
{
foreach (string str5 in strArray)
{
string str6 = row[str5].ToString().Replace(oldValue, text);
row[str5] = str6;
}
}
ContentManage.UpdateDataSet(contentList, modelId);
AdminPage.WriteSuccessMsg("替换成功!", "ContentManage.aspx");
}
private void InitControl()
{
this.ListNode.DataSource = PowerEasy.Contents.Nodes.GetNodesList(NodeType.Container);
this.ListNode.DataTextField = "NodeName";
this.ListNode.DataValueField = "NodeId";
this.ListNode.DataBind();
this.DropModel.DataSource = ModelManager.GetModelList(ModelType.Content, ModelShowType.Enable);
this.DropModel.DataTextField = "ModelName";
this.DropModel.DataValueField = "ModelId";
this.DropModel.DataBind();
this.DropModel.Attributes.Add("onchange", "GetServices(this.options[this.options.selectedIndex].value)");
}
protected void Page_Load(object sender, EventArgs e)
{
if (!base.IsPostBack)
{
this.InitControl();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -