protected void Page_Load(object sender, EventArgs e)
        {
            var mainPage = "DailyReport/frmDailyBI.aspx";

            var principal = HttpContext.Current.Session["JMPrincipal"] as JMReports.Business.MyPrincipal;
            if (principal != null)
            {
              //this.lblUser.Text = string.Format("欢迎{0}: {1}", principal.identity.User.Title, principal.Identity.Name);
              //this.lblUser.Text = string.Format("欢迎{0}: {1}", principal.identity.User.Title,
              //  string.Format("<a href='User/UserPsdMod.aspx' style='right:80px' target='right'>{0}</a>", principal.Identity.Name));
              this.lblUser.Text = string.Format("<a href='User/UserPsdMod.aspx' style='right:100px' target='right'>欢迎{0}: {1}</a>", principal.identity.User.Title, principal.Identity.Name);
              //this.lblUser.Text = string.Format("<div style='white-space:nowrap'>欢迎{0}: {1}</div>", principal.identity.User.Title,
              //string.Format(@"<span style=""CURSOR: pointer"" onclick=""window.showModalDialog('User/UserPsdMod.aspx', '', 'location:No;status:No;help:No;dialogWidth:600px;dialogHeight:400px;scroll:no;')"";>{0}</span>", principal.Identity.Name));

              //window.showModalDialog(’User/UserPsdMod.aspx’, """", ""location:No;status:No;help:No;dialogWidth:500px;dialogHeight:400px;scroll:no;"");
            }
            this.lblMap1.Text = string.Format("<a href='{0}' target='right'>首页</a>", mainPage);
            
            if ((Page.Request.QueryString["v1"] != null) && (Page.Request.QueryString["v1"] != ""))
            {
                String v1 = Request.QueryString["v1"].ToString();
                int reportId;
                if (int.TryParse(v1, out reportId))
                {
                    Business.ReportInfoComponent rc = new Business.ReportInfoComponent();
                    var report = rc.getSingleReportByReportId(reportId);
                    this.lblMap1.Text = string.Format("<a href='{3}' target='right'>首页</a>-><a href='#' target='right'>{0}</a>-><a href='{1}' target='right'>{2}</a>", report.Category, report.URL, report.ChineseName, mainPage);
                }
            }


        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var mainPage = "DailyReport/frmDailyBI.aspx";

            var principal = HttpContext.Current.Session["JMPrincipal"] as JMReports.Business.MyPrincipal;
            if (principal != null)
            {
                this.lblUser.Text = string.Format("欢迎{0}: {1}", principal.identity.User.Title, principal.Identity.Name);
            }
            this.lblMap1.Text = string.Format("<a href='{0}' target='right'>首页</a>", mainPage);
            
            if ((Page.Request.QueryString["v1"] != null) && (Page.Request.QueryString["v1"] != ""))
            {
                String v1 = Request.QueryString["v1"].ToString();
                int reportId;
                if (int.TryParse(v1, out reportId))
                {
                    Business.ReportInfoComponent rc = new Business.ReportInfoComponent();
                    var report = rc.getSingleReportByReportId(reportId);
                    this.lblMap1.Text = string.Format("<a href='{3}' target='right'>首页</a>-><a href='#' target='right'>{0}</a>-><a href='{1}' target='right'>{2}</a>", report.Category, report.URL, report.ChineseName, mainPage);
                }
            }


        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";



            string strJson = "{}";
            var principal = HttpContext.Current.Session["JMPrincipal"] as JMReports.Business.MyPrincipal;
            if (principal != null)
            {

                int userId = (principal.Identity as JMReports.Business.MyIdentity).Id;

                Business.ReportInfoComponent rc = new Business.ReportInfoComponent();
                var reports = rc.getReportsById(userId);

                string currentCategory = "", header = "{\"ReportByCategory\":[", trailor = "]}";
                var reportList = new List<string>();
                var categoryList = new List<string>();
                var reportSB = new StringBuilder();

                var categories = from b in reports
                                 group b by b.Category into g
                                 select new { Category = g.Key, Count = g.Count() };

                categoryList.Clear();
                foreach (var cat in categories)
                {
                    currentCategory = cat.Category;
                    string tmp = "";


                    reportList.Clear();

                    tmp = "{\"Category\":\"" + currentCategory + "\",\"Reports\":[";

                    foreach (var item in reports.Where(x => x.Category == cat.Category))
                    {
                        reportList.Add("{\"ReportId\":" + item.ReportId.ToString() + ",\"Name\":\"" + item.Name + "\",\"ChineseName\":\"" + item.ChineseName + "\",\"URL\":\"" + item.URL + "\"}");
                    }

                    categoryList.Add(tmp + String.Join(",", reportList.ToArray()) + "]}");

                }
                reportSB.Append(header);
                reportSB.Append(string.Join(",", categoryList.ToArray()));
                reportSB.Append(trailor);
                strJson = reportSB.ToString();
            }
            context.Response.Write(strJson);

        }
 private void serReports()
 {
     Business.ReportInfoComponent rc = new Business.ReportInfoComponent();
     this.gvReport.DataSource = rc.getReports();
     this.gvReport.DataBind();
 }