536 lines
18 KiB
C#
536 lines
18 KiB
C#
using System.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Windows.Forms.VisualStyles;
|
|
using BLL;
|
|
namespace FineUIPro.Web.common
|
|
{
|
|
public partial class main2024 : PageBase
|
|
{
|
|
// 规章制度集合
|
|
private List<Model.SafeLawItem> _safeLawItems;
|
|
// 规章制度html字符串
|
|
private string _safeLawString;
|
|
|
|
// 安全标准规范集合
|
|
private List<Model.SafeLawItem> _hSseStandardItems;
|
|
// 安全标准规范html字符串
|
|
private string _hsseStandardString;
|
|
|
|
// 通知公告集合
|
|
private List<Model.NoticeOutput> _noticeOutputs;
|
|
// 通知公告html字符串
|
|
private string _noticeString;
|
|
|
|
// 新闻动态集合
|
|
private List<Model.NoticeOutput> _newsOutputs;
|
|
// 新闻动态html字符串
|
|
private string _newsString;
|
|
|
|
// 新闻图片html字符串
|
|
private string _newsImgUrlString;
|
|
/// <summary>
|
|
/// 风险预警html字符串
|
|
/// </summary>
|
|
private string _constructionRiskString;
|
|
|
|
// 姓名
|
|
private string _userName;
|
|
|
|
// 规章制度集合
|
|
public List<Model.SafeLawItem> SafeLawItems
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["safeLawItems"] != null)
|
|
{
|
|
return (List<Model.SafeLawItem>)ViewState["safeLawItems"];
|
|
}
|
|
else
|
|
{
|
|
return _safeLawItems;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
_safeLawItems = value;
|
|
ViewState["safeLawItems"] = value;
|
|
}
|
|
}
|
|
|
|
// 规章制度html字符串
|
|
public string SafeLawString
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["safeLawString"] != null)
|
|
{
|
|
return ViewState["safeLawString"].ToString();
|
|
}
|
|
else
|
|
{
|
|
return _safeLawString;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
_safeLawString = value;
|
|
ViewState["safeLawString"] = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 风险预警html字符串
|
|
/// </summary>
|
|
public string ConstructionRiskString
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["constructionRiskString"] != null)
|
|
{
|
|
return ViewState["constructionRiskString"].ToString();
|
|
}
|
|
else
|
|
{
|
|
return _constructionRiskString;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
_constructionRiskString = value;
|
|
ViewState["constructionRiskString"] = value;
|
|
}
|
|
}
|
|
// 安全标准规范集合
|
|
public List<Model.SafeLawItem> HSseStandardItems
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["hSseStandardItems"] != null)
|
|
{
|
|
return (List<Model.SafeLawItem>)ViewState["hSseStandardItems"];
|
|
}
|
|
else
|
|
{
|
|
return _hSseStandardItems;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
_hSseStandardItems = value;
|
|
ViewState["hSseStandardItems"] = value;
|
|
}
|
|
}
|
|
|
|
// 安全标准规范html字符串
|
|
public string HSseStandardString
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["hsseStandardString"] != null)
|
|
{
|
|
return ViewState["hsseStandardString"].ToString();
|
|
}
|
|
else
|
|
{
|
|
return _hsseStandardString;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
_hsseStandardString = value;
|
|
ViewState["hsseStandardString"] = value;
|
|
}
|
|
}
|
|
|
|
// 通知公告集合
|
|
public List<Model.NoticeOutput> NoticeOutputs
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["noticeOutputs"] != null)
|
|
{
|
|
return (List<Model.NoticeOutput>)ViewState["noticeOutputs"];
|
|
}
|
|
else
|
|
{
|
|
return _noticeOutputs;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
_noticeOutputs = value;
|
|
ViewState["noticeOutputs"] = value;
|
|
}
|
|
}
|
|
|
|
// 通知公告html字符串
|
|
public string NoticeString
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["noticeString"] != null)
|
|
{
|
|
return ViewState["noticeString"].ToString();
|
|
}
|
|
else
|
|
{
|
|
return _noticeString;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
_noticeString = value;
|
|
ViewState["noticeString"] = value;
|
|
}
|
|
}
|
|
|
|
// 新闻动态集合
|
|
public List<Model.NoticeOutput> NewsOutputs
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["newsOutputs"] != null)
|
|
{
|
|
return (List<Model.NoticeOutput>)ViewState["newsOutputs"];
|
|
}
|
|
else
|
|
{
|
|
return _newsOutputs;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
_newsOutputs = value;
|
|
ViewState["newsOutputs"] = value;
|
|
}
|
|
}
|
|
|
|
// 新闻动态html字符串
|
|
public string NewsString
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["newsString"] != null)
|
|
{
|
|
return ViewState["newsString"].ToString();
|
|
}
|
|
else
|
|
{
|
|
return _newsString;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
_newsString = value;
|
|
ViewState["newsString"] = value;
|
|
}
|
|
}
|
|
|
|
// 新闻图片html字符串
|
|
public string NewsImgUrlString
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["newsImgUrlString"] != null)
|
|
{
|
|
return ViewState["newsImgUrlString"].ToString();
|
|
}
|
|
else
|
|
{
|
|
return _newsImgUrlString;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
_newsImgUrlString = value;
|
|
ViewState["newsImgUrlString"] = value;
|
|
}
|
|
}
|
|
|
|
// 姓名
|
|
public string UserName
|
|
{
|
|
get
|
|
{
|
|
if (ViewState["userName"] != null)
|
|
{
|
|
return ViewState["userName"].ToString();
|
|
}
|
|
else
|
|
{
|
|
return _userName;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
_userName = value;
|
|
ViewState["userName"] = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 类型url字典
|
|
/// </summary>
|
|
private readonly Dictionary<string, string> _dicTypeUrlDictionary = new Dictionary<string, string>()
|
|
{
|
|
{ "ProjectPerson", "/DataShow/ProjectPerson.aspx" },
|
|
{ "EduTrain", "/DataShow/EduTrain.aspx" },
|
|
{ "LargeEngineering", "/DataShow/LargeEngineering.aspx" },
|
|
{ "SecurityRisk", "/DataShow/SecurityRisk.aspx" },
|
|
{ "HiddenRectification", "/DataShow/HiddenRectification.aspx" },
|
|
{ "License", "/DataShow/License.aspx" },
|
|
{ "Meeting", "/DataShow/Meeting.aspx" },
|
|
{ "SecurityCost", "/DataShow/SecurityCost.aspx" },
|
|
{ "Emergency", "/DataShow/Emergency.aspx" },
|
|
{ "HazardDetection", "/DataShow/HazardDetection.aspx" },
|
|
{ "OccupationalDiseaseAccident", "/DataShow/OccupationalDiseaseAccident.aspx" },
|
|
{ "PhysicalExamination", "/DataShow/PhysicalExamination.aspx" },
|
|
{ "Environmental", "/DataShow/Environmental.aspx" },
|
|
{ "ProjectDivision", "/DataShow/ProjectDivision.aspx" },
|
|
{ "QualityAcceptance", "/DataShow/QualityAcceptance.aspx" },
|
|
{ "QualityControlPoint", "/DataShow/QualityControlPoint.aspx" },
|
|
{ "QualityInstruments", "/DataShow/QualityInstruments.aspx" },
|
|
{ "QualityPerson", "/DataShow/QualityPerson.aspx" },
|
|
{ "QualityProblem", "/DataShow/QualityProblem.aspx" },
|
|
{ "QualityTraining", "/DataShow/QualityTraining.aspx" },
|
|
|
|
};
|
|
|
|
protected async void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
var result= await GetData().ConfigureAwait(false);
|
|
foreach (var item in SafeLawItems.OrderByDescending(x => x.CompileDate))
|
|
{
|
|
if (item.CompileDate != null)
|
|
SafeLawString +=
|
|
$" <div class=\"news-li\">\r\n <p>{item.Name}</p>\r\n <span>{item.CompileDate.Value.ToString("yyyy-MM-dd")}</span>\r\n </div>";
|
|
}
|
|
foreach (var item in HSseStandardItems.OrderByDescending(x => x.CompileDate))
|
|
{
|
|
if (item.CompileDate != null)
|
|
HSseStandardString +=
|
|
$" <div class=\"news-li\">\r\n <p>{item.Name}</p>\r\n <span>{item.CompileDate.Value.ToString("yyyy-MM-dd")}</span>\r\n </div>";
|
|
}
|
|
|
|
foreach (var item in NoticeOutputs.OrderByDescending(x => x.CompileDate))
|
|
{
|
|
if (item.CompileDate != null)
|
|
NoticeString +=
|
|
$" <div class=\"news-li\">\r\n <p>{item.NoticeTitle}</p>\r\n <span>{item.CompileDate.Value.ToString("yyyy-MM-dd")}</span>\r\n </div>";
|
|
}
|
|
|
|
foreach (var item in NewsOutputs.OrderByDescending(x => x.CompileDate))
|
|
{
|
|
if (item.CompileDate != null)
|
|
{
|
|
NewsString +=
|
|
$" <div class=\"news-li\">\r\n <p>{item.NoticeTitle}</p>\r\n <span>{item.CompileDate.Value.ToString("yyyy-MM-dd")}</span>\r\n </div>";
|
|
|
|
foreach (var url in item.AttachUrl.Split(','))
|
|
{
|
|
NewsImgUrlString +=
|
|
$" <div class=\"swiper-slide\" >\r\n <img src=\"{Funs.CNCECPath+ url}\" />\r\n </div>";
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
var ConstructionRiskItem = (from x in Funs.DB.HSSE_ConstructionRisk
|
|
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
|
|
where x.States == "4"
|
|
select new
|
|
{
|
|
x.RiskLevel,
|
|
x.DateA,
|
|
y.ShortName
|
|
|
|
}).ToList();
|
|
foreach (var item in ConstructionRiskItem.OrderByDescending(x => x.DateA))
|
|
{
|
|
if (item.DateA != null)
|
|
{
|
|
ConstructionRiskString +=
|
|
$" <div class=\"news-li\">\r\n <p>{item.ShortName+"存在"+item.RiskLevel}</p>\r\n <span>{item.DateA.Value.ToString("yyyy-MM-dd")}</span>\r\n </div>";
|
|
|
|
|
|
|
|
}
|
|
}
|
|
//根据时间判断提示是上午好还是下午好
|
|
var hello = "";
|
|
hello = DateTime.Now.Hour < 12 ? "上午好" : "下午好";
|
|
if (this.CurrUser != null)
|
|
UserName = this.CurrUser.UserName + "," + hello;
|
|
}
|
|
|
|
}
|
|
|
|
protected async Task<bool> GetData()
|
|
{
|
|
var safeLawItemsTask = ServerService.GetSafeLawListByTypeAsync("3");
|
|
var hSseStandardItemsTask = ServerService.GetSafeLawListByTypeAsync("2");
|
|
var noticeOutputsTask = ServerService.GetNoticeListAsync();
|
|
var newsOutputsTask = ServerService.GetNewsListAsync();
|
|
await Task.WhenAll(safeLawItemsTask,
|
|
hSseStandardItemsTask,
|
|
safeLawItemsTask,
|
|
newsOutputsTask
|
|
);
|
|
SafeLawItems = await safeLawItemsTask;
|
|
HSseStandardItems = await hSseStandardItemsTask;
|
|
NoticeOutputs = await noticeOutputsTask;
|
|
NewsOutputs = await newsOutputsTask;
|
|
|
|
|
|
return true;
|
|
}
|
|
|
|
protected string GetUrl(string type )
|
|
{
|
|
var url = _dicTypeUrlDictionary[type];
|
|
return url;
|
|
|
|
}
|
|
/// <summary>
|
|
/// 业务按钮事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuSwitchMethod_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
string datatag = ((FineUIPro.ControlBase)sender).AttributeDataTag;
|
|
string url =Funs.SGGLUrl+ GetUrl(datatag);
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
Response.Write("<script>window.open('" + url + "','_blank')</script>");
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 数据看板按钮事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void BtnSJKB_Click(object sender, EventArgs e)
|
|
{
|
|
string url = Funs.SGGLUrl + "/common/main.aspx";
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
Response.Write("<script>window.open('" + url + "','_blank')</script>");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 三年行动按钮事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void BtnSNXD_OnClick(object sender, EventArgs e)
|
|
{
|
|
string url = Funs.SGGLUrl + "/index.aspx?menuType="+Const.Menu_ThreeYearAction;
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
Response.Write("<script>window.open('" + url + "','_blank')</script>");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 风险预警按钮事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void BtnFXYJ_OnClick(object sender, EventArgs e)
|
|
{
|
|
string url = Funs.SGGLUrl + "common/mainRiskMap.aspx";
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
Response.Write("<script>window.open('" + url + "','_blank')</script>");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 报表中心按钮事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void BtnBBZX_OnClick(object sender, EventArgs e)
|
|
{
|
|
string url = Funs.SGGLUrl + "/index.aspx?menuType=Menu_GroupReport" ;
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
Response.Write("<script>window.open('" + url + "','_blank')</script>");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 规章更多按钮事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void GZMoreBtn_OnClick(object sender, EventArgs e)
|
|
{
|
|
string url = Funs.SGGLUrl + "/ThreeYearAction/Gateway/RulesRegulations.aspx";
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
Response.Write("<script>window.open('" + url + "','_blank')</script>");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 通知更多按钮事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
protected void TZMoreBtn_OnClick(object sender, EventArgs e)
|
|
{
|
|
string url = Funs.SGGLUrl + "/ThreeYearAction/Gateway/Notice.aspx";
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
Response.Write("<script>window.open('" + url + "','_blank')</script>");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 新闻更多按钮事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
protected void NEWSMoreBtn_OnClick(object sender, EventArgs e)
|
|
{
|
|
string url = Funs.SGGLUrl + "/ThreeYearAction/Gateway/News.aspx";
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
Response.Write("<script>window.open('" + url + "','_blank')</script>");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 安全标准化按钮事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
protected void AQBZKMoreBtn_OnClick(object sender, EventArgs e)
|
|
{
|
|
string url = Funs.SGGLUrl + "/ThreeYearAction/Gateway/HSSEStandardList.aspx";
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
Response.Write("<script>window.open('" + url + "','_blank')</script>");
|
|
}
|
|
}
|
|
|
|
protected void FXYJMoreBtn_OnClick(object sender, EventArgs e)
|
|
{
|
|
string url = Funs.SGGLUrl + "/ThreeYearAction/Gateway/ConstructionRisk.aspx";
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
Response.Write("<script>window.open('" + url + "','_blank')</script>");
|
|
}
|
|
}
|
|
}
|
|
} |