📄 brandpro.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 YXShop.Common;
using System.Collections.Generic;
using Shop.Web.UI;
namespace YXShop.Web.Admin.Product
{
public partial class BrandPro : System.Web.UI.Page
{
YXShop.BLL.Product BLL = new YXShop.BLL.Product();
public PageSet ps;
private static int bid = 0;
BasePage bp = null;
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(YXShop.Web.Admin.Product.Product_List));
if ((!IsPostBack) || ((Request["Event"] != null) && (Request["Event"] != "")))
{
if (!string.IsNullOrEmpty(Request.QueryString["BID"]))
{
string[] arr = Request.QueryString["BID"].Split('_');
if (arr.Length == 2)
{
if (YXShop.Common.WebUtility.isNumeric(arr[1]))
{
bid = Convert.ToInt32(arr[1]);
BindData(bid);
}
}
}
else
{
Response.Redirect("Product_List.aspx", true);
}
}
}
private void BindData(int brandID)
{
int pageIndex = Request["pageIndex"] == null ? 0 : int.Parse(Request["pageIndex"]);
if (pageIndex < 0)
{
pageIndex = 0;
}
if ((Request["Event"] == null) || (Request["Event"] == ""))
{
pageIndex = 0;
}
List<YXShop.Model.Product> datas = BLL.getcolumn("Pro_CID", brandID);//得到所有产品信息
gvProduct.DataSource = datas;
ps = new PageSet(datas.Count, PageSet.PageSize, pageIndex);
if (ps.PageCount <= pageIndex + 1)
{
pageIndex = ps.PageCount - 1;
}
gvProduct.PageSize = PageSet.PageSize;
gvProduct.PageIndex = pageIndex;
if (datas.Count < 1)
{
gvProduct.BackColor = System.Drawing.Color.White;
}
else
{
gvProduct.BackColor = System.Drawing.Color.FromArgb(0xCC, 0xCC, 0xCC);
}
gvProduct.DataBind();
}
#region 返回商品分类名称
/// <summary>
/// 返回商品分类名称
/// </summary>
/// <param name="classID"></param>
/// <returns></returns>
public string className(string classID)
{
try
{
try
{
int cID = Convert.ToInt32(classID);
YXShop.BLL.Pro_Categories PC = new YXShop.BLL.Pro_Categories();
List<YXShop.Model.Pro_Categories> lPC = PC.GetId(Convert.ToInt32(classID));
if (lPC.Count > 0)
{
return lPC[0].ProC_CategroiesName;
}
else
{
return "无";
}
}
catch
{
return "无";
}
}
catch
{
return "无";
}
}
#endregion
#region 删除/批量删除
[AjaxPro.AjaxMethod]
public string BetchDel(string id)
{
string strID = "";
if (id.IndexOf(",") > 0)
{
strID = id.Substring(0, (id.Length - 1));
}
else
{
strID = id;
}
YXShop.BLL.Communal data = new YXShop.BLL.Communal();
data.BatchDelect("YXShop_Product", "Pro_ID", strID);
return string.Empty;
}
#endregion
/// <summary>
/// 复制
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
if (!PowerTree.PowerPass.isPass("001008006", PowerTree.PowerPanel.PowerType.other))
{
bp = new BasePage();
bp.PageError("对不起,你没有复制商品的权限!", "../index.aspx");
}
int proID = GetProID((ImageButton)sender);
try
{
BLL.operatePro(proID.ToString(), 3);
BindData(bid);
}
catch { }
}
/// <summary>
/// 删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
{
if (!PowerTree.PowerPass.isPass("001008003", PowerTree.PowerPanel.PowerType.del))
{
bp = new BasePage();
bp.PageError("对不起,你没有删除商品的权限!", "../index.aspx");
}
int proID = GetProID((ImageButton)sender);
try
{
BLL.operatePro(proID.ToString(), 2);
BindData(bid);
}
catch { }
}
/// <summary>
/// 放入回收站
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
if (!PowerTree.PowerPass.isPass("001008007", PowerTree.PowerPanel.PowerType.other))
{
bp = new BasePage();
bp.PageError("对不起,你没把商品删入回收站的权限!", "../index.aspx");
}
int proID = GetProID((ImageButton)sender);
try
{
BLL.operatePro(proID.ToString(), 1);
BindData(bid);
}
catch { }
}
private int GetProID(ImageButton sender)
{
int proID = 0;
if (YXShop.Common.WebUtility.isNumeric(sender.CommandArgument))
{
proID = Convert.ToInt32(sender.CommandArgument);
}
return proID;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -