关于系统首页绘制问题(ext布局+c#后台加入数据)经html输出流输出响应client
关于系统首页绘制问题,业务需求
TODO
绘制系统首页(Main.aspx)
採用的技术:functioncharts+jquery+ext布局+c#+html
解说篇:1,服务端aspx,2,服务端后台返回数据(这里採用server端程序:aspx.cs)
服务端aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Main.aspx.cs" Inherits="HMFW.Web.Main" %> <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>
<%=HMFW.Common.GlobalSettings.Instance.WebTitle%></title>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<script src="Js/jquery-1.6.min.js" type="text/javascript"></script>
<script src="/Js/jquery.easyui.min.js" type="text/javascript"></script>
<link href="/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="css/ext-patch.css" rel="stylesheet" type="text/css" />
<link href="css/ext.css" rel="stylesheet" type="text/css" />
<link href="css/index.css" rel="stylesheet" type="text/css" />
<script src="/Js/FusionChartsMain.js" type="text/javascript"></script>
<script src="Js/jquery-loadmask-0.4/jquery.loadmask.min.js" type="text/javascript"></script>
<link href="Js/jquery-loadmask-0.4/jquery.loadmask.css" rel="stylesheet" type="text/css" />
<%--<script src="Js/Pages/SQJS/Report/SQFamilyReport.js"></script>--%>
<!--[if lt IE 7]>
<script type="text/javascript" src="Js/unitpngfix.js"></script>
<style type="text/css">
img { behavior: url(Js/iepngfix.htc) }
</style>
<![endif]-->
<script type="text/javascript">
function PD() {
var handle;
var ret;
handle = LivActiveX.LivOpen(0, 0); //打开句柄
if (handle < 12) {//没有数据
// $.messager.alert('提示', "您的加密狗设备已拔出,请插入后又一次登陆。", 'error', function() {
Loginout("您的加密狗设备已拔出,请插入后又一次登陆! ");
// });
return false;
}
setTimeout("PD()", 2000);
}
$(function () {
if ($("#hidNeedJiamigou").val() == "1") {
PD();
} }); $("#rblReportType").live("click", function () {
if ($("#rblReportType").find("[checked]").val() == "1") {
$("#divFlashReport1").show();
$("#divFlashReport2").hide();
}
else if ($("#rblReportType").find("[checked]").val() == "2") {
$("#divFlashReport2").show();
$("#divFlashReport1").hide();
}
}); function UpdateFlashData1() {
var xmlValue = $("#xmlFlash1").val();
var chart_myFirst = new FusionCharts("/charts/MSColumn2D.swf", "myFirst", "100%", "480", "0", "0");
chart_myFirst.setDataXML(xmlValue);
chart_myFirst.setTransparent(true);
chart_myFirst.render("divFlashReport1");
}
function UpdateFlashData2() {
var xmlValue = $("#xmlFlash2").val();
var chart_myFirst = new FusionCharts("/charts/Pie2D.swf", "myFirst", "100%", "480", "0", "0");
chart_myFirst.setDataXML(xmlValue);
chart_myFirst.setTransparent(true);
chart_myFirst.render("divFlashReport2");
} ////站点管理
//function LoginWebSite(sLoginName, iLevel, sAreaCode) {
// var url = "http://218.94.120.221:6068/admins/qh_login_auto.php?username=" + sLoginName + "&sareacodelevel=" + iLevel + "&sareacode=" + sAreaCode;
// //window.location.href = url;
// window.open(url, "newwindow", "", "");
//} </script> </head>
<body style="background-color: #DCEAFC">
<form id="form1" runat="server">
<div runat="server" id="hidTip" style="display: none;"></div>
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:Viewport ID="ViewPort1" runat="server">
<Items>
<ext:BorderLayout ID="BorderLayout1" runat="server">
<North Collapsible="false" Split="false" SplitTip="双击隐藏" UseSplitTips="true" MinHeight="90" MaxHeight="60">
<ext:Panel Height="60" runat="server" ID="NorthPanel" Html="">
</ext:Panel>
</North>
<%--<West Collapsible="true" Split="true" SplitTip="双击隐藏" UseSplitTips="true" MinWidth="200px">
<ext:Panel ID="Panel5" runat="server" Height="300" Width="200px" Title="系统导航菜单">
<Items>
<ext:AccordionLayout ID="AccordionLayout1" runat="server" Animate="true">
</ext:AccordionLayout>
</Items>
</ext:Panel>
</West>--%>
<West Collapsible="true" Split="true" SplitTip="双击隐藏" UseSplitTips="true" MinWidth="200px">
<ext:TreePanel ID="treePanel" runat="server" AutoScroll="true" Width="220px" Title="功能菜单"
Icon="Plugin" CtCls="west-panel" StyleSpec="float:left;">
<TopBar>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:Button ID="Button1" runat="server" IconCls="icon-expand-all">
<Listeners>
<Click Handler="#{treePanel}.expandAll();" />
</Listeners>
<ToolTips>
<ext:ToolTip ID="ToolTip1" IDMode="Ignore" runat="server" Html="所有展开" />
</ToolTips>
</ext:Button>
<ext:Button ID="Button2" runat="server" IconCls="icon-collapse-all">
<Listeners>
<Click Handler="#{treePanel}.collapseAll();" />
</Listeners>
<ToolTips>
<ext:ToolTip ID="ToolTip2" IDMode="Ignore" runat="server" Html="所有折叠" />
</ToolTips>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
</ext:TreePanel>
</West>
<Center>
<ext:TabPanel ID="Pages" runat="server" ActiveTabIndex="0" EnableTabScroll="true">
<Items>
<ext:Panel ID="tabHome" runat="server" Title="系统首页" Icon="ApplicationHome" BodyStyle="background-color: transparent;" AutoScroll="true">
<Items>
<ext:FitLayout runat="server" ID="FitLayout1">
<Items>
<ext:Portal ID="Portal1" AutoWidth="true" runat="server" Layout="ColumnLayout" BodyBorder="false">
<Items>
<ext:PortalColumn ID="PortalColumn2" runat="server" Layout="AnchorLayout"
StyleSpec="padding:10px 0 10px 10px" ColumnWidth=".56">
<Items>
<ext:Portlet ID="Portlet7" Title="人员信息图表" runat="server">
<Content>
<div id="divFlash" style="text-align: center">
<asp:RadioButtonList Style="margin: auto; font-weight: bold; font-size: larger;" ID="rblReportType" RepeatDirection="Horizontal" runat="server">
<asp:ListItem Value="1" Selected="True">柱状图</asp:ListItem>
<asp:ListItem Value="2">饼状图</asp:ListItem>
</asp:RadioButtonList>
<div id="divFlashReport1" style="overflow: scroll; font-size: 12px; width: auto; text-align: center; margin-top: 5px;">
</div>
<div id="divFlashReport2" style="overflow: scroll; display: none; font-size: 12px; width: auto; text-align: center; margin-top: 5px;">
</div>
</Content>
</ext:Portlet>
</Items>
</ext:PortalColumn>
<ext:PortalColumn ID="PortalColumn1" runat="server" Layout="AnchorLayout"
StyleSpec="padding:10px" ColumnWidth=".44">
<Items>
<ext:Portlet ID="Portlet3" Title="辖区信息" runat="server" />
<ext:Portlet ID="Portlet8" Title="通知公告" runat="server" Visible="false" />
<%--<ext:Portlet ID="Portlet2" Title="系统升级报告" runat="server" />--%>
</Items>
</ext:PortalColumn>
</Items>
</ext:Portal>
</Items>
</ext:FitLayout>
</Items>
</ext:Panel>
</Items>
<Plugins>
<ext:TabCloseMenu runat="server" ID="ctl162" CloseTabText="关闭" CloseTabIcon="UserRed"
CloseOtherTabsText="关闭其它" CloseOtherTabsIcon="UserGreen" CloseAllTabsText="关闭所有"
CloseAllTabsIcon="Delete" />
</Plugins>
</ext:TabPanel>
</Center>
<East Collapsible="true" Split="true" SplitTip="双击隐藏" UseSplitTips="true" MinWidth="200px">
<ext:Panel runat="server" ID="helpPanel" Title="地区导航" Width="200px" AutoScroll="true"
Collapsed="True">
</ext:Panel>
</East>
<South MinHeight="20px">
<ext:Panel Height="20px" runat="server" ID="BottomPanel" Title="" />
</South>
</ext:BorderLayout>
</Items>
</ext:Viewport>
<div id="customEl" class="x-hide-offsets">
<table style="cursor: pointer; width: 100%; margin-top: 3px;" onclick="ReadMessage();return false;">
<tr>
<td style="width: 50px; background-color: #EEF6F9; border-right: 1px solid #99BBE8" valign="middle">
<img src="css/notify_letter083516.png" /></td>
<td style="text-align: left; padding-left: 2px; font-size: 14px; font-weight: bold">你有<span id="spanMessage" style="color: red; font-size: 14px;">0</span>条未读短信!</td>
</tr>
</table>
</div>
<div class="wbk" id="dbsx">
<div class="arrowbox"></div>
<div class="dbclose" title="关闭"></div>
<div class="daiban" id="dbsxitems"></div>
</div>
<div class="wbk" id="dbuser">
<div class="arrowbox"></div>
<div class="dbclose" id="btnuserclose" title="关闭"></div>
<div class="daiban" id="dbusernotes" runat="server"></div>
</div> <input runat="server" type="hidden" id="hidIsChange" value="0" />
<input runat="server" type="hidden" id="hidgUserID" />
<input runat="server" type="hidden" id="FrameType" value="1" title="1 Default页面 2 Index页面" />
<input runat="server" type="hidden" id="IsShowSouth" value="0" />
<input runat="server" type="hidden" id="hidisTabClose" value="0" title="tab关闭是否询问" />
<input runat="server" type="hidden" id="hidNeedJiamigou" />
<input runat="server" type="hidden" id="hideUserWGName" />
<input type="hidden" runat="server" id="xmlFlash1" />
<input type="hidden" runat="server" id="xmlFlash2" />
</form>
<% if (HMFW.Common.GlobalSettings.Instance.NeedJiamigou)
{ %><object classid="clsid:CECFB72F-E4CA-438B-A6ED-C100572D7036" id="LivActiveX" codebase="/CAB/livCOM.cab#version=1,0,0,1"
type="hidden" width="0" height="0">
</object>
<%} %>
</body>
<script src="Js/Extjs/extWindow.js" type="text/javascript"></script>
<script src="Js/Pages/Default.js" type="text/javascript"></script>
</html>
服务端后台返回数据(这里採用server端程序:aspx.cs)
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HMFW.BLL.MenuManage;
using System.Data;
using HMFW.Model;
using Ext.Net;
using HMFW.SQLServerDAL.WebSite;
using HMFW.BLL.WebSite;
using HMFW.Common;
using System.IO;
using HMFW.Web.App_Code;
using HMFW.Common.FusionChart;
using HMFW.BLL.SQJS.Report;
using System.Xml; namespace HMFW.Web
{
public partial class Main : BasePage
{
MenuInRolesBLL bll = new MenuInRolesBLL();
private SQTotalBLL sqTotalBLL = new SQTotalBLL();
private ArticlesBLL articlesBLL = new ArticlesBLL();
bool flg = true;//true 载入一级菜单 false 载入二级以及二级下面的菜单
//
protected void Page_Load(object sender, EventArgs e)
{ hidgUserID.Value = GetSessionCurrentUserInfo.gUserID.ToString();
if (GlobalSettings.Instance.IsShowSouth == true)
{
IsShowSouth.Value = "1";
//Ext.Net.Panel south = new Ext.Net.Panel();
//south.ID = "SouthPanel";
//south.Title = "<div style='text-align:center;font-size:12px;'>技术支持:" + GlobalSettings.Instance.JQName + " " + GlobalSettings.Instance.JQLink + "</div></div>";
//BorderLayout1.South.Items.Add(south);
BottomPanel.Title = "<div style='text-align:center;font-size:12px;'>技术支持:" + GlobalSettings.Instance.JQName + " " + GlobalSettings.Instance.JQLink + "</div></div>";
}
else
{
BottomPanel.Visible = false;
}
if (!IsPostBack)
{
//Button3.Text = Common.GlobalSettings.Instance.WebTitle;
Ext.Net.TreeNode root = new Ext.Net.TreeNode(Common.GlobalSettings.Instance.WebTitle);
root.Expanded = true;
//单击打开
root.SingleClickExpand = true;
treePanel.Root.Add(root);
CreateSystemMenu("0", root); //bindMenu(); //txtsUserName.Text = GetSessionCurrentUserInfo.sRealName;
//txtsOrganizeName.Text = GetSessionCurrentUserInfo.sOrganizeName;
BindDefault();
helpPanel.AutoLoad.Url = "Pages/AreaCode/TreeSelect.aspx";
this.helpPanel.AutoLoad.Mode = LoadMode.IFrame;
this.helpPanel.AutoLoad.NoCache = false;
this.helpPanel.LoadContent(); ////冯婷婷凝视
////tabHome.AutoLoad.Url = "Pages/" + GlobalSettings.Instance.MainURL;
////this.tabHome.AutoLoad.Mode = LoadMode.IFrame;
////this.tabHome.AutoLoad.NoCache = false;
////this.tabHome.LoadContent(); //helpPanel.Expand();
LoadTop(); //载入Top
LoadTip();
//设置未读短信的html
SetMessageHtml();
hidNeedJiamigou.Value = GetSessionCurrentUserInfo.iNeedKey.ToString();
//if (GlobalSettings.Instance.ConfigName == "HLJS_JMS_QJQ")//若是佳木斯系统
// hidisTabClose.Value = "1"; //切换用户
List<WgUsersModel> lstUserModels = JsonHelper.JsonStringToList<WgUsersModel>(GetSessionCurrentUserInfo.lstUserModel == null ? "" : GetSessionCurrentUserInfo.lstUserModel);
if (!string.IsNullOrEmpty(GetParam("UserCode")))
{
for (int m = 0; m < lstUserModels.Count; m++)
{
if (lstUserModels[m].sAreaCode == GetParam("UserCode"))
{
GetSessionCurrentUserInfo.sAreaCode = lstUserModels[m].sAreaCode;
GetSessionCurrentUserInfo.sAreaName = lstUserModels[m].sAreaName;
GetSessionCurrentUserInfo.sOrganizeName = lstUserModels[m].sOrganizeName;
GetSessionCurrentUserInfo.gOrganizeID = lstUserModels[m].gOrganizeID;
}
}
} hideUserWGName.Value = GetSessionCurrentUserInfo.sAreaName; //当前地区
if (lstUserModels != null && lstUserModels.Count > 1)
{
var html = "";
html += "<ul>";
html += "<li>当前网格:" + hideUserWGName.Value + "</li>";
foreach (var itWG in lstUserModels)
{
html += "<li><a href=\"javascript:void (null)\" onclick=\"OpenUser('" + itWG.sAreaCode + "')\">切换到:" + itWG.sAreaName + "</a></li>";
}
html += "</ul>";
dbusernotes.InnerHtml = html;
} }
}
private void LoadTip()
{
/*******************读取TXT文件***********************/
string strPath = Server.MapPath(Request.ApplicationPath) + "Tip.txt";
//检查文件是否存在
if (File.Exists(strPath))
{
//仅 对文本 进行 读写操作
StreamReader sr = new StreamReader(strPath, System.Text.Encoding.Default);
//定位操作点,begin 是一个參考点
sr.BaseStream.Seek(0, SeekOrigin.Begin);
//读一下,看看文件内有没有内容,为下一步循环 提供推断根据
string str = sr.ReadToEnd();
string[] infos = str.Split('$');
DateTime dtm = DateTime.Now;
if (infos.Length == 2)
{
DateTime.TryParse(infos[0], out dtm);
if (dtm > DateTime.Now)
hidTip.InnerHtml = infos[1].Trim();
}
else
{
hidTip.InnerHtml = str.Trim();
}
//关闭文件,注意顺序。先对文件内部进行关闭,然后才是文件~
sr.Close();
}
/*******************TXT文件读取结束*************************************/
} #region 创建菜单树
protected void CreateSystemMenu(string sPcode, Ext.Net.TreeNode root)
{
string menuTypeCode = GetParam("MenuTypeCode");
List<View_UsersMenu> dtMenu = bll.GetMenu(GetSessionCurrentUserInfo.gUserID, int.Parse(GetSessionCurrentUserInfo.iType.ToString()), false);
List<View_UsersMenu> sysTitle = new List<View_UsersMenu>();
if (!string.IsNullOrEmpty(menuTypeCode) && flg)
{
sysTitle = dtMenu.Where(p => p.sPCode == sPcode && p.sCode == menuTypeCode).OrderBy(p => p.iSort).ToList<View_UsersMenu>();
if (sysTitle.Count == 0)
{
Response.Redirect("~/TransitionPage." + GlobalSettings.Instance.UrlHz + "?MenuTypeCode=" + menuTypeCode);
return;
}
flg = false;
}
else
sysTitle = dtMenu.Where(p => p.sPCode == sPcode).OrderBy(p => p.iSort).ToList<View_UsersMenu>(); foreach (var item in sysTitle)
{
int chileCount = dtMenu.Where(p => p.sPCode == item.sCode).Where(p => p.bIsShow == true).Count();
var sname = item.sName;
//string link = item.sLink;
//bool islink = false;
//if (chileCount == 0 && link.StartsWith("URL:"))
//{
// islink = true;
// sname = "<a href='" + link.Replace("URL:", "") + "' target='_blank'>" + sname + "</a>";
//}
Ext.Net.TreeNode compositionNode = new Ext.Net.TreeNode(sname);//+item.sCode
//单击展开
compositionNode.SingleClickExpand = true;
if (chileCount > 0 || item.iType == 1)
root.Nodes.Add(compositionNode);
if (chileCount != 0)
{
CreateSystemMenu(item.sCode, compositionNode);
}
else
{
compositionNode.Icon = (Icon)1137;//
if (!string.IsNullOrEmpty(item.sIcon))
{
compositionNode.Icon = (Icon)(int.Parse(item.sIcon));
}
string link = item.sLink;
if (link.StartsWith("^"))
{
link = link.TrimStart('^'); compositionNode.Listeners.Click.Handler = "window.open('" + link + "');";
}
else
compositionNode.Listeners.Click.Handler = "addTab(#{Pages},'" + item.sCode + "','" + link + "','" + item.sName + "','" + (item.imask == 1 ? "1" : "") + "');";
}
} }
#endregion #region 绑定首页内容 private void BindDefault()
{
string sareacode = GetSessionCurrentUserInfo.sAreaCode;
//1、辖区信息
DataTable xqxxdt = sqTotalBLL.GetReportXQView(sareacode, "", "", "true").Tables[0];
string xqxxHtml = "<table border='0' cellspacing='0' cellpadding='0' width='95%' align='center'>";
if (xqxxdt != null && xqxxdt.Rows.Count > 0)
{
xqxxHtml += "<tr><td height='26px' style=\"border-bottom:1px dotted #DDDDDD;\"><div class='texthidden' ><img src=\"Images/Icon/light_3.gif\" border=\"0\" style=\"margin-right:5px;\">辖区名称 : " + xqxxdt.Rows[0]["sName"] + "</div></td>";
xqxxHtml += "<td height='26px' style=\"border-bottom:1px dotted #DDDDDD;\"><div class='texthidden' ><img src=\"Images/Icon/light_3.gif\" border=\"0\" style=\"margin-right:5px;\">辖区总人口 : " + xqxxdt.Rows[0]["ZRS"] + "</div></td></tr>";
xqxxHtml += "<tr><td height='26px' style=\"border-bottom:1px dotted #DDDDDD;\"><div class='texthidden' ><img src=\"Images/Icon/light_3.gif\" border=\"0\" style=\"margin-right:5px;\">辖区总户数 : " + xqxxdt.Rows[0]["ZHS"] + "</div></td>";
xqxxHtml += "<td height='26px' style=\"border-bottom:1px dotted #DDDDDD;\"><div class='texthidden' ><img src=\"Images/Icon/light_3.gif\" border=\"0\" style=\"margin-right:5px;\">辖区常住人口 : " + xqxxdt.Rows[0]["BDHKCZRK"] + "</div></td></tr>";
}
Portlet3.Html = xqxxHtml + "</table>"; //2、通知公告
View_db_Articles model = new View_db_Articles();
model.sAreaCode = GetSessionCurrentUserInfo.sAreaCode;
model.sTypeCode = "002";
model.iState = 1;//审核通过
SearchModel searchmodel = new SearchModel();
searchmodel.PageIndex = 1;//每页显示的行数
searchmodel.PageSize = 15;//新的页码值
List<View_db_Articles> ztList = articlesBLL.GetList(model, searchmodel);
string ztHtml = "<table border='0' cellspacing='0' cellpadding='0' width='95%' align='center'>";
string ztUrl = "addTab(#{Pages},'通知公告列表' , '/Pages/WebSite/ArticlesList.jsp?sTypeCode=002','通知公告');";
for (int i = 0; i < 15; i++)
{
if (i < ztList.Count)
{
string gKey = ztList[i].gID.ToString();
string url = "addTab(#{Pages},'通知公告列表' , '/Pages/WebSite/ArticlesView.aspx? id=" + gKey + "','通知公告');";
string temp_gg = "<tr><td height='26px' style=\"border-bottom:1px dotted #DDDDDD;\"><div class='texthidden' ><img src=\"Images/Icon/light_3.gif\" border=\"0\" style=\"margin-right:5px;\"><a class=\"nrbtfont01\" href=\"#\" title=\"" + ztList[i].sTitle + "\" onclick=\"" + url + "\">" + (ztList[i].sTitle.Length > 16 ? (ztList[i].sTitle.Substring(0, 16) + "...") : ztList[i].sTitle) + "</a></div></td>" + "<td style=\"border-bottom:1px dotted #DDDDDD;width:90px;\" align=\"center\">" + (ztList[i].dFBRQ == null ? "" : ("[" + ztList[i].dFBRQ.Value.ToString("yyyy-MM-dd") + "]")) + "</td></tr>";
ztHtml += temp_gg;
}
}
Portlet8.Html = ztHtml + "</table>";
Portlet8.Title = "<div style=\"color:#000000;float:left;\">通知公告</div><div align=\"right\" style=\"float:right;\"><a class=\"nrbtfont01\" href=\"#\" onclick=\"" + ztUrl + "\">很多其它</a></div>";
//3、系统升级报告
//4、人员信息图表
DataSet ds = sqTotalBLL.GetReportView(sareacode, "", "", "true");
if (ds != null && ds.Tables.Count > 0)
{
DataTable dt = ds.Tables[0];
dt.TableName = "Table";
//xmlFlash1.Value = GetReportDataSet(dt);
//xmlFlash2.Value = ds.GetXml();
xmlFlash1.Value = FlashDataBind(dt,//数据源
GetSessionCurrentUserInfo.sAreaName + "社区居民信息统计",//主标题
"单位(人)",//副标题
"sName",//X轴绑定字段
"总人数",//设置Y轴显示名称
"ZRS",//Y轴绑定字段
"0",//平均值线
"", //X轴显示名称
"");//Y轴显示名称 xmlFlash2.Value = FlashDataBindPie(dt, //数据源
GetSessionCurrentUserInfo.sAreaName + "社区居民信息统计",//主标题
"单位(人)", //副标题
"sName", //饼图显示名称
"ZRS"); //饼图绑定字段 //生成柱状图、饼状图
//string.Format("UpdateFlashData1('{0}','{1}');", xmlFlash1.Value, "/charts/MSColumn2D.swf");
//string.Format("UpdateFlashData2('{0}','{1}');", xmlFlash2.Value, "/charts/Pie2D.swf");
ScriptManager.RegisterStartupScript(Portlet7, Portlet7.GetType(), "UpdateFlashData", "UpdateFlashData1();UpdateFlashData2();", true);
}
} //private void BindDefault()
//{
// ArticlesBLL bll = new ArticlesBLL();
// //取数据库数据
// List<View_db_Articles> listZCFG = bll.GetMainList(ArticlesType.ZCFG);
// //ZCFG.Html = GetTableString(listZCFG);
// //string url = "addTab(Pages,'很多其它政策法规','Pages/WebSite/ArticlesViewList.aspx?sTypeCode=001','很多其它政策法规');";
// //ZCFG.Title = "<a href=\"#\" style='text-decoration: none;' onclick=\"" + url + "\">政策法规</a>"; // //List<View_db_Articles> listTZGG = bll.GetMainList(ArticlesType.TZGG);
// //TZGG.Html = GetTableString(listTZGG);
// //url = "addTab(Pages,'很多其它通知公告','Pages/WebSite/ArticlesViewList.aspx?sTypeCode=002','很多其它通知公告');";
// //TZGG.Title = "<a href=\"#\" style='text-decoration: none;' onclick=\"" + url + "\">通知公告</a>"; // //List<View_db_Articles> listSJBG = bll.GetMainList(ArticlesType.SJBG);
// //SJBG.Html = GetTableString(listSJBG);
// //url = "addTab(Pages,'很多其它升级报告','Pages/WebSite/ArticlesViewList.aspx?sTypeCode=003','很多其它升级报告');";
// //SJBG.Title = "<a href=\"#\" style='text-decoration: none;' onclick=\"" + url + "\">升级报告</a>"; // //List<View_db_Articles> listJYJL = bll.GetMainList(ArticlesType.JYJL);
// //JYJL.Html = GetTableString(listJYJL);
// //url = "addTab(Pages,'很多其它经验交流','Pages/WebSite/ArticlesViewList.aspx?sTypeCode=004','很多其它经验交流');";
// //JYJL.Title = "<a href=\"#\" style='text-decoration: none;' onclick=\"" + url + "\">经验交流</a>";
//} private string GetTableString(List<View_db_Articles> list)
{
/*
<Content>
<a href="#" onclick="addTab(Pages,'01','Pages/SQJS/ArticlesView.aspx? id=01','biaoti');">addTab(#Pages,'01','SQJS/ArticlesView.aspx?id=01','biaoti');</a>
</Content>
*/
string TableTemp = "<table border='0' cellspacing='0' cellpadding='0' width='98%' align='center' nowrap >{0}</table>";
//0--文章id 1--标题 2--发表日期
string RowTemp = "<tr><td height='22px'><a href='#' style='text-decoration: none;' onclick=\"{0}\">{1}</a></td><td style='width:90px;'>{2}</td></tr>";
string AddTabTemp = "addTab(Pages,'{0}','Pages/WebSite/ArticlesView.aspx?id={1}','{2}');";
string NullRow = "<tr><td height='22px'></td></tr>";
string Row = "";
for (int i = 0; i < 10; i++)
{
if (i < list.Count)
{
string fbrq = list[i].dFBRQ.Value.ToString("yyyy-MM-dd");
string id = list[i].gID.ToString();
string title = list[i].sTitle; string addTabTemp = "";
addTabTemp = string.Format(AddTabTemp, id, id, title);
Row += string.Format(RowTemp, addTabTemp, title, fbrq);
}
else
{
Row += NullRow;
}
}
return string.Format(TableTemp, Row);
}
#endregion #region 设置未读短信的html
private void SetMessageHtml()
{
// if(GlobalSettings.Instance.NeedMessage)
// customEl.Html = "<table style=\"cursor: pointer;width:100%;margin-top:3px;\" onclick=\"ReadMessage();return false;\"><tr><td style=\"width: 50px;background-color:#EEF6F9;border-right:1px solid #99BBE8\" valign=\"middle\"><img src=\"css/notify_letter083516.png\" /></td><td style=\"text-align: left;padding-left: 2px;font-size: 14px;font-weight:bold\">你有<span id=\"spanMessage\" style=\"color: red;font-size:14px; \">0</span>条未读短信!</td></tr></table>";
} #endregion #region 载入头部
/// <summary>
/// 载入头部
/// </summary>
private void LoadTop()
{
string menuTypeCode = GetParam("MenuTypeCode");
var areacode = GetSessionCurrentUserInfo.sAreaCode;
if (areacode.Length > 6)
areacode = areacode.Substring(0, 6);
string imageurl = GetConfigPath + "jqtop" + areacode + ".jpg";
if (!File.Exists(Server.MapPath(imageurl)))
imageurl = GetConfigPath + "jqtop.jpg";
string flash =
"<div style='position:absolute;top:0px;left:-20px;border:0px solid red'><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" style=\"width: 400px; height: 60px\"><param name=\"movie\" value=\"images/top/top.swf\"><param name=\"quality\" value=\"high\"><param name=\"wmode\" value=\"transparent\"><embed height=\"60\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" quality=\"high\" src=\"images/top/top.swf\" type=\"application/x-shockwave-flash\" width=\"400\" wmode=\"transparent\"></embed></object></div>";
string tophtml =
"<table class=\"ke-zeroborder topbg\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tbody><tr><td height=\"60\" width=\"440\" class=\"topimg\" style=\"background-image:url(" + imageurl + ");background-repeat:no-repeat;\">" + flash + "<table class=\"ke-zeroborder\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"440\" align=\"left\" style='padding-left:10px'><tbody><tr><td height=\"36\"></td></tr><tr><td class=\"topfont01 uName\" height=\"24\">" + GetSessionCurrentUserInfo.sRealName + "<!--/" + GetSessionCurrentUserInfo.sUserName + "--><!--" + GetSessionCurrentUserInfo.gUserID + "-->" + (GetSessionCurrentUserInfo.iType == 2 ? ("") : ("[" + GetSessionCurrentUserInfo.sOrganizeName + "]")) + " <span id=\"dateName\">正在读取当前时间...</span></td></tr></tbody></table></td><td class=\"topbg\">"
+ "<table class=\"nav_icon_h ke-zeroborder\"><tr>"; List<WgUsersModel> lstWG = JsonHelper.JsonStringToList<WgUsersModel>(GetSessionCurrentUserInfo.lstUserModel == null ? "" : GetSessionCurrentUserInfo.lstUserModel);
if (lstWG != null && lstWG.Count > 1) //是否显示切换网格
{
tophtml += "<td><div id=\"btnUserNotes\" class=\"nav_icon_h_item\" onclick=\"ChangeUser();return false;\" onFocus=this.blur()><a href=\"javascript:;\"><div class=\"nav_icon_h_item_img\"><img src=\"images/Top/userico.png\"/></div><div class=\"nav_icon_h_item_text\">切换网格</div></a></div></td>";
} //string sLoginName = GetSessionCurrentUserInfo.sUserName;//登陆用户username
//string iLevel = (GetSessionCurrentUserInfo.iJB + 1).ToString();//地区级别
//string sAreaCode = GetSessionCurrentUserInfo.sAreaCode;//地区
//帮助文档
//tophtml += "<td><div class=\"nav_icon_h_item\" onclick=\"LoginWebSite('" + sLoginName + "','" + iLevel + "','" + sAreaCode + "');return false;\" onFocus=this.blur()><a id=\"aWebSite\" href=\"javascript:;\"><div class=\"nav_icon_h_item_img\"><img src=\"images/Top/icon004.png\"/></div><div class=\"nav_icon_h_item_text\">站点管理</div></a></div></td>"
tophtml += "<td><div class=\"nav_icon_h_item\" onclick=\"ReLoad();return false;\" onFocus=this.blur()><a href=\"javascript:;\"><div class=\"nav_icon_h_item_img\"><img src=\"images/Top/refresh.png\"/></div><div class=\"nav_icon_h_item_text\">刷新当前</div></a></div></td>"
+ "<td><div class=\"nav_icon_h_item\" onclick=\"Online();return false;\" onFocus=this.blur()><a href=\"javascript:;\"><div class=\"nav_icon_h_item_img\"><img src=\"images/Top/users.png\"/></div><div class=\"nav_icon_h_item_text\"><span id='onlinecount' class='total'>" + UserSessionManager.GetCount().ToString() + "</span>人在线</div></a></div></td>";
//删除等办事项 + "<td><div id=\"btnNotes\" class=\"nav_icon_h_item\" onclick=\"Notes();return false;\" onFocus=this.blur()><a href=\"javascript:;\"><div class=\"nav_icon_h_item_img\"><img src=\"images/Top/icon004.png\"/></div><div class=\"nav_icon_h_item_text\">待办事项(<span id='dbcount' class='total'>0</span>)</div></a></div></td>" //改动资料 + "<td><div class=\"nav_icon_h_item\" onclick=\"ModifyPassword();return false;\" onFocus=this.blur()><a href=\"javascript:;\"><div class=\"nav_icon_h_item_img\"><img src=\"images/Top/icon005.png\"/></div><div class=\"nav_icon_h_item_text\">改动资料</div></a></div></td>"; //删除短信息,也不须要政策法规
//if (GlobalSettings.Instance.NeedMessage)
// tophtml += "<td><div class=\"nav_icon_h_item\" onclick=\"ReadMessage();return false;\" onFocus=this.blur()><a href=\"javascript:;\"><div class=\"nav_icon_h_item_img\"><img src=\"images/Top/icon006.png\"/></div><div class=\"nav_icon_h_item_text\">短信息(<span id='msgcount' class='total'>0</span>)</div></a></div></td>";
//else tophtml += (GlobalSettings.Instance.ConfigName == "HLJS_JMS" ? "" : "<td><div class=\"nav_icon_h_item\" onclick=\"OPenZCFG();return false;\" onFocus=this.blur()><a href=\"javascript:;\"><div class=\"nav_icon_h_item_img\"><img src=\"images/Top/icon008.png\"/></div><div class=\"nav_icon_h_item_text\">政策法规</div></a></div></td>");
if ((GetSessionCurrentUserInfo.sUserName == "admin" || GlobalSettings.Instance.ConfigName != "HLJS_JMS") && (menuTypeCode == "110") || GetSessionCurrentUserInfo.sUserName == "admin")
tophtml += "<td><div class=\"nav_icon_h_item\" onclick=\"Search();return false;\" onFocus=this.blur()><a href=\"javascript:;\"><div class=\"nav_icon_h_item_img\"><img src=\"images/Top/query.png\"/></div><div class=\"nav_icon_h_item_text\">搜 索</div></a></div></td>";
tophtml += "<td><div class=\"nav_icon_h_item\" onclick=\"LoginoutMain('" + GetSessionCurrentUserInfo.sUserName + "');return false;\" onFocus=this.blur()><a href=\"javascript:;\"><div class=\"nav_icon_h_item_img\"><img src=\"images/Top/back.png\"/></div><div class=\"nav_icon_h_item_text\">返回平台</div></a></div></td>"
+ "</tr></table>"
+ "</td></tr></tbody></table>";
NorthPanel.Html = tophtml;
} private string GetWenHou()
{
int hour = DateTime.Now.Hour;
if (hour < 6)
return "凌晨好!";
else if (hour < 9)
return "早上好!";
else if (hour < 12)
return "上午好。";
else if (hour < 14)
return "中午好。";
else if (hour < 17)
return "下午好!";
else if (hour < 19)
return "傍晚好! ";
else if (hour < 22)
return "晚上好!";
else
return "夜里好! ";
}
#endregion #region 获取Config路径
protected string GetConfigPath
{
get { return "/Config/" + ConfigurationManager.AppSettings["Config"] + "/"; }
}
#endregion //#region 測试另种导航菜单 //#region 绑定一级菜单,而且实现递归 ///// <summary>
///// 绑定一级菜单。而且实现递归
///// </summary>
///// <param name="ds"></param>
//private void bindMenu()
//{
// List<View_UsersMenu> dtMenu = bll.GetMenu(GetSessionCurrentUserInfo.gUserID, int.Parse(GetSessionCurrentUserInfo.iType.ToString()), false);
// var sysTitle = dtMenu.Where(p => p.sPCode == "0").OrderBy(p => p.iSort);
// foreach (var item in sysTitle)
// {
// int chileCount = dtMenu.Where(p => p.sPCode == item.sCode).Where(p => p.bIsShow == true).Count();
// if (chileCount > 0 || item.iType == 1)
// {
// //第一级菜单为TreePanel
// TreePanel tp = new TreePanel();
// tp.Title = item.sName;
// tp.RootVisible = false;
// AccordionLayout1.Items.Add(tp);
// //递归第二级下面菜单
// CreateSystemMenu(item.sCode, tp, dtMenu);
// }
// else
// {
// //直接载入菜单
// }
// }
//} //#endregion //#region 直接TreePanel下级菜单(2级菜单)
////直接TreePanel下级菜单(2级菜单)
//private void CreateSystemMenu(string sCode, TreePanel tp, List<View_UsersMenu> dtMenu)
//{
// var sysTitle = dtMenu.Where(p => p.sPCode == sCode).OrderBy(p => p.iSort);
// Ext.Net.TreeNode rootnode = new Ext.Net.TreeNode("Root");
// tp.Root.Add(rootnode);
// foreach (var item in sysTitle)
// {
// Ext.Net.TreeNode compositionNode = new Ext.Net.TreeNode(item.sName);
// //单击展开
// compositionNode.SingleClickExpand = true;
// rootnode.Nodes.Add(compositionNode);
// int chileCount = dtMenu.Where(p => p.sPCode == item.sCode).Where(p => p.bIsShow == true).Count();
// if (chileCount != 0)
// {
// //3级菜单或更下级菜单
// CreateSystemMenu(item.sCode, compositionNode, dtMenu);
// }
// else
// {
// compositionNode.Listeners.Click.Handler = "addTab(#{Pages},'" + item.sCode + "','" + item.sLink + "','" + item.sName + "','" + (item.imask == 1 ? "1" : "") + "');";
// }
// }
//} //#endregion //#region 创建左側菜单条(3级菜单以后)
///// <summary>
///// 创建左側菜单条(3级菜单以后)
///// </summary>
//protected void CreateSystemMenu(string parentCode, Ext.Net.TreeNode root, List<View_UsersMenu> dtMenu)
//{
// var sysTitle = dtMenu.Where(p => p.sPCode == parentCode).OrderBy(p => p.iSort); // foreach (var item in sysTitle)
// {
// Ext.Net.TreeNode compositionNode = new Ext.Net.TreeNode(item.sName);
// //单击展开
// compositionNode.SingleClickExpand = true;
// root.Nodes.Add(compositionNode);
// int chileCount = dtMenu.Where(p => p.sPCode == item.sCode).Where(p => p.bIsShow == true).Count();
// if (chileCount != 0)
// {
// CreateSystemMenu(item.sCode, compositionNode, dtMenu);
// }
// else
// {
// compositionNode.Listeners.Click.Handler = "addTab(#{Pages},'" + item.sCode + "','" + item.sLink + "','" + item.sName + "','" + (item.imask == 1 ? "1" : "") + "');";
// }
// } //} //#endregion //#endregion }
}
效果图
关于系统首页绘制问题(ext布局+c#后台加入数据)经html输出流输出响应client的更多相关文章
- Ext.form.ComboBox 后台取值 动态加载 ext5.0.0
我用的extjs是5.0.0版本的. 请注意:如果这里没有的combobox相关内容,这里一定有. 开始的时候keyup事件取到的数据就是放不到ComboBox中,放全局变量也不好用.最后大神出手帮忙 ...
- 【百度地图API】建立全国银行位置查询系统(四)——如何利用百度地图的数据生成自己的标注
原文:[百度地图API]建立全国银行位置查询系统(四)--如何利用百度地图的数据生成自己的标注 摘要: 上一章留个悬念,"如果自己没有地理坐标的数据库,应该怎样制作银行的分布地图呢?&quo ...
- 不同系统、不同存储格式(textfile, parquet)数据的传递
描述: 本地测试环境hive中有数据,存储格式为textfile,现在要上传到公司开发环境,存储格式为parquet, 如何实现??? tb_textfile表---> local file - ...
- CSS 页面布局、后台管理示例
CSS 页面布局.后台管理示例 页面布局 1.头部菜单 2.中间内容/中间左侧菜单 3.底部内容 <div class='pg-header'> <div style='width: ...
- 数据是ERP系统搭建的基础,但,不要让数据毁了ERP
很难想象没有数据的ERP是什么样子的.然而,实际情况又是如何的呢? 根据AMT的研究,在那些上线不成功或者上线后掉线的案例中,有高达70%的项目都有一个共同的直接原因,那就是在数据上出了问题.有的是在 ...
- UWP 应用获取各类系统、用户信息 (1) - 设备和系统的基本信息、应用包信息、用户数据账户信息和用户账户信息
应用开发中,开发者时常需要获取一些系统.用户信息用于数据统计遥测.问题反馈.用户识别等功能.本文旨在介绍在 Windows UWP 应用中获取一些常用系统.用户信息的方法.示例项目代码可参见 Gith ...
- (KEILv5)使用matlab绘制从KEIL memory导出的内存数据
使用matlab绘制从KEIL memory导出的内存数据 如标题,某些时候我们需要分析keil调试过程中的数据,比如从I2S.SPI.I2C或者UART获取到的波形数据,这些数据时数字流,通过逻辑分 ...
- Ext.Net 复制GridPanel的数据
Ext.Net 复制GridPanel的数据 2013-11-28 09:50:04| 分类: Ext.net | 标签: |举报 |字号大中小 订阅 CSS: <styletype ...
- php 读取windows 的系统版本,硬盘,内存,网卡,数据流量等
php 读取windows 的系统版本,硬盘,内存,网卡,数据流量等 <?php header("Content-type: text/html; charset=utf-8" ...
随机推荐
- defaultView and parentWindow
defaultView 只读的 which is used to represent the currently rendered view of the document 返回的值通常是包含 ...
- outline
a标签 两种button按钮 默认带有一个虚线 outline 当他们被单击 和 激活以后 outline和border 很类似 ,但是有不同 1.outline 不能针对特定的边赋值 ,也就 ...
- JAVA 后台SSM框架接收安卓端的json数据
最近项目上与安卓端做JSON数据交互,使用的SSM框架,刚开始的时候感觉很简单,想着不就是把安卓端的JSON数据封装为Bean类对象吗? 于是就这样写了 可是这样一直报400,百度原因是因为请求url ...
- [转]彻底弄懂css中单位px和em,rem的区别
难怪会问我 rem 和 em, 这俩或在移动端还是很有必要学习的. root em OK? 国内的设计师大都喜欢用px,而国外的网站大都喜欢用em和rem,那么三者有什么区别,又各自有什么优劣呢? P ...
- Python学习--列表和元组
在python中,最基本的数据结构是序列.序列中的每个元素被分配一个序号--即元素的位置,也称为索引.第一个索引是0. python包含6种内建的序列:列表.元组.字符串.Unicode字符串.buf ...
- Jxl创建Excel文件和解析Excel文件
import java.io.File; import jxl.Workbook; import jxl.write.Label; import jxl.write.WritableSheet; im ...
- C#操作Excel(读取)
一.使用OleDb,这个法子好像不大好使.容易读错.引用System.Data.OleDb; /**//// <summary> /// 返回Excel数据源 ...
- org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 6; 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: ### Error ...
- SpringAware
哈哈,终于把分布式的课程演讲给混过去了,下面开始随便自己学点东西. 正题:SpringAware--------在实际项目中,用到spring容器的本省功能资源,这是Bean必须意识到Spring容器 ...
- python 多线程批量传文件
#!/usr/bin/env python #_*_ coding:utf-8 -*-#autho:leiyong#time:2017-06-05#version: 1.3 import parami ...