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

📄 invoicecheck.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 System.Data;
using Model;
namespace 金利来分销管理系统.Invoice
{
    public partial class InvoiceCheck : System.Web.UI.Page
    {
        //实例化BLL层的方法
        BLL.Invoice.InvoiceBll bllshow;

        public InvoiceCheck()
        {
            bllshow = new BLL.Invoice.InvoiceBll();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                //获得未通过审核的总部发(退)货单据放入DropDownList里
                List<Model.Invoice.InvoiceModel> ddlshow = bllshow.InvoiceInsetDDL();
                foreach (var item in ddlshow)
                {
                    this.ddlInvoiceID.Items.Add(item.invoice_id);
                }
                
            }
        }
        //当单据号发生改变时
        protected void ddlInvoiceID_SelectedIndexChanged(object sender, EventArgs e)
        {
            //首先清空gvshow表
            this.gvshow.DataSource = null;
            this.gvshow.DataBind();
            //如果选择项为起始值,既为“请选择单据号”
            if (this.ddlInvoiceID.SelectedIndex == 0)
            {
                //清空页面上显示的单据信息
                this.lblTimego.Text = "";
                this.lbltype.Text = "";
                this.rblistState.Text = "";
            }
            //显示选择的单据信息
            List<Model.Invoice.InvoiceModel> timetypeshow = bllshow.InvoiceTimeType(this.ddlInvoiceID.Text);
            foreach (var item in timetypeshow)
            {
                this.lbltype.Text = item.invoice_type_name;
                this.lblTimego.Text = item.invoice_time.ToString();
            }
        }
        //点击“查看详细”按钮时
        protected void btnSure_Click(object sender, EventArgs e)
        {   
            //当单据选择项不等于初始值时
            if (this.ddlInvoiceID.SelectedIndex != 0)
            {
                //显示选择单据的详细信息
                this.gvshow.DataSource = bllshow.InvoiceSelectList(this.ddlInvoiceID.Text);
                this.gvshow.DataBind();
            }
            else
            {
                Response.Write("<script>alert('请选择单据')</script>");
            }
        }
        //点击“确定”按钮时
        protected void btnOK_Click(object sender, EventArgs e)
        {
            //当单据选择项不等于初始值时
            if (this.ddlInvoiceID.SelectedIndex != 0)
            {
                //审批,进行修改单据的状态
                bllshow.UpInvoice(this.ddlInvoiceID.Text, this.lblNameto.Text, this.txtadvice.Text, this.rblistState.SelectedValue);
                Response.Write("<script>alert('审批成功')</script>");
                if (this.rblistState.Text=="通过")
                {
                    //审批一张单据,通过之后就不在选择项里出现
                    ddlInvoiceID.Items.Remove(ddlInvoiceID.Text);
                }
                //审批成功后,选择单据项里,回复初始值,既为“请选择单据号”
                this.ddlInvoiceID.SelectedIndex = 0;
                lblTimego.Text = "";
                lbltype.Text = "";
                this.gvshow.DataSource = null;
                this.gvshow.DataBind();
            }
            else
            {
                Response.Write("<script>alert('请选择单据')</script>");
            }
        }

    }
}

⌨️ 快捷键说明

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