?? 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 金利來分銷管理系統(tǒng).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)
{
//用戶權(quán)限
if (Session["employee_id"] == null)
{
Response.Write ("請您登陸系統(tǒng)");
}
else
{
if (employeebllshow.UserRole(Session["role_id"].ToString(), "28") == true)
{
this.gvShow.DataSource = lossbllshow.LossSelect();
this.gvShow.DataBind();
}
else
{
Response.Write("<script>alert('你無權(quán)查看此功能,請與管理員聯(lián)系');location.href='../Aboutus.aspx'</script>");
}
}
}
}
//按指定的條件查詢
protected void btnSelect_Click(object sender, EventArgs e)
{
ShowMethod();
}
//顯示
private void ShowMethod()
{
//拉姆達表達式
List<Model.Loss.lossModel> mo = lossbllshow.LossSelect();
//按采購單據(jù)編號查找
if (ddlStockFormID.SelectedValue != "請選擇損益單據(jù)號")
{
mo = mo.FindAll(o => o.loss_id == this.ddlStockFormID.Text.Trim());
}
//按審核狀態(tài)
if (ddlOKType.SelectedIndex != 0)
{
mo = mo.FindAll(o => o.loss_state == this.ddlOKType.Text.Trim());
}
this.gvShow.DataSource = mo;
this.gvShow.DataBind();
}
//刪除未通過審核的損益單據(jù)
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('該單據(jù)已被審核,不能進行刪除')</script>");
}
}
protected void btnSele_Click(object sender, EventArgs e)
{
//清空總部發(fā)貨單據(jù)編號
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));
//查詢所有損益單據(jù)編號
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();
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -