public void WeekDataLoad() { //获取本周全局安全状况 string textWeek = @"<br /><b>本周安全动态:</b><br /><br />"; var YHdataWeek = GetSafeInfo.GetMainLeaderJTYH(System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek), System.DateTime.Today).Tables[0]; var SWdataWeek = GetSafeInfo.GetMainLeaderJTSW(System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek), System.DateTime.Today).Tables[0]; if (YHdataWeek.Rows.Count <= 0 && SWdataWeek.Rows.Count <= 0) { textWeek += " 本周无安全动态!"; } else { if (YHdataWeek.Rows.Count > 0) { //textWeek += "全局隐患信息:<br />"; for (int i = 0; i < YHdataWeek.Rows.Count; i++) { textWeek += string.Format(" <span align=left><font color={5}><b>{0}</b></font>级隐患:" + YHstr + "条</span> <br />", YHdataWeek.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(YHdataWeek.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek).ToString("yyyy-MM-dd"), System.DateTime.Today.ToString("yyyy-MM-dd"), YHdataWeek.Rows[i]["YHNUM"].ToString().Trim(), GetColor(YHdataWeek.Rows[i]["LEVELNAME"].ToString().Trim())); } } if (SWdataWeek.Rows.Count > 0) { //textWeek += "全局三违信息:<br />"; for (int i = 0; i < SWdataWeek.Rows.Count; i++) { textWeek += string.Format(" <span align=left><font color={5}><b>{0}</b></font>级别三违:" + SWstr + "条 </span><br />", SWdataWeek.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(SWdataWeek.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek).ToString("yyyy-MM-dd"), System.DateTime.Today.ToString("yyyy-MM-dd"), SWdataWeek.Rows[i]["SWNUM"].ToString().Trim(), GetColor1(SWdataWeek.Rows[i]["LEVELNAME"].ToString().Trim())); } } } this.WeekPanel.Html = textWeek; }
public void MonthDataLoad() { //获取当月全局安全状况 DateTime start = new DateTime(System.DateTime.Today.Year, System.DateTime.Today.Month, 1); DateTime end = new DateTime(System.DateTime.Today.Year, System.DateTime.Today.Month, DateTime.DaysInMonth(System.DateTime.Today.Year, System.DateTime.Today.Month)); string textMonth = @"<br /><b>本月安全动态:</b><br /><br />"; var YHdataMonth = GetSafeInfo.GetMainLeaderJTYH(start, end).Tables[0]; var SWdataMonth = GetSafeInfo.GetMainLeaderJTSW(start, end).Tables[0]; if (YHdataMonth.Rows.Count <= 0 && SWdataMonth.Rows.Count <= 0) { textMonth += " 本月无安全动态!"; } else { if (YHdataMonth.Rows.Count > 0) { //textMonth += "全局隐患信息:<br />"; for (int i = 0; i < YHdataMonth.Rows.Count; i++) { textMonth += string.Format(" <span align=left><font color={5}><b>{0}</b></font>级隐患:" + YHstr + "条 </span><br />", YHdataMonth.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(YHdataMonth.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).ToString("yyyy-MM-dd"), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"), YHdataMonth.Rows[i]["YHNUM"].ToString().Trim(), GetColor(YHdataMonth.Rows[i]["LEVELNAME"].ToString().Trim())); } } if (SWdataMonth.Rows.Count > 0) { //textMonth += "全局三违信息:<br />"; for (int i = 0; i < SWdataMonth.Rows.Count; i++) { textMonth += string.Format(" <span align=left><font color={5}>{0}</font>级别三违:" + SWstr + "条 </span><br />", SWdataMonth.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(SWdataMonth.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).ToString("yyyy-MM-dd"), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"), SWdataMonth.Rows[i]["SWNUM"].ToString().Trim(), GetColor1(SWdataMonth.Rows[i]["LEVELNAME"].ToString().Trim())); } } } this.MonthPanel.Html = textMonth; }
public void YearDataLoad() { //获取当年全局安全状况 int date = System.DateTime.Today.Year; string textYear = @"<br /><b>" + date + "年全局安全动态:</b><br /><br />"; DateTime daybegin = new DateTime(System.DateTime.Today.Year, 1, 1); DateTime dayend = new DateTime(System.DateTime.Today.Year, 12, 31); var YHdata = GetSafeInfo.GetMainLeaderJTYH(daybegin, dayend).Tables[0]; var SWdata = GetSafeInfo.GetMainLeaderJTSW(daybegin, dayend).Tables[0]; if (YHdata.Rows.Count <= 0 && SWdata.Rows.Count <= 0) { textYear += " 本年度无安全动态!"; } else { if (YHdata.Rows.Count > 0) { //textYear += "全局隐患信息:<br />"; for (int i = 0; i < YHdata.Rows.Count; i++) { textYear += string.Format(" <span align=left> <font color={2}><b>{0}</b></font>级隐患:{1}条 <br /></span>", YHdata.Rows[i]["LEVELNAME"].ToString().Trim(), YHdata.Rows[i]["YHNUM"].ToString().Trim(), GetColor(YHdata.Rows[i]["LEVELNAME"].ToString().Trim())); } } if (SWdata.Rows.Count > 0) { //textYear += "全局三违信息:<br />"; for (int i = 0; i < SWdata.Rows.Count; i++) { textYear += string.Format(" <span align=left><font color={2}><b>{0}</b></font>级别三违:{1}条 <br /></span>", SWdata.Rows[i]["LEVELNAME"].ToString().Trim(), SWdata.Rows[i]["SWNUM"].ToString().Trim(), GetColor1(SWdata.Rows[i]["LEVELNAME"].ToString().Trim())); } } } this.YearPanel.Html = textYear; }