153 lines
5.9 KiB
C#
153 lines
5.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Data;
|
|
using BLL;
|
|
|
|
namespace FineUIPro.Web.WeldMat.Recycle
|
|
{
|
|
public partial class RecycleMatTop : 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();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string strSql = @"SELECT RecycleMatTop.RecycleMatTopId,
|
|
RecycleMatTop.ProjectId,
|
|
RecycleMatTop.Jot_ID,
|
|
RecycleMatTop.WeldId,
|
|
RecycleMatTop.UsingPlanId,
|
|
RecycleMatTop.RecycleAmount,
|
|
RecycleMatTop.RecycleMan,
|
|
RecycleMatTop.RecycleDate,
|
|
RecycleMatTop.StockMan,
|
|
RecycleMatTop.Moneys,
|
|
RecycleMatTop.IsWelderConfirm,
|
|
RecycleMatTop.IsStoreManConfirm,
|
|
Project.ProjectCode,
|
|
Project.ProjectName,
|
|
WeldInfo.WeldCode,
|
|
WeldInfo.WeldName,
|
|
WeldInfo.WeldSpec,
|
|
WeldType.WeldTypeName,
|
|
WeldType.WeldUnit,
|
|
Storeman.StoreName AS StockManName,
|
|
Welder.WED_Code AS WelderCode,
|
|
Welder.WED_Name AS RecycleManName"
|
|
+ @" FROM dbo.Weld_RecycleMatTop AS RecycleMatTop"
|
|
+ @" LEFT JOIN dbo.Base_Project AS Project ON Project.ProjectId=RecycleMatTop.ProjectId"
|
|
+ @" LEFT JOIN dbo.Weld_WeldInfo AS WeldInfo ON WeldInfo.WeldId=RecycleMatTop.WeldId"
|
|
+ @" LEFT JOIN dbo.Weld_WeldType AS WeldType ON WeldType.WeldTypeId=WeldInfo.WeldTypeId"
|
|
+ @" LEFT JOIN dbo.Weld_Storeman AS Storeman ON Storeman.StoremanId=RecycleMatTop.StockMan"
|
|
+ @" LEFT JOIN dbo.HJGL_BS_Welder AS Welder ON Welder.WED_ID=RecycleMatTop.RecycleMan"
|
|
+ @" WHERE Project.ProjectSoft='2' ";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
if (!string.IsNullOrEmpty(this.txtWelderCode.Text.Trim()))
|
|
{
|
|
strSql += " AND WED_Code LIKE @WelderCode";
|
|
listStr.Add(new SqlParameter("@WelderCode", "%" + this.txtWelderCode.Text.Trim() + "%"));
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtProjectCode.Text.Trim()))
|
|
{
|
|
strSql += " AND ProjectCode LIKE @ProjectCode";
|
|
listStr.Add(new SqlParameter("@ProjectCode", "%" + this.txtProjectCode.Text.Trim() + "%"));
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtWeldName.Text.Trim()))
|
|
{
|
|
strSql += " AND WeldName LIKE @WeldName";
|
|
listStr.Add(new SqlParameter("@WeldName", "%" + this.txtWeldName.Text.Trim() + "%"));
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtJOT_ID.Text.Trim()))
|
|
{
|
|
strSql += " AND Jot_ID LIKE @Jot_ID";
|
|
listStr.Add(new SqlParameter("@Jot_ID", "%" + this.txtJOT_ID.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 表头过滤
|
|
protected void Grid1_FilterChange(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 Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
Grid1.SortDirection = e.SortDirection;
|
|
Grid1.SortField = e.SortField;
|
|
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 查询
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
}
|
|
} |