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

📄 bigcustomerreturnselect.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 WebApplication1
{
    public partial class BigCustomerReturnSelect : System.Web.UI.Page
    {
        BLL.BigCustomers.bigclientBll bigclientbllshow;
        BLL.BigCustomers.bigclient_listBll bigclient_listbllshow;
        BLL.Employee.EmployeeBll employeebllshow;

        public BigCustomerReturnSelect()
        {
            bigclientbllshow = new BLL.BigCustomers.bigclientBll();
            bigclient_listbllshow = new BLL.BigCustomers.bigclient_listBll();
            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(), "4") == true)
                    {
                        this.gvShow.DataSource = bigclientbllshow.bigclientSelectByWhere();
                        this.gvShow.DataBind();
                    }
                    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.bigclientModel> mo = bigclientbllshow.bigclientSelectByWhere();
            //按采购单据编号查找
            if (ddlSellID.SelectedValue != "请选择销售单据编号")
            {
                mo = mo.FindAll(o => o.bigclient_id == this.ddlSellID.Text.Trim());
            }
            //按审核状态
            if (ddlState.SelectedIndex != 0)
            {
                mo = mo.FindAll(o => o.bigclient_state == this.ddlState.Text.Trim());
            }
            if (ddlType.SelectedIndex != 0)
            {
                mo = mo.FindAll(o => o.bigclient_type_name == this.ddlType.Text.Trim());
            }
            this.gvShow.DataSource = mo;
            this.gvShow.DataBind();
        }
        //删除“未通过”审核的销售单据
        protected void gvShow_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string id = this.gvShow.Rows[e.RowIndex].Cells[0].Text;
            string status = this.gvShow.Rows[e.RowIndex].Cells[6].Text.Trim();
            if (status == "未通过")
            {
                bigclient_listbllshow.bigclient_listDelete(id);
                bigclientbllshow.bigclientDelete(id, "未通过");
                Response.Write("<script>alert('删除成功')</script>");
            }
            else
            {
                Response.Write("<script>alert('该单据已被审核,不能进行删除')</script>");
            }
        }

        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 + -