190 lines
6.3 KiB
C#
190 lines
6.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BLL;
|
|
|
|
namespace FineUIPro.Web.ZHGL.ManagementReport
|
|
{
|
|
public partial class CheckDaily : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
////权限按钮方法
|
|
this.GetButtonPower();
|
|
|
|
// 绑定表格
|
|
//BindGrid();
|
|
InitTreeMenu();
|
|
}
|
|
}
|
|
|
|
private void InitTreeMenu()
|
|
{
|
|
this.tvControlItem.Nodes.Clear();
|
|
TreeNode rootNode = new TreeNode();
|
|
rootNode.Text = "项目";
|
|
rootNode.NodeID = "0";
|
|
rootNode.Expanded = true;
|
|
this.tvControlItem.Nodes.Add(rootNode);
|
|
|
|
var project = (from x in Funs.DB.Base_Project
|
|
select new { x.ProjectId, x.ProjectName }).Distinct();
|
|
if (project.Count() > 0)
|
|
{
|
|
foreach (var pro in project)
|
|
{
|
|
TreeNode tnProject = new TreeNode();//年节点
|
|
tnProject.Text = SubStr(pro.ProjectName);
|
|
tnProject.NodeID = pro.ProjectId;
|
|
tnProject.ToolTip = pro.ProjectName;
|
|
tnProject.EnableClickEvent = true;
|
|
rootNode.Nodes.Add(tnProject);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
#region
|
|
private void BindGrid()
|
|
{
|
|
SqlParameter[] parameter = new SqlParameter[]
|
|
{
|
|
new SqlParameter("@ProjectId", tvControlItem.SelectedNodeID),
|
|
new SqlParameter("@StartTime", !string.IsNullOrEmpty(this.txtStartTime.Text)?this.txtStartTime.Text:null),
|
|
new SqlParameter("@EndTime", !string.IsNullOrEmpty(this.txtEndTime.Text)?this.txtEndTime.Text:null),
|
|
new SqlParameter("@States", !string.IsNullOrEmpty(Request.Params["projectId"])?BLL.Const.State_2:null),
|
|
new SqlParameter("@UnitName", !string.IsNullOrEmpty(this.txtUnitName.Text)?this.txtUnitName.Text:null),
|
|
new SqlParameter("@WorkAreaName", !string.IsNullOrEmpty(this.txtWorkAreaName.Text)?this.txtWorkAreaName.Text:null)
|
|
};
|
|
DataTable tb = SQLHelper.GetDataTableRunProc("SpCheckDayStatistic", parameter);
|
|
// 2.获取当前分页数据
|
|
//var table = this.GetPagedDataTable(Grid1, tb1);
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
for (int i = 0; i < Grid1.Rows.Count; i++)
|
|
{
|
|
string[] rowID = Grid1.Rows[i].DataKeys[0].ToString().Split(',');
|
|
if (rowID.Count() > 0)
|
|
{
|
|
var checkDay = BLL.Check_CheckDayService.GetCheckDayByCheckDayId(rowID[0]);
|
|
if (checkDay != null)
|
|
{
|
|
if (checkDay.States == BLL.Const.State_2)
|
|
{
|
|
if (rowID.Count() > 1)
|
|
{
|
|
Model.Check_CheckDayDetail detail = BLL.Check_CheckDayDetailService.GetCheckDayDetailByCheckDayDetailId(rowID[1]);
|
|
if (detail != null)
|
|
{
|
|
if (!detail.CompletedDate.HasValue)
|
|
{
|
|
Grid1.Rows[i].RowCssClass = "Yellow";
|
|
}
|
|
}
|
|
//else
|
|
//{
|
|
// Grid1.Rows[i].RowCssClass = "Red";
|
|
//}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Grid1.Rows[i].RowCssClass = "Green";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#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)
|
|
{
|
|
Grid1.PageIndex = e.NewPageIndex;
|
|
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();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 获取按钮权限
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
if (Request.Params["value"] == "0")
|
|
{
|
|
return;
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
private string SubStr(string str)
|
|
{
|
|
string reStr = string.Empty;
|
|
if (!string.IsNullOrEmpty(str) && str.Length > 16)
|
|
{
|
|
reStr = str.Substring(0, 16) + "..";
|
|
}
|
|
return reStr;
|
|
}
|
|
}
|
|
} |