📄 labelproperty.aspx.cs
字号:
namespace PowerEasy.WebSite.Admin.Template
{
using AjaxControlToolkit;
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Controls;
using PowerEasy.Templates;
using PowerEasy.Web.UI;
using System;
using System.Configuration;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public class LabelProperty : AdminPage
{
private string action;
protected ObjectDataSource AdDataSource;
protected Button BtnASubmit;
protected Button BtnNext;
protected Button BtnPrv;
protected Button BtnSave;
protected GridView GridView1;
private string m_LabelLibPath;
private string m_LabelName;
protected ScriptManager ScriptManager1;
protected ExtendedSiteMapPath SmpNavigator;
protected AjaxControlToolkit.TabPanel TabPanel;
protected AjaxControlToolkit.TabPanel TabPanel1;
protected AjaxControlToolkit.TabPanel TabPanel2;
protected TabContainer Tabs;
protected TextBox TxtAttributeName;
protected TextBox TxtDefaultValue;
protected TextBox TxtIntro;
protected System.Web.UI.UpdatePanel updatepan;
private string xmlfilepath;
protected void BtnASubmit_Click(object sender, EventArgs e)
{
if (LabelManage.AttributeExists(this.xmlfilepath, this.TxtAttributeName.Text) && LabelManage.AddAttribute(this.xmlfilepath, this.TxtAttributeName.Text, this.TxtDefaultValue.Text, this.TxtIntro.Text))
{
this.TxtAttributeName.Text = string.Empty;
this.TxtDefaultValue.Text = string.Empty;
this.TxtIntro.Text = string.Empty;
this.GridView1.DataBind();
}
}
protected void BtnNext_Click(object sender, EventArgs e)
{
switch (XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataType"))
{
case "static":
BasePage.ResponseRedirect("LabelTemplateStatic.aspx?action=" + this.action + "&name=" + base.Server.UrlEncode(this.m_LabelName));
return;
case "sql_sysstoredquery":
BasePage.ResponseRedirect("LabelTemplate.aspx?action=" + this.action + "&name=" + base.Server.UrlEncode(this.m_LabelName));
return;
case "xmlread":
BasePage.ResponseRedirect("LabelTemplate.aspx?action=" + this.action + "&name=" + base.Server.UrlEncode(this.m_LabelName));
return;
}
BasePage.ResponseRedirect("LabelSqlBuild.aspx?action=" + this.action + "&name=" + base.Server.UrlEncode(this.m_LabelName));
}
protected void BtnPrv_Click(object sender, EventArgs e)
{
if (string.Compare(this.action, "modify", true) == 0)
{
BasePage.ResponseRedirect("Label.aspx?name=" + base.Server.UrlEncode(this.m_LabelName));
}
else
{
BasePage.ResponseRedirect("Label.aspx?name=" + DataSecurity.UrlEncode(this.m_LabelName));
}
}
protected void BtnSave_Click(object sender, EventArgs e)
{
try
{
File.Copy(this.xmlfilepath, HttpContext.Current.Server.MapPath(this.m_LabelLibPath) + @"\" + this.m_LabelName + ".config", true);
BasePage.ResponseRedirect("LabelManage.aspx");
}
catch (IOException)
{
AdminPage.WriteErrMsg("没有标签目录或临时目录或标签文件的访问权限!", "LabelManage.aspx");
}
catch (UnauthorizedAccessException)
{
AdminPage.WriteErrMsg("没有标签目录或临时目录或标签文件的访问权限!", "LabelManage.aspx");
}
}
protected void GridView1_RowCommand(object sender, CommandEventArgs e)
{
bool flag = false;
string commandName = e.CommandName;
if (commandName != null)
{
if (!(commandName == "Update"))
{
if (commandName == "Delete")
{
flag = LabelManage.DeleteAttribute(this.xmlfilepath, e.CommandArgument.ToString());
this.AdDataSource.DeleteParameters[0].DefaultValue = this.xmlfilepath;
goto Label_009B;
}
}
else
{
flag = LabelManage.UpdateAttribute(this.xmlfilepath, "", "", "");
this.AdDataSource.UpdateParameters[0].DefaultValue = this.xmlfilepath;
goto Label_009B;
}
}
flag = false;
Label_009B:
if (flag)
{
this.GridView1.DataBind();
}
}
protected void Page_Load(object sender, EventArgs e)
{
this.action = BasePage.RequestString("action");
this.m_LabelName = BasePage.RequestString("name");
this.m_LabelLibPath = "~/" + SiteConfig.SiteOption.LabelDir;
if (string.IsNullOrEmpty(this.m_LabelName))
{
BasePage.ResponseRedirect("Label.aspx");
}
else
{
string path = ConfigurationManager.AppSettings["PowerEasy:LabelXsltPath"];
this.xmlfilepath = HttpContext.Current.Server.MapPath(path) + @"\" + this.m_LabelName + ".config";
if (string.Compare(this.action, "modify", true) == 0)
{
this.BtnSave.Visible = true;
}
this.AdDataSource.SelectParameters[0].DefaultValue = this.xmlfilepath;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -