public IList <PmsEvmRawDataByUser> SelectPmsEvmRawDataByUser(PmsEvmRawDataByUser pmsEvmRawDataByUser) { try { IList <PmsEvmRawDataByUser> result = m_PMSSqlConnection.QueryForList <PmsEvmRawDataByUser>("SelectPmsEvmRawDataByUser", pmsEvmRawDataByUser); return(result); } catch (Exception ex) { m_Logger.Error("PmsEvmRawDataByUserBiz/SelectPmsEvmRawDataByUser:" + ex.ToString()); return(null); } }
private void BindReportViewer() { try { string userDept = DropDownListDepartment.SelectedValue.Trim(); string userName = TextBoxUserName.Text.Trim(); DateTime currentDate = DateTime.Now; DateTime dateFrom = DateTime.Parse(TextBoxDateFrom.Text.Trim()).Date; DateTime dateTo = DateTime.Parse(TextBoxDateTo.Text.Trim()).Date; new PmsDevelopmentProcessMeasurementBiz().DeletePmsDevelopmentProcessMeasurementAll(); //1.根据userDept和userName取得项目 PmsEvmRawDataByUser pmsEvmRawDataByUser = new PmsEvmRawDataByUser { UserDept = userDept, UserName = userName }; IList <PmsEvmRawDataByUser> listPmsEvmRawDataByUser = new PmsEvmRawDataByUserBiz().SelectPmsEvmRawDataByUser(pmsEvmRawDataByUser); //2.根据dateFrom和dateTo过滤ReleaseDate在此之间的项目 listPmsEvmRawDataByUser = listPmsEvmRawDataByUser.Where(t => (t.ReleaseDate.Date >= dateFrom && t.ReleaseDate.Date <= dateTo)).ToList(); //3.根据User的统计项目 if (listPmsEvmRawDataByUser.Count > 0) { IList <string> listUser = listPmsEvmRawDataByUser.Select(t => t.UserName).ToList(); foreach (var user in listUser) { listPmsEvmRawDataByUser = listPmsEvmRawDataByUser.Where(t => t.UserName == user).ToList(); PmsDevelopmentProcessMeasurement pmsDevelopmentProcessMeasurement = new PmsDevelopmentProcessMeasurement(); pmsDevelopmentProcessMeasurement.Vid = "PM"; pmsDevelopmentProcessMeasurement.UserDept = listPmsEvmRawDataByUser.FirstOrDefault().UserDept; pmsDevelopmentProcessMeasurement.UserName = user; pmsDevelopmentProcessMeasurement.CrCount = listPmsEvmRawDataByUser.Count; pmsDevelopmentProcessMeasurement.LargelyAdvance = listPmsEvmRawDataByUser.Where(t => t.Sv >= 8).Count(); pmsDevelopmentProcessMeasurement.Advance = listPmsEvmRawDataByUser.Where(t => t.Sv < 8 && t.Sv > 0).Count(); pmsDevelopmentProcessMeasurement.Normal = listPmsEvmRawDataByUser.Where(t => t.Sv == 0).Count(); pmsDevelopmentProcessMeasurement.Delay = listPmsEvmRawDataByUser.Where(t => t.Sv <0 && t.Sv> -8).Count(); pmsDevelopmentProcessMeasurement.LargelyDelay = listPmsEvmRawDataByUser.Where(t => t.Sv <= -8).Count(); pmsDevelopmentProcessMeasurement.LargelySurplus = listPmsEvmRawDataByUser.Where(t => t.Cv >= 8).Count(); pmsDevelopmentProcessMeasurement.Surplus = listPmsEvmRawDataByUser.Where(t => t.Cv < 8 && t.Cv > 0).Count(); pmsDevelopmentProcessMeasurement.Balance = listPmsEvmRawDataByUser.Where(t => t.Cv == 0).Count(); pmsDevelopmentProcessMeasurement.Deficit = listPmsEvmRawDataByUser.Where(t => t.Cv <0 && t.Cv> -8).Count(); pmsDevelopmentProcessMeasurement.LargelyDeficit = listPmsEvmRawDataByUser.Where(t => t.Cv <= -8).Count(); //进度偏差得分 int scheduleVarianceScore = pmsDevelopmentProcessMeasurement.LargelyAdvance * 5 + pmsDevelopmentProcessMeasurement.Advance * 3 + pmsDevelopmentProcessMeasurement.Normal * 1 + pmsDevelopmentProcessMeasurement.Delay * (-3) + pmsDevelopmentProcessMeasurement.LargelyDelay * (-5); //成本偏差得分 int costVarianceScore = pmsDevelopmentProcessMeasurement.LargelySurplus * 5 + pmsDevelopmentProcessMeasurement.Surplus * 3 + pmsDevelopmentProcessMeasurement.Balance * 1 + pmsDevelopmentProcessMeasurement.Deficit * (-3) + pmsDevelopmentProcessMeasurement.LargelyDeficit * (-5); //基本得分 int baseScore = pmsDevelopmentProcessMeasurement.CrCount * 1; //进度偏差评价 pmsDevelopmentProcessMeasurement.ScheduleEvaluation = GetEvaluationByScore(scheduleVarianceScore, baseScore); //成本偏差评价 pmsDevelopmentProcessMeasurement.ScheduleEvaluation = GetEvaluationByScore(costVarianceScore, baseScore); pmsDevelopmentProcessMeasurement.CreateDate = currentDate; pmsDevelopmentProcessMeasurement.Creator = WSC.GlobalDefinition.Cookie_LoginUser.Replace(" ", "."); new PmsDevelopmentProcessMeasurementBiz().InsertPmsDevelopmentProcessMeasurement(pmsDevelopmentProcessMeasurement); } } string reportPath = GetReportPath(); SetReportViewParameter(ReportViewer1, reportPath); ReportParameter[] reportParameter = new ReportParameter[4]; reportParameter[0] = new ReportParameter("UserDept", userDept); reportParameter[1] = new ReportParameter("UserName", userName); reportParameter[2] = new ReportParameter("DateFrom", dateFrom.ToString("yyyy-MM-dd")); reportParameter[3] = new ReportParameter("DateTo", dateTo.ToString("yyyy-MM-dd")); ReportViewer1.ServerReport.SetParameters(reportParameter); ReportViewer1.ServerReport.Refresh(); } catch (Exception ex) { } }