关于系统首页绘制问题(ext布局+c#后台添加数据)经html输出流输出响应客户端

关于系统首页绘制问题,业务需求:

TODO:

1,绘制系统首页(Main.aspx)

2,采用的技术:functioncharts+jquery+ext布局+c#+html

讲解篇:1,服务端aspx,2,服务端后台返回数据(这里采用服务器端程序:aspx.cs)

1,服务端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>

2,服务端后台返回数据(这里采用服务器端程序: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;//登陆用户用户名
            //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

    }
}

时间: 2024-10-07 17:42:05

关于系统首页绘制问题(ext布局+c#后台添加数据)经html输出流输出响应客户端的相关文章

HighCharts绘制JS折线图(后台传数据给前台基于JFinal框架)

/*****************************Controller(基于JFinal框架)**************/ package com.zzu.controller;import java.text.SimpleDateFormat;import java.util.ArrayList;import java.util.List;import org.jfree.chart.ChartFactory;import org.jfree.chart.ChartUtilitie

1.7 博客系统| 系统首页的导航区域| 主体布局| admin |首页文章列表的渲染

设置系统首页(文章列表渲染) index.html bootstrap里边的导航组件:https://v3.bootcss.com/components/ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <link rel="stylesheet" h

SSH系列:(19)系统首页、子系统首页、登录页、项目主页

在这里,有三个名词需要区分:项目首页.系统首页.子系统首页.登录页. 项目首页是指在web.xml文件中配置的页面.   <welcome-file-list>     <welcome-file>index.jsp</welcome-file>   </welcome-file-list> 当一个系统比较大时,可能包含多个子系统.系统有自己的主页,称为系统首页:而子系统也有自己的主页,称为子系统首页. 登录页,则是用户进行登录的页面. 1.系统首页 (1)

报馆系统首页设计

本报馆系统首页采用bootscript完成 具体页面设计如下:                 1.bootscript引入 <script src="<%=request.getContextPath()%>/resource/jquery/jquery-1.9.1.min.js" type="text/javascript"></script><script src="<%=request.getCont

Ext布局篇

  EXT标准布局类 收藏 面板相当于一张干净的白纸,如果直接在上面添加内容,将很难控制面板中内容的显示位置,面板元素越多就越显得凌乱,所以需要在面板上划分不同的区域,将面板内容展示到希望的位置上.ExtJS通过提供多种布局类来为面板提供支持,主要包括如下10种:     ContainerLayout(容器布局)     FitLayout(自适应布局)     AccordionLayout(折叠布局)     CardLayout(卡片式布局)     AnchorLayout(锚点布局)

Android中将布局文件/View添加至窗口过程分析 ---- 从setContentView()谈起

本文主要内容是讲解一个视图View或者一个ViewGroup对象是如何添加至应用程序窗口中的.下文中提到的窗口可泛指我们能看到的界面,包括一个Activity呈现的界面(我们可以将之理解为应用程序窗口),一个Dialog,一个Toast,一个Menu菜单等. 首先对相关类的作用进行一下简单介绍: Window 类   位于 /frameworks/base/core/java/android/view/Window.java 说明:该类是一个抽象类,提供了绘制窗口的一组通用API.可以将之理解为

四、对象如何创建,布局?如何访问数据

四.对象如何创建,布局?如何访问数据 对象的内存分配 对象的创建过程 Jvm读到new指令, 先去方法区(类常量池中)查看是否有对应的类符号,并检查该类是否被加载, if 加载,JVM为新生对象分配内存 else 加载类,为对象分配内存 内存分配完,JVM将内存空间值初始化为0值 对象头信息记录,这个对象是哪个类的实例,如何找到类元数据信息,对象哈希码值,对象的GC分代信息记录到对象头中: new之后执行init操作 JVM内存分配的方式 指针碰撞Bump the pointer分配内存 如果堆

android 在布局中动态添加控件

第一步 Java代码 final LayoutInflater inflater = LayoutInflater.from(this); 第二步:获取需要被添加控件的布局 Java代码 final LinearLayout lin = (LinearLayout) findViewById(R.id.LinearLayout01); 第三步:获取需要添加的布局(控件) Java代码 LinearLayout layout = (LinearLayout) inflater.inflate( R

从零开始,搭建博客系统MVC5+EF6搭建框架(2),测试添加数据、集成Autofac依赖注入

一.测试仓储层.业务层是否能实现对数据库表的操作 1.创建IsysUserInfoRepository接口来继承IBaseRepository父接口 1 namespace Wchl.WMBlog.IRepository 2 { 3 public partial interface IsysUserInfoRepository : IBaseRepository<sysUserInfo> 4 { 5 6 } 7 } 2.创建sysUserInfoRepository类继承BaseReposit