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

📄 bigcustomerreturnselectsonpage.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 金利来分销管理系统.BigCustomers
{
    public partial class BigCustomerReturnSelectsonpage : System.Web.UI.Page
    {
        BLL.BigCustomers.bigclientBll bigclientbllshow;
        BLL.BigCustomers.bigclient_listBll bigclient_listbllshow;
        BLL.Goods.ProductBll productbllshow;
        BLL.Employee.EmployeeBll employeebllshow;

        public BigCustomerReturnSelectsonpage()
        {
            bigclientbllshow = new BLL.BigCustomers.bigclientBll();
            bigclient_listbllshow = new BLL.BigCustomers.bigclient_listBll();
            productbllshow = new BLL.Goods.ProductBll();
            employeebllshow = new BLL.Employee.EmployeeBll();

        }
        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(), "5") == true)
                    {
                        if (Request.QueryString["bigclient_id"] != null)
                        {
                            this.gvShow.DataSource = bigclient_listbllshow.bigclient_listSelectByID(Request.QueryString["bigclient_id"].ToString());
                            this.gvShow.DataBind();
                        }
                        else
                        {
                            this.gvShow.DataSource = bigclient_listbllshow.bigclient_listSelect();
                            this.gvShow.DataBind();

                        }
                        List<Model.BigCustomers.bigclientModel> bigclient = bigclientbllshow.Selectbigclient_id();
                        //查询所有销售单据编号
                        foreach (var item in bigclient)
                        {
                            this.ddlSellID.Items.Add(item.bigclient_id);
                        }             
                        //查询商品编号
                        List<Model.Goods.ProductModel> productid = productbllshow.SelectProductID();
                        foreach (var item in productid)
                        {
                            this.ddlProductID.Items.Add(item.product_id);
                        }
                    }
                    else
                    {
                        Response.Write("<script>alert('你无权查看此功能,请与管理员联系');location.href='../Aboutus.aspx'</script>");
                    }
                }
            }
        }
        //查询
        protected void btnBigReturnSeek_Click(object sender, EventArgs e)
        {
            ShowMethod();

        }
        //显示
        private void ShowMethod()
        {
            //拉姆达表达式
            List<Model.BigCustomers.bigclient_listModel> list = bigclient_listbllshow.bigclient_listSelect();
            //按采购单据编号查找
            if (ddlSellID.SelectedValue != "请选择销售单据编号")
            {
                list = list.FindAll(o => o.bigclient_id == this.ddlSellID.Text.Trim());
            }
            //按商品编号查找
            if (ddlProductID.SelectedIndex != 0)
            {
                list = list.FindAll(o => o.Product_id == this.ddlProductID.Text.Trim());
            }

            this.gvShow.DataSource = list;
            this.gvShow.DataBind();
        }

        protected void btnSele_Click(object sender, EventArgs e)
        {
            if (this.txtTime.Text == "")
            {
                this.lblTime.Visible = true;
            }
            else
            {
                this.ddlSellID.Items.Clear();
                List<Model.BigCustomers.bigclientModel> bigclient = bigclientbllshow.Selectbigclient_id();
                //查询所有销售单据编号
                foreach (var item in bigclient)
                {
                    this.ddlSellID.Items.Add(item.bigclient_id);
                }
                if (ddlSellID.Text == "")
                {
                    this.gvShow.DataSource = null;
                    this.gvShow.DataBind();
                }
            }
        }
        //分页
        protected void gvShow_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            this.gvShow.PageIndex = e.NewPageIndex;
            ShowMethod();
        }
    }
}

⌨️ 快捷键说明

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