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

📄 removelistselect.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 BLL;
using Model;

namespace 金利来分销管理系统.Remove
{
    public partial class RemoveListSelect : System.Web.UI.Page
    { 
        //实例化BLL
        BLL.Remove.RemoveBll removebllshow;
      
        public RemoveListSelect()
        {
            removebllshow = new BLL.Remove.RemoveBll();
         
        }
        protected void Page_Load(object sender, EventArgs e)
        {
             if (!this.IsPostBack)
            {
                //显示所有调拨单据
                this.gvShow.DataSource = removebllshow.RemoveSelectByWhere();
                this.gvShow.DataBind();
            }
        }
        //按时间查找调拨单据按钮事件
        protected void btnSele_Click(object sender, EventArgs e)
        {
            //清空调拨单据编号
            this.ddlStockFormID.Items.Clear();

            if (this.txtTime.Text == "")
            {
                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.RemoveSelectByWhere();
            //按调拨单据编号查找
            if (ddlStockFormID.SelectedValue != "请选择调拨单据号")
            {
                mo = mo.FindAll(o => o.remove_id == this.ddlStockFormID.Text.Trim());
            }
            //按审核状态
            if (ddlOKType.SelectedIndex != 0)
            {
                mo = mo.FindAll(o => o.remove_state == this.ddlOKType.Text.Trim());
            }
            this.gvShow.DataSource = mo;
            this.gvShow.DataBind();
        }
        //删除调拨单据以及明细
        protected void gvShow_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //要删除行的ID
            string id = this.gvShow.Rows[e.RowIndex].Cells[0].Text;
            //要删除行的审核状态
            string status = this.gvShow.Rows[e.RowIndex].Cells[6].Text.Trim();
            if (status == "未通过")
            {
                removebllshow.RemoveSetailDelete(id);
                removebllshow.RemoveDelete(id, "未通过");
                Response.Write("<script>alert('删除成功')</script>");
            }
            else
            {
                Response.Write("<script>alert('该单据已被审核,不能进行删除')</script>");
            }
        }
    }
}

⌨️ 快捷键说明

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