📄 pro_unit_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 System.Collections.Generic;
using YXShop.BLL;
using YXShop.Model;
using Shop.Web.UI;
namespace YXShop.Web.Admin.Product
{
public partial class Pro_Unit_Add : System.Web.UI.Page
{
YXShop.BLL.Pro_Unit dataCA = new YXShop.BLL.Pro_Unit();
string type;
BasePage bp = new BasePage();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request["id"] != null)
{
if (!PowerTree.PowerPass.isPass("001004004", PowerTree.PowerPanel.PowerType.update))
{
bp.PageError("对不起,你没有修改商品单位的权限!", "../index.aspx");
}
List<YXShop.Model.Pro_Unit> data = dataCA.GetId(Convert.ToInt32(Request["id"]));
this.txtUnit.Text = data[0].ProU_Name;
this.txtOrder.Text = data[0].ProU_Order.ToString();
ViewState["URL"] = Request.UrlReferrer;
}
else
{
if (!PowerTree.PowerPass.isPass("001004002", PowerTree.PowerPanel.PowerType.add))
{
bp.PageError("对不起,你没有添加商品单位的权限!", "../index.aspx");
}
}
}
}
#region 添加与修改
protected void Button1_Click(object sender, EventArgs e)
{
YXShop.Model.Pro_Unit data = new YXShop.Model.Pro_Unit();
data.ProU_Name = txtUnit.Text.Trim();
data.ProU_Order = Convert.ToInt32(txtOrder.Text.Trim());
if (Request["id"] != null)
{
data.ProU_ID = Convert.ToInt32(Request["id"]);
if (dataCA.Amend(data) > 0)
{
bp.PageRight("商品单位修改成功。", "Pro_UnitList.aspx");
}
Response.Redirect(ViewState["URL"].ToString());
}
else
{
if(dataCA.Create(data) > 0)
{
bp.PageRight("商品单位添加成功。<li><a href='Pro_Unit_Add.aspx'>继续添加</a></li>", "Pro_UnitList.aspx");
}
this.txtUnit.Text = string.Empty;
}
}
#endregion
#region "册除"
[AjaxPro.AjaxMethod]
public string UnitDel(int id)
{
YXShop.Model.Pro_Unit data = new YXShop.Model.Pro_Unit();
data.ProU_ID = Convert.ToInt32(ID);
dataCA.Delect(data);
return string.Empty;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -