📄 invoicelistselect.aspx.cs
字号:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace 金利来分销管理系统.Invoice
{
public partial class InvoiceListSelect : System.Web.UI.Page
{
//实例化BLL
BLL.Invoice.InvoiceBll invoicebllshow;
public InvoiceListSelect()
{
invoicebllshow = new BLL.Invoice.InvoiceBll();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//显示所有总部发货单据
this.gvShow.DataSource = invoicebllshow.InvoiceSelectByWhere();
this.gvShow.DataBind();
}
}
//按时间查找发货单据按钮事件(获取该天单据)
protected void btnSele_Click(object sender, EventArgs e)
{
//清空总部发货单据编号
this.ddlStockFormID.Items.Clear();
this.ddlStockFormID.Items.Add("请选择单据号");
if (this.txtTime.Text == "")
{
this.lblTime.Visible = true;
}
else
{
this.lblTime.Visible = false;
//实例化总部发货明细(通过时间)
List<Model.Invoice.InvoiceModel> stockid = invoicebllshow.SelectInvoiceIDByTime(DateTime.Parse(this.txtTime.Text));
//查询所有总部发货单据编号
foreach (var item in stockid)
{
this.ddlStockFormID.Items.Add(item.invoice_id);
}
}
}
//查询总部发货单据信息按钮事件(查看)
protected void btnSelect_Click(object sender, EventArgs e)
{
//实例化总部发货单据泛型集合
List<Model.Invoice.InvoiceModel> mo = invoicebllshow.InvoiceSelectByWhere();
//按总部发货单据编号查找
if (ddlStockFormID.SelectedValue != "请选择单据号")
{
mo = mo.FindAll(o => o.invoice_id == this.ddlStockFormID.Text.Trim());
}
//按审核状态
if (ddlOKType.SelectedIndex != 0)
{
mo = mo.FindAll(o => o.invoice_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 == "未通过")
{
invoicebllshow.InvoiceSetailDelete(id);
invoicebllshow.InvoiceDelete(id, "未通过");
Response.Write("<script>alert('删除成功')</script>");
}
else
{
Response.Write("<script>alert('该单据已被审核,不能进行删除')</script>");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -