using BLL; using System; using System.Data; using System.Linq; namespace FineUIPro.Web.DigData { public partial class ProjectDataDW : 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; } } /// /// /// /// /// 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(); } /// /// 数据展示 /// private void SetData() { if (!string.IsNullOrEmpty(this.ProjectId)) { foreach (var item in this.ckType.SelectedValueArray) { if (item == "HSSE") { this.gpHSSE.Hidden = false; this.lbSitePersons.Text = (from x in Funs.DB.SitePerson_Person where x.ProjectId == this.ProjectId //&& y.States == Const.State_1 select x).Count().ToString(); ///安全工时 this.lbWorkHours.Text = HSEDataDWService.getProjecctSafeHours(this.ProjectId).ToString(); ///安全教育 this.lbEduCount.Text = (from x in Funs.DB.EduTrain_TrainRecord where x.ProjectId == this.ProjectId && x.States == BLL.Const.State_2 select x).Count().ToString(); ///问题整改 this.lbRectifyRate.Text = HSEDataDWService.getProblemRate(this.ProjectId); this.lbMeetingCount.Text = (Funs.DB.Meeting_AttendMeeting.Where(x => x.ProjectId == this.ProjectId && x.States == BLL.Const.State_2).Count() + Funs.DB.Meeting_ClassMeeting.Where(x => x.ProjectId == this.ProjectId && x.States == BLL.Const.State_2).Count() + Funs.DB.Meeting_MonthMeeting.Where(x => x.ProjectId == this.ProjectId && x.States == BLL.Const.State_2).Count() + Funs.DB.Meeting_SpecialMeeting.Where(x => x.ProjectId == this.ProjectId && x.States == BLL.Const.State_2).Count() + Funs.DB.Meeting_WeekMeeting.Where(x => x.ProjectId == this.ProjectId && x.States == BLL.Const.State_2).Count()).ToString(); var getCostManges = Funs.DB.CostGoods_CostManage.Where(x => x.ProjectId == this.ProjectId && x.States == Const.State_2); if (getCostManges.Count() > 0) { this.lbHSECost.Text = getCostManges.Sum(x => x.SumMoney ?? 0).ToString(); } else { this.lbHSECost.Text = "0"; } } if (item == "CQMS") { this.gpCQMS.Hidden = false; ///质量验收问题整改率 this.lbSpotCheckRate.Text = CQMSDataDWService.getSpotCheckRate(this.ProjectId); ///控制点完成率 this.lbSpotCheckDataRate.Text = CQMSDataDWService.getSpotCheckDataRate(this.ProjectId); //// 质量检查问题整改率 this.lbCheckControlStates.Text = CQMSDataDWService.getCheckControlStates(this.ProjectId); ///焊接一次合格率 this.lbFirstPassRate.Text = CQMSDataDWService.getFirstPassRate(this.ProjectId); } if (item == "JDGL") { this.gpJDGL.Hidden = false; this.lbJDRate.Text = JDGLDataDWService.getJDRate(this.ProjectId, null, null); } if (item == "HTGL") { this.gpHTGL.Hidden = false; decimal contractAmount = 0; var getContract = Funs.DB.PHTGL_Contract.Where(x => x.ProjectId == this.ProjectId); if (getContract.Count() > 0) { contractAmount = getContract.Sum(x => x.ContractAmount ?? 0); } this.lbContractAmount.Text = contractAmount.ToString(); decimal estimatedAmount = 0; var getContractTrack = Funs.DB.PHTGL_ContractTrack.Where(x => x.ProjectId == this.ProjectId); if (getContractTrack.Count() > 0) { estimatedAmount = getContractTrack.Sum(x => x.EstimatedAmount ?? 0); } this.lbEstimatedAmount.Text = estimatedAmount.ToString(); this.lbTotalProfit.Text = estimatedAmount > 0 ? Math.Round(contractAmount / estimatedAmount).ToString() + "%" : "0%"; } if (item == "LW") { this.gpLW.Hidden = false; } } } } } }