157 lines
		
	
	
		
			5.5 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			157 lines
		
	
	
		
			5.5 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 LargeEngineeringItem : PageBase
 | ||
|     {
 | ||
| 
 | ||
|         #region 加载页面
 | ||
|         /// <summary>
 | ||
|         /// 加载页面
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void Page_Load(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (!IsPostBack)
 | ||
|             {
 | ||
|                 btnClose.OnClientClick = ActiveWindow.GetHideReference();
 | ||
|                 string projectId = Request.Params["projectId"];
 | ||
|                 this.txtProject.Text=ProjectService.GetProjectNameByProjectId(projectId);
 | ||
|                 Funs.DropDownPageSize(this.ddlPageSize);        
 | ||
|                 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 L.HazardId,L.ProjectId,L.Address,Users.UserName,L.ExpectedTime,L.RecordTime ,L.TrainPersonNum 
 | ||
|                     ,case L.States when '1' then '审批完成' when '2' then '作业中' when '3' then '已关闭'
 | ||
|                     when '0' then '已取消' else '' end as StatesStr
 | ||
|                     , case when L.IsArgument=1 then '是' else '否' end as IsArgumentStr,Const.ConstText as TypeName
 | ||
|                     ,case when L.IsSuperLargerHazard=1 then '是' else '否' end as IsSuperLargerHazardStr
 | ||
|                     FROM Solution_LargerHazard AS L 
 | ||
|                     LEFT JOIN Sys_User AS Users ON L.RecardMan=Users.UserId 
 | ||
|                     LEFT JOIN Sys_Const AS Const ON L.HazardType=Const.ConstValue and Const.GroupId='LargerHazardType' 
 | ||
|                     LEFT JOIN Sys_CodeRecords AS CodeRecords ON L.HazardId=CodeRecords.DataId WHERE 1=1  ";
 | ||
|             List<SqlParameter> listStr = new List<SqlParameter>();
 | ||
|             strSql += " AND L.ProjectId = @ProjectId";
 | ||
|             listStr.Add(new SqlParameter("@ProjectId", Request.Params["projectId"]));
 | ||
| 
 | ||
|             if (!string.IsNullOrEmpty(txtStartTime.Text.Trim()))
 | ||
|             {
 | ||
|                 strSql += " AND L.RecordTime >= @StartTime";
 | ||
|                 listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text.Trim()));
 | ||
|             }
 | ||
|             if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
 | ||
|             {
 | ||
|                 strSql += " AND L.RecordTime <= @EndTime";
 | ||
|                 listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text.Trim()));
 | ||
|             }
 | ||
|             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
 | ||
| 
 | ||
|         #region Grid双击事件 编辑
 | ||
|         /// <summary>
 | ||
|         /// Grid行双击事件
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
 | ||
|         {
 | ||
|             EditData();
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 
 | ||
|         /// </summary>
 | ||
|         private void EditData()
 | ||
|         {
 | ||
|             if (Grid1.SelectedRowIndexArray.Length == 0)
 | ||
|             {
 | ||
|                 Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
 | ||
|                 return;
 | ||
|             }
 | ||
|             PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../HSSE/Solution/LargerHazardView.aspx?HazardId={0}", Grid1.SelectedRowID, "查看 - ")));
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void btnView_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             EditData();
 | ||
|         }
 | ||
|     }
 | ||
| } |