63 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Linq;
 | 
						|
using System.Web;
 | 
						|
using System.Web.UI;
 | 
						|
using System.Web.UI.WebControls;
 | 
						|
using BLL;
 | 
						|
 | 
						|
namespace FineUIPro.Web.common
 | 
						|
{
 | 
						|
    public partial class mainMenu_SYHSEN : PageBase
 | 
						|
    {
 | 
						|
 | 
						|
        public string risk
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                return (string)ViewState["risk"];
 | 
						|
            }
 | 
						|
            set
 | 
						|
            {
 | 
						|
                ViewState["risk"] = value;
 | 
						|
            }
 | 
						|
        }
 | 
						|
        protected void Page_Load(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (!IsPostBack)
 | 
						|
            {
 | 
						|
                risk = "";
 | 
						|
                var values = Funs.DB.Hazard_RealTimeValue.OrderByDescending(x => x.DateTime).Take(20).ToList();
 | 
						|
                int i = 1;
 | 
						|
                foreach (var item in values)
 | 
						|
                {
 | 
						|
                    var device = Funs.DB.Hazard_RealTimeDevice.FirstOrDefault(x => x.BitNum == item.BitNum);
 | 
						|
                    if (device != null)
 | 
						|
                    {
 | 
						|
                        risk += @"<div class='swiper-slide'>
 | 
						|
                        <a class='news-item' title='1.风险分级管理' href='javascrilt:;'>"
 | 
						|
                           + (i++) + "." + device.HazardName + "-" + device.DeviceName + "-风险" + device.HazardLevel + "-" + device.Medium + "-" + item.Value + device.MeasurementUnit + "-时间 " + item.DateTime +
 | 
						|
                          @"</a>
 | 
						|
                    </div>";
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        public string showData(int? value, string format)
 | 
						|
        {
 | 
						|
            if (value.HasValue)
 | 
						|
            {
 | 
						|
                return value.Value.ToString();
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                return format;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    }
 | 
						|
} |