using BLL;
using FineUIPro.Web.CQMS.WBS;
using Model;
using System;
using System.Data;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.DigData
{
public partial class ProjectWBSDW : PageBase
{
///
/// 项目ID
///
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
///
/// 加载页面
///
///
///
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ProjectId = this.CurrUser.LoginProjectId;
////权限按钮方法
// this.ucTree.WorkPackageCode = this.WorkPackageCode;
this.ucTree.ProjectId = this.ProjectId;
this.btnNew.OnClientClick = Window1.GetShowReference("ShowProjectWBSPackage.aspx") + "return false;";
}
}
protected void changeTree(object sender, EventArgs e)
{
this.hdWorkPackageId.Text = this.ucTree.WorkPackageId;
initControlItem();
}
///
///
///
///
///
protected void ckType_SelectedIndexChanged(object sender, EventArgs e)
{
this.gpHSSE.Hidden = true;
this.gpCQMS.Hidden = true;
this.gpJDGL.Hidden = true;
this.gpHTGL.Hidden = true;
this.gpLW.Hidden = true;
SetData();
}
///
/// 加载工作包
///
protected void initControlItem()
{
var getControlItem = from x in Funs.DB.WBS_ControlItemAndCycle
where x.WorkPackageId == this.hdWorkPackageId.Text
select x;
cblControlItem.DataValueField = "ControlItemAndCycleId";
cblControlItem.DataTextField = "ControlItemContent";
cblControlItem.DataSource = getControlItem;
cblControlItem.DataBind();
SetData();
}
///
///
///
///
///
protected void cblControlItem_SelectedIndexChanged(object sender, EventArgs e)
{
SetData();
}
///
/// 数据展示
///
private void SetData()
{
string workPackageId = this.hdWorkPackageId.Text;
string controlItemAndCycleId = this.cblControlItem.SelectedValue;
if (workPackageId == "1" || workPackageId == "2")
{
workPackageId = "Type" + workPackageId;
}
if (!string.IsNullOrEmpty(workPackageId))
{
foreach (var item in this.ckType.SelectedValueArray)
{
if (item == "HSSE")
{
this.gpHSSE.Hidden = false;
this.lbExpertArgument.Text = (from x in Funs.DB.Solution_LargerHazardListItem
join y in Funs.DB.Solution_LargerHazardList on x.LargerHazardListId equals y.LargerHazardListId
where y.ProjectId == this.ProjectId && x.WorkPackageId.Contains(workPackageId) && y.States == Const.State_1
&& (controlItemAndCycleId == null || x.WorkPackageId.Contains(controlItemAndCycleId))
select x).Count().ToString();
}
if (item == "CQMS")
{
this.gpCQMS.Hidden = false;
var getDetail = from x in Funs.DB.Check_SpotCheckDetail
join y in Funs.DB.Check_SpotCheck on x.SpotCheckCode equals y.SpotCheckCode
where y.ProjectId == this.ProjectId && x.WorkPackageId.Contains(workPackageId) //&& y.States == Const.State_1
&& (controlItemAndCycleId == null || x.WorkPackageId.Contains(controlItemAndCycleId))
select x;
int all = getDetail.Count();
this.lbSpotCheck1.Text = all.ToString();
int okCount = getDetail.Where(x => x.IsOK == true).Count();
this.lbSpotCheck2.Text= okCount.ToString();
this.lbSpotCheck.Text= all > 0 ? Math.Round(okCount * 1.0 / (all * 1.0)).ToString() : "0";
}
if (item == "JDGL")
{
this.gpJDGL.Hidden = false;
}
if (item == "HTGL")
{
this.gpHTGL.Hidden = false;
}
if (item == "LW")
{
this.gpLW.Hidden = false;
}
}
}
}
}
}