goodsselect.aspx.cs

来自「c#三层架构项目开发的全过程」· CS 代码 · 共 69 行

CS
69
字号
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using BLL;
using Model;
namespace 金利来分销管理系统.Goods
{
    public partial class GoodsSelect : System.Web.UI.Page
    {
        #region 商品表查询,UI层构造函数
        BLL.Goods.ProductSelectBll ProductShow;
        BLL.Employee.EmployeeBll employeebllshow;

        public GoodsSelect()
        {
            ProductShow = new BLL.Goods.ProductSelectBll();
            employeebllshow = new BLL.Employee.EmployeeBll();
        }
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
           if (!this.IsPostBack)
            {
                //用户权限
                if (Session["employee_id"] == null)
                {
                    Response.Write("<script>alert('请您登陆系统');location.href='../Enter.aspx'</script>");
                }
                else
                {
                    if (employeebllshow.UserRole(Session["role_id"].ToString(), "17") == true)
                    {
                        ShowMethod();
                    }
                    else
                    {
                        Response.Write("<script>alert('你无权查看此功能,请与管理员联系');location.href='../Aboutus.aspx'</script>");
                    }
                }
            }
        }

        protected void gvproduct_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string Product_id = this.gvproduct.Rows[e.RowIndex].Cells[0].Text;
            ProductShow.ProductDelete (Product_id);
            Response.Write("<script>alert('请确认删除该商品?')</script>");
            ShowMethod();
        }
        //显示
        private void ShowMethod()
        {
            gvproduct.DataSource = ProductShow.GetProduct();
            gvproduct.DataBind();
        }
        //分页
        protected void gvproduct_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            this.gvproduct.PageIndex = e.NewPageIndex;
            ShowMethod();
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?