📄 collection.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;
using YXShop.BLL;
using YXShop.Model;
namespace YXShop.Web.Admin.Accessories
{
public partial class Collection : System.Web.UI.Page
{
public PageSet ps;
BasePage bp = null;
protected void Page_Load(object sender, EventArgs e)
{
if (!PowerTree.PowerPass.isPass("013004000",PowerTree.PowerPanel.PowerType.look))
{
bp = new BasePage();
bp.PageError("对不起,你没有查看此页面的权限!", "../index.aspx");
}
AjaxPro.Utility.RegisterTypeForAjax(typeof(YXShop.Web.Admin.Accessories.Collection));
if (!IsPostBack)
{
BindData();
}
if ((!IsPostBack) || ((Request["Event"] != null) && (Request["Event"] != "")))
{
BindData();
}
}
#region 列表
private void BindData()
{
int pageIndex = Request["pageIndex"] == null ? 0 : int.Parse(Request["pageIndex"]);
if (pageIndex < 0)
{
pageIndex = 0;
}
if ((Request["Event"] == null) || (Request["Event"] == ""))
{
pageIndex = 0;
}
YXShop.BLL.Favorite data = new YXShop.BLL.Favorite();
List<YXShop.Model.Favorite> datas = data.GetAll();
dgTBCollectionInfo.DataSource = datas;
ps = new PageSet(datas.Count, PageSet.PageSize, pageIndex);
if (ps.PageCount <= pageIndex + 1)
{
pageIndex = ps.PageCount - 1;
}
dgTBCollectionInfo.PageSize = PageSet.PageSize;
dgTBCollectionInfo.PageIndex = pageIndex;
if (datas.Count < 1)
{
dgTBCollectionInfo.BackColor = System.Drawing.Color.White;
}
dgTBCollectionInfo.DataBind();
}
protected void dgTBCollectionInfo_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (!(e.Row.DataItem is YXShop.Model.Favorite))
{
return;
}
YXShop.Model.Favorite data = (e.Row.DataItem as YXShop.Model.Favorite);
if (data != null)
{
e.Row.Cells[1].Text =this.StrProduct(Convert.ToInt32(data.CollectionID));
e.Row.Cells[2].Text = "<a href='../Consumer/MemberInfo.aspx?Pro_ID=" + data.CollectionUserID + "'>"+data.CollectionName+"</a>";
e.Row.Cells[4].Text = "<a href='#' onclick='Mdelete(" + data.ID + ")'>删除</a>";
}
}
#endregion
#region 查询产品
protected string StrProduct(int id)
{
string str = "";
YXShop.BLL.Product data = new YXShop.BLL.Product();
List<YXShop.Model.Product> daPro = data.GetId(id);
if (daPro.Count > 0)
{
str = daPro[0].Pro_Name.ToString();
}
else
{
str = "未找到该商品";
}
return str.ToString();
}
#endregion
#region 单个删除与批量删除
[AjaxPro.AjaxMethod]
public string BetchDel(string id)
{
if (!PowerTree.PowerPass.isPass("013004003", PowerTree.PowerPanel.PowerType.del))
{
return "false";
}
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_Favorite", "ID", strID);
return string.Empty;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -