📄 selectloss.aspx.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 金利来分销管理系统.Loss
{
public partial class SelectLoss : System.Web.UI.Page
{
BLL.Loss.lossBll lossbllshow;
BLL.Loss.loss_listBll losslistbllshow;
BLL.Employee.EmployeeBll employeebllshow;
public SelectLoss()
{
lossbllshow = new BLL.Loss.lossBll();
losslistbllshow = new BLL.Loss.loss_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(), "28") == true)
{
this.gvShow.DataSource = lossbllshow.LossSelect();
this.gvShow.DataBind();
}
else
{
Response.Write("<script>alert('你无权查看此功能,请与管理员联系');location.href='../Aboutus.aspx'</script>");
}
}
}
}
//按指定的条件查询
protected void btnSelect_Click(object sender, EventArgs e)
{
ShowMethod();
}
//显示
private void ShowMethod()
{
//拉姆达表达式
List<Model.Loss.lossModel> mo = lossbllshow.LossSelect();
//按采购单据编号查找
if (ddlStockFormID.SelectedValue != "请选择损益单据号")
{
mo = mo.FindAll(o => o.loss_id == this.ddlStockFormID.Text.Trim());
}
//按审核状态
if (ddlOKType.SelectedIndex != 0)
{
mo = mo.FindAll(o => o.loss_state == this.ddlOKType.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 == "未通过")
{
//通过损益编号删除损益明细
losslistbllshow.StockSetailDeleteByID(id);
lossbllshow.LossDelete(id,"未通过");
Response.Write("<script>alert('删除成功')</script>");
}
else
{
Response.Write("<script>alert('该单据已被审核,不能进行删除')</script>");
}
}
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.Loss.lossModel> stockid = lossbllshow.SelectLossID(DateTime.Parse(this.txtTime.Text));
//查询所有损益单据编号
foreach (var item in stockid)
{
this.ddlStockFormID.Items.Add(item.loss_id);
}
if (ddlStockFormID.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 + -