103 lines
4.8 KiB
C#
103 lines
4.8 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Web.Services;
|
|
|
|
namespace FineUIPro.Web.ProjectData
|
|
{
|
|
public partial class ConstructionRiskMap : PageBase
|
|
{
|
|
|
|
public string Coordinate = "";
|
|
public string ProjectCode = "";
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
string strSql = @"SELECT b.[UnitWorkId],b.[Coordinate],b.[UnitWorkName],count(*) num ,max(case when RiskLevel='低风险' then 1 when RiskLevel='一般风险' then 2 when RiskLevel='较大风险' then 3 else 4 end) RiskLevel
|
|
FROM [dbo].[HSSE_ConstructionRisk] a left join [dbo].[WBS_UnitWork] b on a.[WorkAreaId]=b.[UnitWorkId]
|
|
where a.ProjectId=@ProjectId and a.States='4'
|
|
group by b.[UnitWorkId],b.[Coordinate],b.[UnitWorkName]";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@ProjectId", CurrUser.LoginProjectId));
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
foreach(DataRow row in tb.Rows)
|
|
{
|
|
Coordinate += row["UnitWorkId"].ToString() + ";" + row["UnitWorkName"].ToString() + ";" + row["num"].ToString() + ";" + row["Coordinate"].ToString()+";"+ row["RiskLevel"].ToString() + ",";
|
|
}
|
|
Coordinate = Coordinate.TrimEnd(',');
|
|
ProjectCode = BLL.ProjectService.GetProjectCodeByProjectId(this.CurrUser.LoginProjectId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[WebMethod]
|
|
public static string getRisk(string WorkAreaId,string RiskLevel)
|
|
{
|
|
string res = "";
|
|
string strSql = @"SELECT [ConstructionRiskId]
|
|
,b.UnitName
|
|
,[ConstructionContent]
|
|
,[RefLicense]
|
|
,[LicenseDes]
|
|
,[RiskLevel]
|
|
,[States]
|
|
,[DateA]
|
|
,[DateZ]
|
|
,[DateWeek]
|
|
,[ProjectId]
|
|
,[Coordinate]
|
|
FROM [dbo].[HSSE_ConstructionRisk] a left join Base_Unit b on a.[UnitId] = b.[UnitId]
|
|
where a.WorkAreaId=@WorkAreaId and a.States='4'
|
|
";
|
|
|
|
if (!string.IsNullOrEmpty(RiskLevel))
|
|
{
|
|
strSql += " and RiskLevel='"+ RiskLevel + "'";
|
|
}
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@WorkAreaId", WorkAreaId));
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
foreach (DataRow row in tb.Rows)
|
|
{
|
|
res += row["ConstructionRiskId"].ToString() + ";" + row["UnitName"].ToString() + ";" + Funs.GetNewDateTimeOrNow( row["DateA"].ToString()).ToString("yyyy-MM-dd")+"至"+ Funs.GetNewDateTimeOrNow(row["DateZ"].ToString()).ToString("yyyy-MM-dd") + ";" + row["RiskLevel"].ToString() + ";" + row["ConstructionContent"].ToString() + ";" + row["Coordinate"].ToString() + ",";
|
|
}
|
|
res = res.TrimEnd(',');
|
|
|
|
return res;
|
|
}
|
|
|
|
protected void drpRiskLevel_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
string strSql = @"SELECT b.[UnitWorkId],b.[Coordinate],b.[UnitWorkName],count(*) num ,max(case when RiskLevel='低风险' then 1 when RiskLevel='一般风险' then 2 when RiskLevel='较大风险' then 3 else 4 end) RiskLevel
|
|
FROM [dbo].[HSSE_ConstructionRisk] a left join [dbo].[WBS_UnitWork] b on a.[WorkAreaId]=b.[UnitWorkId]
|
|
where a.ProjectId=@ProjectId and a.States='4'
|
|
";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@ProjectId", CurrUser.LoginProjectId));
|
|
if (!string.IsNullOrEmpty(drpRiskLevel.SelectedValue))
|
|
{
|
|
strSql += " and RiskLevel='" + drpRiskLevel.SelectedValue + "' ";
|
|
}
|
|
strSql += " group by b.[UnitWorkId],b.[Coordinate],b.[UnitWorkName] ";
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
foreach (DataRow row in tb.Rows)
|
|
{
|
|
Coordinate += row["UnitWorkId"].ToString() + ";" + row["UnitWorkName"].ToString() + ";" + row["num"].ToString() + ";" + row["Coordinate"].ToString() + ";" + row["RiskLevel"].ToString() + ",";
|
|
}
|
|
Coordinate = Coordinate.TrimEnd(',');
|
|
|
|
PageContext.RegisterStartupScript(" setRiskLevel('" + drpRiskLevel.SelectedValue + "'); clearOverlays() ; drawMap('" + Coordinate + "') ");
|
|
|
|
}
|
|
}
|
|
} |