ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/HJGL/Match/InStorageView.aspx.cs

72 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using BLL;
using Newtonsoft.Json.Linq;
namespace FineUIPro.Web.HJGL.Match
{
public partial class InStorageView : PageBase
{
/// <summary>
/// 主键
/// </summary>
public string InStorageId
{
get
{
return (string)ViewState["InStorageId"];
}
set
{
ViewState["InStorageId"] = value;
}
}
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.InStorageId = Request.Params["InStorageId"];
var inStorage = BLL.HJGL_Match_InStorageService.GetHJGL_Match_InStorageByInStorageId(this.InStorageId);
if (inStorage != null)
{
this.txtInStorageCode.Text = inStorage.InStorageCode;
this.txtUnit.Text = BLL.Base_UnitService.GetUnitNameByUnitId(inStorage.UnitId);
this.txtInTime.Text = string.Format("{0:yyyy-MM-dd}", inStorage.InTime);
}
// 绑定表格
BindGrid();
}
}
/// <summary>
/// 绑定GV
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT InStorageItemId,InStorageId,Item.MaterialId,InCount,Material.Code,Material.Name,Material.Standard,Material.SteelName,Material.UNIT "
+ @" FROM HJGL_Match_InStorageItem AS Item"
+ @" LEFT JOIN HJGL_Match_Material AS Material ON Item.MaterialId=Material.MaterialId "
+ @" WHERE InStorageId='" + this.InStorageId + "'";
List<SqlParameter> listStr = new List<SqlParameter>();
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
// 2.获取当前分页数据
//var table = this.GetPagedDataTable(Grid1, tb1);
Grid1.RecordCount = tb.Rows.Count;
tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
}
}