📄 cuslabelkind_add.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 CusLabelKind_Add : System.Web.UI.Page
{
BasePage bp = null;
protected void Page_Load(object sender, EventArgs e)
{
YXShop.Common.WebUtility.WebControlOnblur(CusLabelKindName);
if (!PowerTree.PowerPass.isPass("011001000", PowerTree.PowerPanel.PowerType.look))
{
bp = new BasePage();
bp.PageError("对不起,你没有查看此页面的权限!", "../index.aspx");
}
if (!IsPostBack)
{
BindData();
}
}
protected void addBtn_Click(object sender, EventArgs e)
{
if (!PowerTree.PowerPass.isPass("011001002", PowerTree.PowerPanel.PowerType.add))
{
bp = new BasePage();
bp.PageError("对不起,你没有添加风格类型的权限!", "../index.aspx");
}
if (!string.IsNullOrEmpty(CusLabelKindName.Text))
{
if (YXShop.TemplateAction.CusLabelDo.CheckLabelKindNameSame("0", CusLabelKindName.Text) != 1)
{
try
{
int result = YXShop.TemplateAction.CusLabelDo.CusLabelKind_Add(CusLabelKindName.Text);
if (result > -1)
{
CusLabelKindName.Text = "";
msg.Text = "<font color='red'>操作提示:添加</font><font color='blue'>" + CusLabelKindName.Text + "</font><font color='red'>标签类型成功!</font>";
}
else
{
CusLabelKindName.Text = "";
msg.Text = "<font color='red'>操作提示:添加</font><font color='blue'>" + CusLabelKindName.Text + "</font><font color='red'>标签类型失败!</font>";
}
}
catch
{
CusLabelKindName.Text = "";
msg.Text = "<font color='red'>操作提示:添加</font><font color='blue'>" + CusLabelKindName.Text + "</font><font color='red'>标签类型成功!</font>";
}
}
else {
msg.Text = "<font color='red'>温馨提示:对不起!该</font><font color='blue'>" + CusLabelKindName.Text + "</font><font color='red'>标签类型名称已经存在,请另换一个!</font>";
}
}
BindData();
}
public void BindData()
{
GridView_LabelKind.DataSource = YXShop.TemplateAction.CusLabelDo.GetLabelKindName();
GridView_LabelKind.DataKeyNames = new string[] { "CusLabelKind_ID" };
GridView_LabelKind.DataBind();
}
protected void GridView_LabelKind_RowEditing(object sender, GridViewEditEventArgs e)
{
if (!PowerTree.PowerPass.isPass("011001004", PowerTree.PowerPanel.PowerType.update))
{
bp = new BasePage();
bp.PageError("对不起,你没有编辑标签类型的权限!", "../index.aspx");
}
GridView_LabelKind.EditIndex = e.NewEditIndex;
BindData();
}
protected void GridView_LabelKind_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
if (!PowerTree.PowerPass.isPass("011001003", PowerTree.PowerPanel.PowerType.del))
{
bp = new BasePage();
bp.PageError("对不起,你没有删除标签类型的权限!", "../index.aspx");
}
else
{
YXShop.TemplateAction.CusLabelDo.DelLabelKindName(GridView_LabelKind.DataKeys[e.RowIndex].Value.ToString());
BindData();
}
}
protected void GridView_LabelKind_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string _name=((TextBox)(GridView_LabelKind.Rows[e.RowIndex].Cells[0].Controls[0])).Text.ToString().Trim();
string _id=GridView_LabelKind.DataKeys[e.RowIndex].Value.ToString();
if (!string.IsNullOrEmpty(_name))
{
if (YXShop.TemplateAction.CusLabelDo.CheckLabelKindNameSame(_id, _name) != 1)
{
YXShop.TemplateAction.CusLabelDo.UpdateLabelKindName(_id, _name);
}
else {
msg.Text = "<font color='red'>温馨提示:对不起!该</font><font color='blue'>" + _name + "</font><font color='red'>标签类型名称已经存在,请另换一个!</font>";
}
}
else
{
msg.Text = "<font color='red'>操作提示:标签类型名称不能修改为空,已还原,修改失败!</font>";
}
GridView_LabelKind.EditIndex = -1;
BindData();
}
protected void GridView_LabelKind_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView_LabelKind.EditIndex = -1;
BindData();
}
protected void GridView_LabelKind_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)
{
((LinkButton)e.Row.Cells[4].Controls[0]).Attributes.Add("onclick", "javascript:return confirm('你确认要删除:\"" + e.Row.Cells[0].Text + "\"吗?此操作将删除所有属于它的用户自定义标签!')");
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -