106 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			106 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
using Aspose.Words;
 | 
						||
using BLL;
 | 
						||
using Org.BouncyCastle.Asn1.Ocsp;
 | 
						||
using System;
 | 
						||
using System.Collections.Generic;
 | 
						||
using System.Data;
 | 
						||
using System.Data.SqlClient;
 | 
						||
using System.IO;
 | 
						||
using System.Linq;
 | 
						||
using System.Text;
 | 
						||
 | 
						||
namespace FineUIPro.Web.DataShow
 | 
						||
{
 | 
						||
    public partial class WeldOneOKItem : PageBase
 | 
						||
    {
 | 
						||
        #region 加载页面
 | 
						||
        /// <summary>
 | 
						||
        /// 加载页面
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Page_Load(object sender, EventArgs e)
 | 
						||
        {
 | 
						||
            if (!IsPostBack)
 | 
						||
            {
 | 
						||
                string projectId = Request.Params["projectId"];
 | 
						||
                this.txtProject.Text = ProjectService.GetProjectNameByProjectId(projectId);
 | 
						||
                Funs.DropDownPageSize(this.ddlPageSize);
 | 
						||
                btnClose.OnClientClick = ActiveWindow.GetHideReference();
 | 
						||
                ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
 | 
						||
                // 绑定表格t
 | 
						||
                BindGrid();
 | 
						||
                this.Panel1.Title = "焊接一次合格率数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CWCEC) + ")";
 | 
						||
            }
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 绑定数据
 | 
						||
        /// </summary>
 | 
						||
        private void BindGrid()
 | 
						||
        {
 | 
						||
            string strSql = @"SELECT N.*, U.UnitName "
 | 
						||
                            + @" FROM ProcessControl_NondestructiveTest_New AS N"
 | 
						||
                            + @" LEFT JOIN Base_Unit AS U ON U.UnitId = N.UnitId"
 | 
						||
                            + @" WHERE N.ProjectId=@projectId  ";
 | 
						||
            List<SqlParameter> listStr = new List<SqlParameter>();
 | 
						||
            listStr.Add(new SqlParameter("@ProjectId", Request.Params["projectId"]));
 | 
						||
 | 
						||
            strSql += " AND (N.CreateDate>=@startTime or @startTime='') and (N.CreateDate<=@endTime or @endTime='') ";
 | 
						||
            listStr.Add(new SqlParameter("@startTime", !string.IsNullOrEmpty(txtStartTime.Text.Trim()) ? txtStartTime.Text.Trim() + " 00:00:00" : ""));
 | 
						||
            listStr.Add(new SqlParameter("@endTime", !string.IsNullOrEmpty(txtEndTime.Text.Trim()) ? txtEndTime.Text.Trim() + "  23:59:59" : ""));
 | 
						||
            SqlParameter[] parameter = listStr.ToArray();
 | 
						||
            DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | 
						||
            Grid1.RecordCount = tb.Rows.Count;
 | 
						||
            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 TextBox_TextChanged(object sender, EventArgs e)
 | 
						||
        {
 | 
						||
            this.BindGrid();
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 表排序、分页、关闭窗口
 | 
						||
        /// <summary>
 | 
						||
        /// 分页
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
 | 
						||
        {
 | 
						||
            BindGrid();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <summary>
 | 
						||
        /// 排序
 | 
						||
        /// </summary>
 | 
						||
        /// <param name="sender"></param>
 | 
						||
        /// <param name="e"></param>
 | 
						||
        protected void Grid1_Sort(object sender, GridSortEventArgs e)
 | 
						||
        {
 | 
						||
            BindGrid();
 | 
						||
        }
 | 
						||
 | 
						||
        /// <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
 | 
						||
    }
 | 
						||
} |