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 = ""; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strSql = @"SELECT b.[UnitWorkId],b.[Coordinate],b.[UnitWorkName],count(*) num FROM [dbo].[HSSE_ConstructionRisk] a left join [dbo].[WBS_UnitWork] b on a.[WorkAreaId]=b.[UnitWorkId] where a.ProjectId=@ProjectId group by b.[UnitWorkId],b.[Coordinate],b.[UnitWorkName]"; List listStr = new List(); 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() + ","; } Coordinate = Coordinate.TrimEnd(','); } } [WebMethod] public static string getRisk(string WorkAreaId) { 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 "; List listStr = new List(); 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["LicenseDes"].ToString() + ";" + row["Coordinate"].ToString() + ","; } res = res.TrimEnd(','); return res; } } }