⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectbranchs.aspx.cs

📁 c#三层架构项目开发的全过程
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;

namespace Enterprise_management
{
    public partial class SelectBranchs : System.Web.UI.Page
    {
        #region UI层构造函数
        BLL.Branch.ShopBll branchselect;
        BLL.Employee.EmployeeBll employeebllshow;

        public SelectBranchs()
        {
           branchselect = new BLL.Branch.ShopBll();
           employeebllshow = new BLL.Employee.EmployeeBll();

        }
        #endregion

        // 显示查询分店信息
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {   
                  //用户权限
                if (Session["employee_id"] == null)
                {
                    Response.Write ("请您登陆系统");
                }
                else 
                {
                    if (employeebllshow.UserRole(Session["role_id"].ToString(), "60") == true)
                    {
                        //信息显示
                        BindData();
                    }
                    else
                    {
                        Response.Write("<script>alert('你无权查看此功能,请与管理员联系');location.href='../Aboutus.aspx'</script>");
                    }
                }
                ////分店编号在DropDownList里显示
                //List<Model.Branch.ShopModel> li = branchselect.SelectID();
                //foreach (var item in li)
                //{
                //    this.ddlshopid.Items.Add(item.Shop_id.ToString());  
                //}
            }
         }

        private void BindData()
        {
            GvBranchShow.DataSource = branchselect.BranchSelect();
            GvBranchShow.DataBind();
        }

        //删除分店按钮
        protected void GvBranchShow_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string Shop_id = this.GvBranchShow.Rows[e.RowIndex].Cells[0].Text;
            branchselect.ShopDelete(Convert.ToInt32(Shop_id));
            Response.Write("<script>alert('删除成功')</script>");
            GvBranchShow.DataSource = branchselect.BranchSelect();
            GvBranchShow.DataBind();
        }

        // 分店编号搜索按钮
        protected void SelectBranchsButton1_Click(object sender, EventArgs e)
        {
            if (this.ddlBranchSearchCondition.Text=="分店名称")
            {
                this.GvBranchShow.DataSource = branchselect.SelectBranchByName(this.SelectBranchsTextBox1.Text);
                this.GvBranchShow.DataBind();
            }
            else if (this.ddlBranchSearchCondition.Text == "分店负责人")
            {
                this.GvBranchShow.DataSource = branchselect.selectname(this.SelectBranchsTextBox1.Text);
                this.GvBranchShow.DataBind();
            }
            else
            {
                BindData(); 
            }
           
        }
          
    }
}

⌨️ 快捷键说明

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