123 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			123 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			C#
		
	
	
	
using BLL;
 | 
						|
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Data.SqlClient;
 | 
						|
using System.Data;
 | 
						|
using System.Linq;
 | 
						|
using System.Web;
 | 
						|
using System.Web.UI;
 | 
						|
using System.Web.UI.WebControls;
 | 
						|
 | 
						|
namespace FineUIPro.Web.TestRun.Produce
 | 
						|
{
 | 
						|
    public partial class InspectWanderAboutAllPassList : PageBase
 | 
						|
    {
 | 
						|
        protected void Page_Load(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (!IsPostBack)
 | 
						|
            {
 | 
						|
                BindGrid();
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #region 数据绑定
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 绑定数据
 | 
						|
        /// </summary>
 | 
						|
        public void BindGrid()
 | 
						|
        {
 | 
						|
            string sqlStr = $"select a.SubInspectId,a.ProjectId,b.ProjectName,b.ProjectCode,a.AddUser,a.AddTime,c.UserName as ContractorName,d.UserName as OwnerName,e.UserName as ProcessPatentName,IsUnifyWanderAbout,(case IsUnifyWanderAbout when 1 then '是' else '否' end) as IsUnifyWanderAboutName from ProduceRun_SubInspectTerm as a inner join Base_Project as b on a.ProjectId=b.ProjectId inner join Sys_User as c on c.UserId=a.Contractor inner join Sys_User as d on d.UserId=a.Owner inner join Sys_User as e on e.UserId = a.ProcessPatent where 1 = 1 and a.InspectionIsAllPass = 1 and a.ProjectId='{this.CurrUser.LoginProjectId}' ";
 | 
						|
            List<SqlParameter> listStr = new List<SqlParameter>();
 | 
						|
            SqlParameter[] parameter = listStr.ToArray();
 | 
						|
            DataTable tb = SQLHelper.GetDataTableRunText(sqlStr);
 | 
						|
            Grid1.RecordCount = tb.Rows.Count;
 | 
						|
            var table = this.GetPagedDataTable(Grid1, tb);
 | 
						|
            Grid1.DataSource = table;
 | 
						|
            Grid1.DataBind();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 分页
 | 
						|
        /// </summary>
 | 
						|
        protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
 | 
						|
        {
 | 
						|
            Grid1.PageIndex = e.NewPageIndex;
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 双击事件
 | 
						|
        /// </summary>
 | 
						|
        protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
 | 
						|
        {
 | 
						|
            btnMenuAllPass_Click(null, null);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 分页下拉框
 | 
						|
        /// </summary>
 | 
						|
        protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 排序
 | 
						|
        /// </summary>
 | 
						|
        protected void Grid1_Sort(object sender, GridSortEventArgs e)
 | 
						|
        {
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 按钮和事件
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 查询
 | 
						|
        /// </summary>
 | 
						|
        protected void btnQuery_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 检查全部通过
 | 
						|
        /// </summary>
 | 
						|
        protected void btnAllPass_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (Grid1.SelectedRowIndexArray.Length == 0)
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("请选择记录!", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
            if (Grid1.SelectedRowIndexArray.Length > 1)
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("只可选择一条记录!", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
            PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InspectWanderAboutAllPass.aspx?SubInspectId={0}", Grid1.DataKeys[Grid1.SelectedRowIndex][0].ToString(), "检查全部通过 - ")));
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 右击检查全部通过
 | 
						|
        /// </summary>
 | 
						|
        protected void btnMenuAllPass_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            btnAllPass_Click(null, null);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 关闭
 | 
						|
        /// </summary>
 | 
						|
        protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | 
						|
        {
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
    }
 | 
						|
} |