184 lines
6.4 KiB
C#
184 lines
6.4 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using BLL;
|
||
using System.Data.SqlClient;
|
||
using System.Data;
|
||
|
||
namespace FineUIPro.Web.HJGL.CheckManage
|
||
{
|
||
public partial class NDTRemakeReport : PageBase
|
||
{
|
||
|
||
#region 加载
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
this.drpProjectId.DataTextField = "ProjectCode";
|
||
this.drpProjectId.DataValueField = "ProjectId";
|
||
this.drpProjectId.DataSource = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
||
this.drpProjectId.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpProjectId);
|
||
|
||
this.InitTreeMenu();//加载树
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 加载树施工号
|
||
/// <summary>
|
||
/// 加载树
|
||
/// </summary>
|
||
private void InitTreeMenu()
|
||
{
|
||
this.tvControlItem.Nodes.Clear();
|
||
TreeNode rootNode = new TreeNode();
|
||
rootNode.Text = "施工号";
|
||
rootNode.ToolTip = "项目";
|
||
rootNode.NodeID = "0";
|
||
rootNode.Expanded = true;
|
||
this.tvControlItem.Nodes.Add(rootNode);
|
||
|
||
List<Model.Base_Project> projects = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
||
if (this.drpProjectId.SelectedValue != null && this.drpProjectId.SelectedValue != "null")
|
||
{
|
||
projects = projects.Where(x => x.ProjectId == this.drpProjectId.SelectedValue).ToList();
|
||
}
|
||
|
||
foreach (var item in projects)
|
||
{
|
||
TreeNode rootProjectNode = new TreeNode();//定义根节点
|
||
rootProjectNode.Text = item.ProjectCode;
|
||
rootProjectNode.NodeID = item.ProjectId;
|
||
rootProjectNode.Expanded = true;
|
||
rootProjectNode.ToolTip = item.ProjectName;
|
||
rootProjectNode.CommandName = "施工号";
|
||
rootProjectNode.EnableClickEvent = true;
|
||
rootNode.Nodes.Add(rootProjectNode);
|
||
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 关闭弹出窗口
|
||
/// <summary>
|
||
/// 关闭弹出窗口
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Window1_Close(object sender, EventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#region TreeView点击事件
|
||
/// <summary>
|
||
/// TreeView点击事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs 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>
|
||
private void BindGrid()
|
||
{
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
string projectId = string.Empty;
|
||
string startDate = this.txtStartDate.Text.Trim();
|
||
string endDate = this.txtEndDate.Text.Trim();
|
||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID) && this.tvControlItem.SelectedNodeID != "0")
|
||
{
|
||
projectId = this.tvControlItem.SelectedNodeID;
|
||
}
|
||
string parm = projectId + "," + startDate + "," + endDate;
|
||
listStr.Add(new SqlParameter("@parm", parm));
|
||
SqlParameter[] parameter = listStr.ToArray();
|
||
DataTable tb = SQLHelper.GetDataTableRunProc("HJGL_sp_rpt_RemakeReason", parameter);
|
||
this.Grid1.RecordCount = tb.Rows.Count;
|
||
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||
var table = this.GetPagedDataTable(Grid1, tb);
|
||
Grid1.DataSource = table;
|
||
Grid1.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 树查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
this.InitTreeMenu();
|
||
}
|
||
|
||
#region 工程无损检测重拍报表打印
|
||
/// <summary>
|
||
/// 工程无损检测重拍报表打印
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnPrint_Click(object sender, EventArgs e)
|
||
{
|
||
string projectId = string.Empty;
|
||
string startDate = this.txtStartDate.Text.Trim();
|
||
string endDate = this.txtEndDate.Text.Trim();
|
||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID) && this.tvControlItem.SelectedNodeID != "0")
|
||
{
|
||
projectId = this.tvControlItem.SelectedNodeID;
|
||
}
|
||
string parm = projectId + "," + startDate + "," + endDate;
|
||
string varValue = String.Empty;
|
||
if (!string.IsNullOrEmpty(startDate) || !string.IsNullOrEmpty(endDate))
|
||
{
|
||
varValue = startDate + "~" + endDate;
|
||
}
|
||
varValue = HttpUtility.UrlEncodeUnicode(varValue);
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../Common/ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId=0", BLL.Const.HJGL_NDTRemakeReportId, parm, varValue, "打印 - ")));
|
||
}
|
||
#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
|
||
}
|
||
} |