📄 shoptype.aspx.cs
字号:
using System;
using System.Web.UI;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using Shop.Web.UI;
namespace YXShop.Web.Admin.Shop
{
public partial class ShopType : System.Web.UI.Page
{
YXShop.BLL.YXShop_ShopType stBll = new YXShop.BLL.YXShop_ShopType();
BasePage bp = null;
protected void Page_Load(object sender, EventArgs e)
{
if (!PowerTree.PowerPass.isPass("014002002", PowerTree.PowerPanel.PowerType.add))
{
bp = new BasePage();
bp.PageError("对不起,你没有添加此项的权限!", "../index.aspx");
}
if (!Page.IsPostBack)
{
if (YXShop.Common.WebUtility.isNumeric(Request.QueryString["ID"]))
{
int ID = Convert.ToInt32(Request.QueryString["ID"]);
BindShopType(ID);
}
}
}
/// <summary>
/// 绑定店铺类型信息
/// </summary>
/// <param name="id"></param>
private void BindShopType(int id)
{
lbtilte.Text = "店铺类型修改";
Button1.Text = "修改";
Button1.CommandArgument = id.ToString();
List<YXShop.Model.YXShop_ShopType> stList = stBll.GetListByColumn("STID", id);
if (stList.Count == 1)
{
TextBox1.Text = stList[0].STName;
TextBox2.Text = stList[0].STPrice.ToString();
TextBox3.Text = stList[0].ExpendDays.ToString();
TextBox4.Text = stList[0].ShopSpace.ToString();
TextBox5.Text = stList[0].ProCount.ToString();
TextBox6.Text = stList[0].Taxis.ToString();
TextBox7.Text = stList[0].Content;
TextBox8.Text = stList[0].Attribute;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
BasePage bp = new BasePage();
YXShop.Model.YXShop_ShopType stModel = new YXShop.Model.YXShop_ShopType();
stModel.STName = YXShop.Common.WebUtility.replaceStr(TextBox1.Text.Trim());
stModel.STPrice = Convert.ToDecimal(TextBox2.Text);
stModel.ExpendDays = Convert.ToInt32(TextBox3.Text);
stModel.ShopSpace = Convert.ToInt32(TextBox4.Text);
stModel.ProCount = Convert.ToInt32(TextBox5.Text);
stModel.Taxis = Convert.ToInt16(TextBox6.Text);
stModel.Content = YXShop.Common.WebUtility.replaceStr(TextBox7.Text.Trim());
stModel.Attribute = YXShop.Common.WebUtility.replaceStr(TextBox8.Text.Trim());
int id = GetID((Button)sender);
if (id > 0)
{//修改
stModel.STID = Convert.ToInt32(id);
try
{
int reInt = stBll.Amend(stModel);
if (reInt == 1)
{
bp.PageRight("修改栏目成功!<font color=\"red\">继续修改此栏目</font></a></li>", "ShopTypeManager.aspx");
}
else
{
bp.PageError("修改栏目失败!<font color=\"red\">继续修改此栏目</font></a></li>", "ShopType.aspx?ID=" + id);
}
}
catch
{
}
}
else
{//增加
List<YXShop.Model.YXShop_ShopType> stList = stBll.GetListByColumn("STName", stModel.STName);
if (stList.Count > 0)
{
bp.PageError("添加栏目失败!<font color=\"red\">类型名称已经存在!</font></a></li>", "ShopType.aspx");
}
else
{
try
{
int reInt = stBll.Create(stModel);
if (reInt == 1)
{
bp.PageRight("添加栏目成功!<font color=\"red\">继续添加此栏目</font></a></li>", "ShopTypeManager.aspx");
}
else
{
bp.PageError("添加栏目失败!<font color=\"red\">继续添加此栏目</font></a></li>", "ShopType.aspx");
}
}
catch
{
}
}
}
}
private int GetID(Button btn)
{
int reInt=-1;
if (YXShop.Common.WebUtility.isNumeric(btn.CommandArgument))
reInt = Convert.ToInt32(btn.CommandArgument);
return reInt;
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("ShopTypeManager.aspx", true);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -