Exemplo n.º 1
0
        public static void SavePrintBalFiles(string _category, string yrmo, DataTable dsAuditSum1, DataTable dsAuditSum2, DataTable dsSum)
        {
            string[]     reports = GetReportCodes(_category);
            Page         page = HttpContext.Current.Handler as Page;
            string       _content, _file, _filepath, _filename;
            Boolean      _checkedPrint, _checkedSave;
            int          _seq = 0;
            StreamWriter sw;

            foreach (string report in reports)
            {
                _checkedPrint = VWA_ExportDAL.checkedPrint(report);
                _checkedSave  = VWA_ExportDAL.checkedSave(report);

                if (!_checkedSave && !_checkedPrint)
                {
                    continue;
                }

                _filename = GetFileName(report, yrmo);
                _content  = GetBalReportContent(report, _filename, yrmo, dsAuditSum1, dsAuditSum2, dsSum);
                _filepath = VWA_ExportDAL.GetFilePath(report);

                _file = _filepath + _filename;

                if (_checkedSave || _checkedPrint)
                {
                    if (!page.ClientScript.IsClientScriptBlockRegistered(_seq + "SaveFile"))
                    {
                        page.ClientScript.RegisterClientScriptBlock(typeof(Page), _seq + "SaveFile", "SaveFile('" + _content.Replace(Environment.NewLine, "") + "', '" + _file.Replace("\\", "\\\\") + "');", true);
                    }
                }

                if (_checkedPrint)
                {
                    if (!page.ClientScript.IsClientScriptBlockRegistered(_seq + "PrintExcel"))
                    {
                        page.ClientScript.RegisterClientScriptBlock(typeof(Page), _seq + "PrintExcel", "PrintExcel('" + _file.Replace("\\", "\\\\") + "');", true);
                    }

                    if (!_checkedSave)
                    {
                        if (!page.ClientScript.IsClientScriptBlockRegistered(_seq + "DeleteFile"))
                        {
                            page.ClientScript.RegisterClientScriptBlock(typeof(Page), _seq + "DeleteFile", "DeleteFile('" + _file.Replace("\\", "\\\\") + "');", true);
                        }
                    }
                }

                _seq++;
            }
        }
Exemplo n.º 2
0
        public static void SavePrintFiles(string _category, string yrmo)
        {
            string[]     reports = GetReportCodes(_category);
            Page         page = HttpContext.Current.Handler as Page;
            string       _content, _file, _filepath, _filename;
            Boolean      _checkedPrint, _checkedSave;
            int          _seq = 0;
            StreamWriter sw;
            string       agedDays;

            foreach (string report in reports)
            {
                _checkedPrint = VWA_ExportDAL.checkedPrint(report);
                _checkedSave  = VWA_ExportDAL.checkedSave(report);

                if (!_checkedSave && !_checkedPrint)
                {
                    continue;
                }

                _filename = GetFileName(report, yrmo);

                if (report.Equals("TranAging"))
                {
                    agedDays = HttpContext.Current.Session["VWAAgingDays"].ToString();
                    _content = GetReportContent(report, _filename, agedDays);
                }
                else
                {
                    _content = GetReportContent(report, _filename, yrmo);
                }

                _filepath = VWA_ExportDAL.GetFilePath(report);

                _file = _filepath + _filename;

                if (_checkedSave || _checkedPrint)
                {
                    if (!page.ClientScript.IsClientScriptBlockRegistered(_seq + "SaveFile"))
                    {
                        page.ClientScript.RegisterClientScriptBlock(typeof(Page), _seq + "SaveFile", "SaveFile('" + _content.Replace(Environment.NewLine, "") + "', '" + _file.Replace("\\", "\\\\") + "');", true);
                    }
                }

                if (_checkedPrint)
                {
                    if (!page.ClientScript.IsClientScriptBlockRegistered(_seq + "PrintExcel"))
                    {
                        page.ClientScript.RegisterClientScriptBlock(typeof(Page), _seq + "PrintExcel", "PrintExcel('" + _file.Replace("\\", "\\\\") + "');", true);
                    }

                    if (!_checkedSave)
                    {
                        if (!page.ClientScript.IsClientScriptBlockRegistered(_seq + "DeleteFile"))
                        {
                            page.ClientScript.RegisterClientScriptBlock(typeof(Page), _seq + "DeleteFile", "DeleteFile('" + _file.Replace("\\", "\\\\") + "');", true);
                        }
                    }
                }

                _seq++;
            }
        }