Files
SGGL_SHJ/SGGL/FineUIPro.Web/CLGL/InputBarCodeQuery.aspx.cs
T

85 lines
2.6 KiB
C#
Raw Normal View History

using BLL;
using System;
using System.Data;
using System.IO;
namespace FineUIPro.Web.CLGL
{
public partial class InputBarCodeQuery : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
BindGrid();
}
}
private void BindGrid()
{
var query = new Model.Tw_InputDetailBarCodeOutput
{
ProjectId = CurrUser.LoginProjectId,
MaterialCode = txtMaterialCode.Text.Trim(),
BarCode = txtBarCode.Text.Trim()
};
Grid1.DataSource = TwInputdetailBarCodeService.GetListData(query, Grid1);
Grid1.RecordCount = TwInputdetailBarCodeService.Count;
Grid1.DataBind();
}
protected void btnSearch_Click(object sender, EventArgs e)
{
Grid1.PageIndex = 0;
BindGrid();
}
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName != "btnBarCodePrint")
{
return;
}
FastReportService.ResetData();
var query = new Model.Tw_InputDetailBarCodeOutput
{
Id = e.RowID,
ProjectId = CurrUser.LoginProjectId
};
var list = TwInputdetailBarCodeService.GetListData(query);
if (list.Count == 0)
{
ShowNotify("未找到入库条码明细。", MessageBoxIcon.Warning);
return;
}
DataTable table = LINQToDataTable(list);
table.TableName = "Table1";
FastReportService.AddFastreportTable(table);
string rootPath = Server.MapPath("~/");
string templatePath = "File\\Fastreport\\材料入库条码.frx";
if (File.Exists(rootPath + templatePath))
{
string printUrl = ResolveUrl(FastReportService.ExportReport(rootPath + templatePath));
PageContext.RegisterStartupScript(string.Format("printByHiddenFrame('{0}');", printUrl));
}
}
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
Grid1.PageIndex = 0;
BindGrid();
}
}
}