using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using BLL; using Newtonsoft.Json.Linq; using System.Linq; namespace FineUIPro.Web.HJGL.Match { public partial class OutStorageView : PageBase { /// /// 主键 /// public string OutStorageId { get { return (string)ViewState["OutStorageId"]; } set { ViewState["OutStorageId"] = value; } } /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.OutStorageId = Request.Params["OutStorageId"]; var outStorage = Funs.DB.HJGL_Match_OutStorage.FirstOrDefault(x => x.OutStorageId == this.OutStorageId); if (outStorage != null) { this.txtOutStorageCode.Text = outStorage.OutStorageCode; this.txtUnit.Text = BLL.Base_UnitService.GetUnitNameByUnitId(outStorage.UnitId); this.txtOutTime.Text = string.Format("{0:yyyy-MM-dd}", outStorage.OutTime); this.txtCompileMan.Text = BLL.Sys_UserService.GetUserNameByUserId(outStorage.CompileMan); } // 绑定表格 BindGrid(); } } /// /// 绑定GV /// private void BindGrid() { string strSql = @"SELECT Item.OutStorageItemId,Item.OutStorageId,Item.MaterialId,Item.ISO_ID,ISNULL(Item.OutCount,0) AS OutCount,Material.Code,Material.Name" + @" ,Material.Standard,Material.UNIT,Pipeline.ISO_IsoNo,Installation.InstallationCode,Installation.InstallationName,WorkArea.WorkAreaCode,WorkArea.WorkAreaName,Unit.UnitCode,Unit.UnitName" + @" FROM dbo.HJGL_Match_OutStorageItem AS Item" + @" LEFT JOIN dbo.HJGL_Match_Material AS Material ON Item.MaterialId =Material.MaterialId" + @" LEFT JOIN HJGL_PW_IsoInfo AS Pipeline ON Item.ISO_ID =Pipeline.ISO_ID" + @" LEFT JOIN Project_WorkArea AS WorkArea ON WorkArea.WorkAreaId =Pipeline.BAW_ID" + @" LEFT JOIN Project_Installation AS Installation ON Installation.InstallationId =WorkArea.InstallationId" + @" LEFT JOIN Base_Unit AS Unit ON Unit.UnitId =Pipeline.BSU_ID" + @" WHERE OutStorageId='" + this.OutStorageId + "'"; 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(); } } }