159 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			159 lines
		
	
	
		
			5.6 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;
 | 
						|
using AspNet = System.Web.UI.WebControls;
 | 
						|
using System.Drawing;
 | 
						|
 | 
						|
namespace FineUIPro.Web.WeldingProcess.PMI
 | 
						|
{
 | 
						|
    public partial class PMIDelegationReport : PageBase
 | 
						|
    {
 | 
						|
        #region 加载
 | 
						|
        /// <summary>
 | 
						|
        /// 加载页面
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Page_Load(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (!IsPostBack)
 | 
						|
            {
 | 
						|
                this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
 | 
						|
                BLL.Base_UnitService.InitProjectUnitDropDownList(this.drpUnitId, true, this.CurrUser.LoginProjectId, BLL.Const.UnitType_5, Resources.Lan.PleaseSelect);//单位
 | 
						|
                BLL.Project_WorkAreaService.InitWorkAreaDropDownList(this.drpWorkAreaId, true, this.CurrUser.LoginProjectId, string.Empty, this.drpUnitId.SelectedValue, string.Empty, Resources.Lan.PleaseSelect);//区域
 | 
						|
                this.BindGrid();
 | 
						|
            }
 | 
						|
        }
 | 
						|
      
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 绑定数据
 | 
						|
        /// </summary>
 | 
						|
        private void BindGrid()
 | 
						|
        {
 | 
						|
            var query = Funs.DB.View_PMIDetections.Where(t => t.ProjectId == this.CurrUser.LoginProjectId).AsQueryable();
 | 
						|
 | 
						|
            
 | 
						|
            if (this.drpUnitId.SelectedValue != BLL.Const._Null)
 | 
						|
            {
 | 
						|
                query = query.Where(t => t.UnitId == this.drpUnitId.SelectedValue);
 | 
						|
            }
 | 
						|
            if (this.drpWorkAreaId.SelectedValue != BLL.Const._Null)
 | 
						|
            {
 | 
						|
                query = query.Where(t => t.WorkAreaId == this.drpWorkAreaId.SelectedValue);
 | 
						|
            }
 | 
						|
            if (this.drpIsALl.SelectedValue=="报警")
 | 
						|
            {
 | 
						|
                query = query.Where(t=>(t.RateBys<=2 || t.PMIBySNum<=2) || (t.RateByf<=2 || t.PMIByFNum<=2));
 | 
						|
            }
 | 
						|
            if (!string.IsNullOrEmpty(this.txtPipelineCode.Text))
 | 
						|
            {
 | 
						|
                query = query.Where(t => t.PipelineCode.Contains(this.txtPipelineCode.Text));
 | 
						|
            }
 | 
						|
            var dataList=query.ToList();
 | 
						|
            this.Grid1.RecordCount = dataList.Count;
 | 
						|
            var table = this.GetPagedDataTable(Grid1, dataList);
 | 
						|
            Grid1.DataSource = table;
 | 
						|
            Grid1.DataBind();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <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 ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
 | 
						|
        {
 | 
						|
            DataRowView row = e.DataItem as DataRowView;
 | 
						|
            decimal rates =Math.Round(Convert.ToDecimal(row["RateBys"]),2);
 | 
						|
            decimal ratef = Math.Round(Convert.ToDecimal(row["RateByf"]), 2);
 | 
						|
            AspNet.Label itemLable = e.Row.FindControl("labRateBys") as AspNet.Label;
 | 
						|
            AspNet.Label labPMIBySNum = e.Row.FindControl("labPMIBySNum") as AspNet.Label;
 | 
						|
 | 
						|
            AspNet.Label labRateByf = e.Row.FindControl("labRateByf") as AspNet.Label;
 | 
						|
            AspNet.Label labPMIByFNum = e.Row.FindControl("labPMIByFNum") as AspNet.Label;
 | 
						|
            int PMIBySNum = Convert.ToInt32(labPMIBySNum.Text);
 | 
						|
            itemLable.Text = rates.ToString() + "%";
 | 
						|
            int PMIByFNum = Convert.ToInt32(labPMIByFNum.Text);
 | 
						|
            labRateByf.Text = ratef.ToString() + "%";
 | 
						|
            if ((rates <= 2 || PMIBySNum <= 2) || (ratef <= 2 || PMIByFNum <= 2))
 | 
						|
            {
 | 
						|
                e.RowCssClass = "color1";
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 排序
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
 | 
						|
        {
 | 
						|
            this.BindGrid();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 统计按钮事件
 | 
						|
        /// <summary>
 | 
						|
        /// 统计
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void BtnAnalyse_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            BindGrid();
 | 
						|
            
 | 
						|
        }
 | 
						|
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 下拉选择事件
 | 
						|
        /// <summary>
 | 
						|
        /// 单位下拉选择事件
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void drpUnitId_SelectedIndexChanged(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            this.drpWorkAreaId.Items.Clear();
 | 
						|
            if (this.drpUnitId.SelectedValue != BLL.Const._Null)
 | 
						|
            {
 | 
						|
                BLL.Project_WorkAreaService.InitWorkAreaDropDownList(this.drpWorkAreaId, true, this.CurrUser.LoginProjectId, string.Empty, this.drpUnitId.SelectedValue, string.Empty, Resources.Lan.PleaseSelect);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                Funs.FineUIPleaseSelect(this.drpWorkAreaId, Resources.Lan.PleaseSelect);
 | 
						|
            }
 | 
						|
            this.drpWorkAreaId.SelectedValue = BLL.Const._Null;
 | 
						|
        }
 | 
						|
 | 
						|
        protected void drpIsALl_SelectedIndexChanged(object obj, EventArgs e)
 | 
						|
        {
 | 
						|
            this.BindGrid();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
} |