145 lines
4.5 KiB
C#
145 lines
4.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Data;
|
|
using BLL;
|
|
|
|
namespace FineUIPro.Web.HJGL.MaterialManage
|
|
{
|
|
public partial class ShowUsingMan : PageBase
|
|
{
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
BindGrid();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 绑定数据
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string projectId = Request.Params["projectId"];
|
|
string strSql = string.Empty;
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
if (!string.IsNullOrEmpty(projectId))
|
|
{
|
|
strSql = @"SELECT w.WED_ID,w.WED_Code,w.WED_Name,u.UnitName
|
|
FROM dbo.BS_Welder w
|
|
LEFT JOIN dbo.Base_Unit u ON u.UnitId = w.WED_Unit
|
|
WHERE w.WED_IfOnGuard=1 AND w.ProjectId=@ProjectId";
|
|
listStr.Add(new SqlParameter("@ProjectId", projectId));
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtCode.Text.Trim()))
|
|
{
|
|
strSql += " AND WED_Code LIKE @Code";
|
|
listStr.Add(new SqlParameter("@Code", "%" + this.txtCode.Text.Trim() + "%"));
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtName.Text.Trim()))
|
|
{
|
|
strSql += " AND WED_Name LIKE @Name";
|
|
listStr.Add(new SqlParameter("@Name", "%" + this.txtName.Text.Trim() + "%"));
|
|
}
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
#endregion
|
|
|
|
#region 排序
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 确定按钮
|
|
/// <summary>
|
|
/// 确定按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSure_Click(object sender, EventArgs e)
|
|
{
|
|
//string itemsString = "";
|
|
//string[] selectRowId = Grid1.SelectedRowIDArray;
|
|
//foreach (var item in selectRowId)
|
|
//{
|
|
// itemsString += item + "|";
|
|
//}
|
|
|
|
string itemsString = this.Grid1.SelectedRowID;
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(itemsString)
|
|
+ ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
#endregion
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Text_TextChanged(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 页索引改变事件
|
|
/// <summary>
|
|
/// 页索引改变事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
Grid1.PageIndex = e.NewPageIndex;
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 分页选择下拉改变事件
|
|
/// <summary>
|
|
/// 分页选择下拉改变事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 表头过滤
|
|
protected void Grid1_FilterChange(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
}
|
|
} |