Beispiel #1
0
    protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            DataRowView drv          = (DataRowView)e.Item.DataItem;
            string      reportStatus = drv["当前状态"].ToString();
            Button      updateStatus = (Button)e.Item.FindControl("btnUpdateStatus");
            if (reportStatus == "等待确认")
            {
                updateStatus.CommandName = "ConfirmReport";
                updateStatus.Text        = "确认";
            }
            else if (reportStatus == "等待上传")
            {
                //updateStatus.CommandName = "CancelConfirm";
                //updateStatus.Text = "取消确认";
                updateStatus.Visible = false;
            }
            else
            {
                updateStatus.Visible = false;
            }

            int     reportUploadStatus = NumberTools.getInt(drv["网页"].ToString());
            Literal litHref            = (Literal)e.Item.FindControl("litHref");
            if (reportUploadStatus == 1)
            {
                litHref.Text = "<a style='color:#06c;' data-title=\"2申报主表\" _href='ExcelDetail.aspx?type=1&Pid=A02&ReportName=" + HttpUtility.UrlEncode(drv["报告号"].ToString(), Encoding.GetEncoding("utf-8")) + "&CompanyName=" + HttpUtility.UrlEncode(drv["公司名称"].ToString(), Encoding.GetEncoding("utf-8")) + "' onclick=\"Hui_admin_tab(this)\" href=\"javascript:;\">查看报表</a>";
            }
            else
            {
                litHref.Text = "查看报表";
            }
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int fromType;

        fromType = NumberTools.getInt(Request.QueryString["Type"]);
        string reportName;
        string reportNo;
        string rootPath = Server.MapPath("~/");

        if (!rootPath.EndsWith("\\"))
        {
            rootPath = rootPath + "\\";
        }
        //报表导出
        if (fromType == 2)
        {
            if (Session["ReportName"] == null || Session["ReportNo"] == null)
            {
                ScriptHelper.addMsg(this.Page, "请选择报告后再下载");
                return;
            }
            reportName = Session["ReportName"].ToString();
            reportNo   = Session["ReportNo"].ToString();
            string exportExcelFilePath;
            int    fType = NumberTools.getInt(Request["ftype"]);
            if (fType == 1)
            {
                exportExcelFilePath = rootPath + "Report\\" + reportName + "\\" + reportName + reportNo + ".xls";
            }
            else
            {
                //ZipOut zipOut = new ZipOut();
                //string strZipPath = rootPath + "Zip\\" + reportName + ".Zip";
                //string strZipTopDirectoryPath = rootPath + "Report\\" + reportName;
                //int intZipLevel = 6;
                //string strPassword = "";
                //string[] filesOrDirectoriesPaths = new string[] { strZipTopDirectoryPath };
                //zipOut.Zip(strZipPath, strZipTopDirectoryPath, intZipLevel, strPassword, filesOrDirectoriesPaths);
                //Response.Redirect("Zip\\"+reportName+".Zip");
                exportExcelFilePath = rootPath + "Report\\" + reportName + "\\" + reportName + "ALL.xls";
            }
            if (!System.IO.File.Exists(exportExcelFilePath))
            {
                ScriptHelper.addMsg(this.Page, "报告还没有生成");
                return;
            }
            if (fType == 1)
            {
                Response.Redirect("Report\\" + reportName + "\\" + reportName + reportNo + ".xls");
            }
            else
            {
                Response.Redirect("Report\\" + reportName + "\\" + reportName + "ALL.xls");
            }
            return;
        }
        reportName            = HttpUtility.UrlDecode(Request.QueryString["ReportName"]);
        reportNo              = Request.QueryString["Pid"];
        Session["ReportName"] = reportName;

        string htmlClientFolderName = reportName.Replace('[', '_').Replace(']', '_');

        if (string.IsNullOrEmpty(reportName) || string.IsNullOrEmpty(reportNo))
        {
            ScriptHelper.addMsg(this.Page, "参数不全");
            return;
        }
        else
        {
            Session["ReportNo"] = reportNo;
        }
        string fileName           = reportNo;
        string excelDirectoryName = rootPath + "Report\\" + reportName + "\\";
        string excelFilePath      = rootPath + "Report\\" + reportName + "\\" + reportName + fileName + ".xls";
        string htmlDirectoryName  = rootPath + "HTML\\" + htmlClientFolderName + "\\";
        string htmlFilePath       = rootPath + "HTML\\" + htmlClientFolderName + "\\" + fileName + ".html";


        if (!System.IO.File.Exists(excelFilePath))
        {
            ScriptHelper.addMsg(this.Page, "报告还没有生成");
            return;
        }
        if (System.IO.Directory.Exists(htmlDirectoryName) == false)//如果不存在就创建file文件夹
        {
            System.IO.Directory.CreateDirectory(htmlDirectoryName);
        }

        //if (!System.IO.File.Exists(htmlFilePath))
        {
            string outputDirPath = rootPath + @"HTML\" + htmlClientFolderName + "\\"; //Word和Excel转换成Html,Html文件存放的位置
            ExcelPreview.Excel2Html(this, excelFilePath, outputDirPath, fileName);
        }
        //formType 为1 的时候,为右边结果打开左边菜单
        if (fromType == 1)
        {
            string companyName = "";
            if (Request.QueryString["CompanyName"] != null)
            {
                companyName = HttpUtility.UrlDecode(Request.QueryString["CompanyName"]);;
            }
            ScriptHelper.addScript(this.Page, "Hui_Menu_Change(\"" + companyName + "\",\"" + reportName + "\")");
            return;
        }
        Response.Redirect("HTML\\" + htmlClientFolderName + "\\" + fileName + ".html");
    }