예제 #1
0
        /// <summary>
        /// 导出影院广告情况统计报表
        /// </summary>
        /// <param name="cinema"></param>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        public void AdvList_output(string cinema, string begin, string end)
        {
            DaAdvListItem dal = new DaAdvListItem();
            DataTable dt = dal.getDataTable(cinema, begin, end);

            if (dt.Rows.Count > 0)
            {
                string filename = "myAdvList.xls";
                System.IO.StringWriter tw = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
                DataGrid dgGrid = new DataGrid();
                dgGrid.DataSource = dt;
                dgGrid.DataBind();

                //Get the HTML for the control.
                dgGrid.RenderControl(hw);
                //Write the HTML back to the browser.
                //Response.ContentType = application/vnd.ms-excel;
                Response.ContentType = "application/vnd.ms-excel";
                Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + "");
                Response.Write(tw.ToString());
            }
            else
            {
                Response.Write("无数据可导出!");
            }

            Response.End();
        }
예제 #2
0
        /// <summary>
        /// 获取影院广告情况统计列表
        /// </summary>
        /// <param name="cinema"></param>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        public JsonResult AdvList_search(string cinema, string begin, string end)
        {
            DaAdvListItem dal = new DaAdvListItem();
            IList<AdvListItem> list = dal.getList(cinema, begin, end);

            var result = new CustomJsonResult();
            result.dateFormat = "yyyy-MM-dd";
            result.Data = new { total = list.Count, rows = list };
            return result;
        }