📄 mo_modicuslabel.aspx.cs
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Shop.Web.UI;
namespace YXShop.Web.Admin.Templates
{
public partial class Mo_ModiCusLabel : System.Web.UI.Page
{
public string LabelId = "";
public string LabelName = "";
BasePage bp = null;
protected void Page_Load(object sender, EventArgs e)
{
if (!PowerTree.PowerPass.isPass("011002004", PowerTree.PowerPanel.PowerType.update))
{
bp = new BasePage();
bp.PageError("对不起,你没有修改自定义标签的权限!", "../index.aspx");
}
YXShop.Common.WebUtility.WebControlOnblur(CusLabelName);
if (!IsPostBack)
{ BindData();
if (!string.IsNullOrEmpty(Request["LabelID"]))
{
msgDiv.Visible = false;
LabelId = Request["LabelID"];
DataBind(Request["LabelID"]);
}
else
{
msgDiv.Visible = true;
}
}
}
public void BindData()
{
Tp_List_Bind();
if (TP_List.Items.Count <= 0)
{
TP_List.Visible = false;
msgkind.Text = "请[<a href='Mo_Add.aspx' style='color:red'>添加模板方案</a>]";
msgbtn.Text = "温馨提示:当前暂无任何模板方案!请先[<a href='Mo_Add.aspx' style='color:red'>添加模板方案</a>]后再添加模板";
}
}
public void Tp_List_Bind()
{
TP_List.DataSource = YXShop.TemplateAction.TemplateDo.GetTemplateList();
TP_List.DataTextField = "TP_Name";
TP_List.DataValueField = "TP_ID";
TP_List.DataBind();
}
public void DataBind(string _id)
{
if (!string.IsNullOrEmpty(_id))
{
DataBindLabelKind();
DataSet ds = new DataSet();
try
{
ds = YXShop.TemplateAction.CusLabelDo.GetCusLabel(_id);
if (ds.Tables[0].Rows.Count > 0)
{
DataRow row = ds.Tables[0].Rows[0];
try
{
CusLabelName.Text = row["CusLabel_Name"].ToString().Replace("{@YX_", "").Replace("}", "");
LabelName = row["CusLabel_Name"].ToString();
}
catch { }
CusLabelDes.Text = row["CusLabel_Des"].ToString();
CusLabelKind.SelectedValue = row["CusLabel_Kind"].ToString();
CusLabelContent.Text = row["CusLabel_Content"].ToString();
TP_List.SelectedValue = row["CusLabel_Colour"].ToString();
}
}
catch { }
}
}
public void DataBindLabelKind()
{
try
{
CusLabelKind.DataSource = YXShop.TemplateAction.CusLabelDo.GetLabelKindName();
CusLabelKind.DataTextField = "CusLabelKind_Name";
CusLabelKind.DataValueField = "CusLabelKind_ID";
CusLabelKind.DataBind();
}
catch { }
if (CusLabelKind.Items.Count <= 0)
{
msgDiv.Visible = true;
}
else
{
msgDiv.Visible = false;
}
}
protected void modiBtn_Click(object sender, EventArgs e)
{
try
{
if (!string.IsNullOrEmpty(Request["LabelID"]))
{
if (CusLabelKind.Items.Count > 0)
{
if ((!string.IsNullOrEmpty(CusLabelName.Text)) && (!string.IsNullOrEmpty(CusLabelContent.Text)))
{
if (YXShop.TemplateAction.CusLabelDo.CheckLabelNameSame(Request["LabelID"], "{@YX_" + CusLabelName.Text + "}") != 1)
{
int result = YXShop.TemplateAction.CusLabelDo.UpdateCusLabel(Request["LabelID"], "{@YX_" + CusLabelName.Text + "}", CusLabelKind.SelectedValue, CusLabelDes.Text, CusLabelContent.Text,Convert.ToInt32(TP_List.SelectedValue));
if (result > -1)
{
msg.Text = "<font color='red'>操作提示:修改</font><font color='blue'>{@YX_" + CusLabelName.Text + "}</font><font color='red'>用户自定义标签成功!</font>";
}
else
{
msg.Text = "<font color='red'>操作提示:修改</font><font color='blue'>{@YX_" + CusLabelName.Text + "}</font><font color='red'>用户自定义标签失败!</font>";
}
}
else
{
msg.Text = "<font color='red'>温馨提示:对不起!你所修改的</font><font color='blue'>{@YX_" + CusLabelName.Text + "}</font><font color='red'>用户自定义标签名称已经存在,请另换一个!</font>";
}
}
}
}
}
catch { }
}
protected void viewBtn_Click(object sender, EventArgs e)
{
Server.Transfer("Mo_ViewModiCusLabel.aspx");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -