2023-11-11
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using BLL;
|
||||
using FineUIPro.Web.BaseInfo;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -25,6 +26,8 @@ namespace FineUIPro.Web.DataShow
|
||||
BLL.ProjectService.InitProjectDropDownList(this.drpProject, true);
|
||||
// 绑定表格t
|
||||
BindGrid();
|
||||
// 合计
|
||||
OutputSummaryData();
|
||||
this.Panel1.Title = "安全风险数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")";
|
||||
}
|
||||
}
|
||||
@@ -216,17 +219,13 @@ namespace FineUIPro.Web.DataShow
|
||||
}
|
||||
return cout1;
|
||||
}
|
||||
/// <summary>
|
||||
/// 定义变量
|
||||
/// </summary>
|
||||
private static IQueryable<Model.Hazard_HazardList> getDataLists = from x in Funs.DB.Hazard_HazardList
|
||||
select x;
|
||||
|
||||
/// <summary>
|
||||
/// 定义变量
|
||||
/// </summary>
|
||||
private static IQueryable<Model.Hazard_HazardSelectedItem> getDataItemLists = from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
where x.IsStart == true
|
||||
select x;
|
||||
where x.IsStart == true
|
||||
select x;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -239,10 +238,40 @@ namespace FineUIPro.Web.DataShow
|
||||
var getlevel = Funs.DB.Base_RiskLevel.FirstOrDefault(x => x.RiskLevel == level);
|
||||
if (getlevel != null)
|
||||
{
|
||||
count = getDataItemLists.Where(x => x.ProjectId == projectId && x.HazardLevel == getlevel.RiskLevelId).Count();
|
||||
string levels = getlevel.RiskLevel.ToString();
|
||||
count = getDataItemLists.Where(x => x.ProjectId == projectId&& x.HazardLevel== levels).Count();
|
||||
}
|
||||
return count;
|
||||
|
||||
}
|
||||
|
||||
#region 合计
|
||||
private void OutputSummaryData() {
|
||||
string strSql = @"select ProjectId,ProjectCode, ProjectName ,
|
||||
isnull((select count(*) from Hazard_HazardSelectedItem as a where a.IsStart=1 and a.ProjectId=p.ProjectId and a.HazardLevel='1'),0) as Count1,
|
||||
isnull((select count(*) from Hazard_HazardSelectedItem as a where a.IsStart=1 and a.ProjectId=p.ProjectId and a.HazardLevel='2' ),0) as Count2,
|
||||
isnull((select count(*) from Hazard_HazardSelectedItem as a where a.IsStart=1 and a.ProjectId=p.ProjectId and a.HazardLevel='3'),0) as Count3,
|
||||
isnull((select count(*) from Hazard_HazardSelectedItem as a where a.IsStart=1 and a.ProjectId=p.ProjectId and a.HazardLevel='4'),0) as Count4
|
||||
from Base_Project as P where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9)";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
int Count1 = 0, Count2 = 0, Count3 = 0, Count4 = 0;
|
||||
foreach (DataRow row in tb.Rows)
|
||||
{
|
||||
Count1 += Convert.ToInt32(row["Count1"]);
|
||||
Count2 += Convert.ToInt32(row["Count2"]);
|
||||
Count3 += Convert.ToInt32(row["Count3"]);
|
||||
Count4 += Convert.ToInt32(row["Count4"]);
|
||||
}
|
||||
JObject summary = new JObject();
|
||||
summary.Add("ProjectName", "合计:");
|
||||
summary.Add("Count1", Count1.ToString());
|
||||
summary.Add("Count2", Count2.ToString());
|
||||
summary.Add("Count3", Count3.ToString());
|
||||
summary.Add("Count4", Count4.ToString());
|
||||
Grid1.SummaryData = summary;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user