📄 proproperty.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 System.Collections.Generic;
using Shop.Web.UI;
namespace YXShop.Web.Admin.Product
{
public partial class ProProperty : System.Web.UI.Page
{
YXShop.Model.YXShop_ProProperty model = new YXShop.Model.YXShop_ProProperty();
YXShop.BLL.YXShop_ProProperty BLL = new YXShop.BLL.YXShop_ProProperty();
public string ProP_Type = "1";//扩展属性类型
public string Pro_ID = "0";//扩展属性所属的商品类别ID列表
BasePage bp = new BasePage();
protected void Page_Load(object sender, EventArgs e)
{
if (YXShop.Common.WebUtility.isNumeric(Request.QueryString["Prop_ID"]))
{
if (!PowerTree.PowerPass.isPass("001003004", PowerTree.PowerPanel.PowerType.update))
{
bp = new BasePage();
bp.PageError("对不起,你没有修改商品属性的权限!", "../index.aspx");
}
}
else
{
if (!PowerTree.PowerPass.isPass("001003002", PowerTree.PowerPanel.PowerType.add))
{
bp = new BasePage();
bp.PageError("对不起,你没有添加商品属性的权限!", "../index.aspx");
}
}
if (!this.IsPostBack)
{
updateBind();
}
}
protected void btnAdd_Click(object sender, EventArgs e)
{
//所属商品分类ID
if (Convert.ToString(Request.Params["cbProClass"]) != "1")
{
model.Pro_ID = string.IsNullOrEmpty(Request.Params["ProductCategories"]) ? "0" : Request.Params["ProductCategories"];
}
else
{
model.Pro_ID = "0";
}
//属性名称
model.ProP_Filed = this.txtProP_Filed.Text;
//属性类别
model.ProP_Type = Convert.ToInt32(Request.Params["ddlProType"].ToString());
//属性值
if (model.ProP_Type != 4 && model.ProP_Type != 5)
{
model.ProP_Value = this.txtProP_Value.Text;
}
else
{
model.ProP_Value = "";
}
//属性是否必填
model.ProP_Term = Convert.ToInt32(this.rblProP_Term.SelectedValue);
//属性显示顺序
model.ProP_Order = Convert.ToInt32(this.txtProP_Order.Text);
if (!string.IsNullOrEmpty(Request.QueryString["ProP_ID"]))
{
model.ProP_ID = Int32.Parse(Request.QueryString["ProP_ID"]);
BLL.Update(model);
bp.PageRight("商品扩展属性修改成功!。<li><a href=\"ProProperty_List.aspx\" class=\"reshow\">返回扩展属性管理</a></li>", "ProProperty_List.aspx", true);
}
else
{
if (BLL.Add(model) == 0)
{
bp.PageRight("商品扩展属性添加成功!。<li><a href=\"ProProperty_List.aspx\" class=\"reshow\">返回扩展属性管理</a></li>", "ProProperty_List.aspx", true);
}
else
{
bp.PageError("对不起,操作失败,请重试!", "javascript:history.back();", true);
}
}
}
protected void updateBind()
{
if (!string.IsNullOrEmpty(Request.QueryString["ProP_ID"]))
{
try
{
List<YXShop.Model.YXShop_ProProperty> data = BLL.GetModel(Int32.Parse(Request.QueryString["ProP_ID"]));
this.ProductCategoriesList1.StrProID = Pro_ID = data[0].Pro_ID;
ProP_Type = Convert.ToString(data[0].ProP_Type);
this.txtProP_Filed.Text = data[0].ProP_Filed;
this.txtProP_Order.Text = Convert.ToString(data[0].ProP_Order);
this.txtProP_Value.Text = data[0].ProP_Value;
this.rblProP_Term.SelectedValue = Convert.ToString(data[0].ProP_Term);
this.lblTitle.Text = "修改商品扩展属性";
this.Label1.Text = "修改商品扩展属性";
this.btnAdd.Text = "修 改";
}
catch (Exception ex)
{
bp.PageError("对不起,传入的参数错误!", "javascript:history.back();", true);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -