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

📄 removeinfroselect.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;

namespace 金利来分销管理系统.Remove
{
    public partial class RemoveInfroSelect : System.Web.UI.Page
    {
        //实例化BLL
        BLL.Remove.RemoveBll removebllshow;
        BLL.Goods.ProductBll productbllshow;
        BLL.Employee.EmployeeBll employeebllshow;

        public RemoveInfroSelect()
        {
            removebllshow = new BLL.Remove.RemoveBll();
            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("<script>alert('请您登陆系统');location.href='../Enter.aspx'</script>");
                }
                else 
                {
                    if (employeebllshow.UserRole(Session["role_id"].ToString(), "40") == true)
                    {
                        //实例化商品泛型集合
                        List<Model.Goods.ProductModel> productid = productbllshow.SelectProductID();
                        //查询商品编号
                        foreach (var item in productid)
                        {
                            this.ddlProductID.Items.Add(item.product_id);
                        }
                        //显示所有调拨单据
                        this.gvShow.DataSource = removebllshow.RemoveSetailSelectByWhere();
                        this.gvShow.DataBind();
                    }
                    else
                    {
                        Response.Write("<script>alert('你无权查看此功能,请与管理员联系');location.href='../Aboutus.aspx'</script>");
                    }
                }
            }
        }
        //按时间查找调拨单据按钮事件(获取该天单据)
        protected void btnSele_Click(object sender, EventArgs e)
        {
            //清空调拨单据编号
            this.ddlStockFormID.Items.Clear();
            this.ddlStockFormID.Items.Add("请选择单据号");
            //未选择时间时
            if (this.txtTime.Text == "")
            {
                //‘请选择时间’,lable显示
                this.lblTime.Visible = true;
            }
            else
            {
                this.lblTime.Visible = false;
                //实例化采购明细(通过时间)
                List<Model.Remove.RemoveModel> stockid = removebllshow.SelectRemoveIDByTime(DateTime.Parse(this.txtTime.Text));
                //查询所有采购单据编号
                foreach (var item in stockid)
                {
                    this.ddlStockFormID.Items.Add(item.remove_id);
                }
                if (ddlStockFormID.Text == "")
                {
                    this.gvShow.DataSource = null;
                    this.gvShow.DataBind();
                }
            }
        }
        //查询调拨单据信息按钮事件(查看)
        protected void btnSelect_Click(object sender, EventArgs e)
        {
            //实例化调拨单据泛型集合
            List<Model.Remove.RemoveModel> mo = removebllshow.RemoveSetailSelectByWhere();
            //按调拨单据编号查找
            if (ddlStockFormID.SelectedValue != "请选择单据号")
            {
                mo = mo.FindAll(o => o.remove_id == this.ddlStockFormID.Text.Trim());
            }
            //按商品编号
            if (ddlProductID.SelectedIndex!=0)
            {
                mo = mo.FindAll(o => o.Product_id == this.ddlProductID.Text.Trim());
            }
            this.gvShow.DataSource = mo;
            this.gvShow.DataBind();
        }
        //当单据选择项发生改变时
        protected void ddlStockFormID_SelectedIndexChanged(object sender, EventArgs e)
        {
            //清空商品编号选择项的值
            this.ddlProductID.Items.Clear();
            this.ddlProductID.Items.Add("请选择商品编号");
            if (this.ddlStockFormID.SelectedValue=="请选择单据号")
            {
                 //实例化商品泛型集合
                List<Model.Goods.ProductModel> productid = productbllshow.SelectProductID();
                //查询商品编号
                foreach (var item in productid)
                {
                    this.ddlProductID.Items.Add(item.product_id);
                }
            }
            else
            {
                //将选择的单据里包含的不重复的商品编号,添加到商品编号选择项里
                List<Model.Remove.RemoveModel> stockid = removebllshow.SelectRemoveListPid(this.ddlStockFormID.SelectedValue);
                foreach (var item in stockid)
                {
                    this.ddlProductID.Items.Add(item.Product_id);
                }
            }
           
        }
    }
}

⌨️ 快捷键说明

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