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
{
///
/// 主键
///
public string InStorageId
{
get
{
return (string)ViewState["InStorageId"];
}
set
{
ViewState["InStorageId"] = value;
}
}
///
/// 加载页面
///
///
///
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();
}
}
///
/// 绑定GV
///
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 listStr = new List();
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();
}
}
}