コード例 #1
0
        public static Singular.Web.Result Export(METTLib.Questionnaire.QuestionnaireAnswerExportSetList QuestionnaireAnswerExportSetList, int QuestionnaireAnswerSetId)
        {
            //return new Singular.Documents.Document($"Provision{ClientName}_{ContractNumber}.xlsx", CreateExcel(ROGroups).ToArray());
            //return new Singular.Documents.Document($"Mett.xls", CreateExcel(ThreatsList).ToArray());
            //_QID_PAID_QASID
            //return new Singular.Web.Result(true) { Data = Singular.Web.WebServices.FileDownloadHandler.SaveTempFile($"METT_Q{QuestionnaireID}_PA{ProtectedAreaID}_QAS{QuestionnaireAnswerSetID}.xls", CreateExcel(ThreatsList).ToArray()) };
            //return new Singular.Web.Result(true) { Data = Singular.Web.WebServices.FileDownloadHandler.SaveTempFile($"METT_Q1_PA1_QAS1.xls", CreateExcel(ThreatsList).ToArray()) };

            //SAVE
            //var fileTimeStamp = DateTime.Now.ToString("ddMMyy-hhmmss");
            //File.WriteAllBytes(@"C:\Clients\METT\mett\METTWeb\Temp\METT-ProtectedAreaName-" + fileTimeStamp + ".xls", CreateExcel(QuestionnaireAnswerExportSetList).ToArray());

            //DOWNLOAD
            //return new Singular.Web.Result(true) { Data = Singular.Web.WebServices.FileDownloadHandler.SaveTempFile(tempDoc) };
            //	Singular.Web.WebServices.FileDownloadHandler.SendFile(System.Web.HttpContext.Current.Response, "Mett.pdf", new System.IO.MemoryStream(File.ReadAllBytes(@"C:\Clients\METT\mett\METTWeb\Temp\test.pdf")).ToArray(), false);
            //	Singular.Web.WebServices.FileDownloadHandler.SendFile(System.Web.HttpContext.Current.Response, "Mett.pdf", new MemoryStream(Encoding.UTF8.GetBytes(value ?? "")).ToArray(),true);
            Singular.Documents.TemporaryDocument tempDoc = new Singular.Documents.TemporaryDocument();

            tempDoc.SetDocument(CreateExcel(QuestionnaireAnswerExportSetList).ToArray(), "Mett.xls");
            //tempdoc = Singular.Web.WebServices.FileDownloadHandler.SendFile(System.Web.HttpContext.Current.Response, "Mett.xls", CreateExcel(QuestionnaireAnswerExportSetList).ToArray(), false);


            return(new Singular.Web.Result(true)
            {
                Data = Singular.Web.WebServices.FileDownloadHandler.SaveTempFile(tempDoc)
            });
        }
コード例 #2
0
        public static Singular.Web.Result ExportToWord()
        {
            var fileTimeStamp = DateTime.Now.ToString("ddMMyy-hhmmss");
            var fileName      = "METT-ProtectedAreaName-" + fileTimeStamp + ".doc";

            Singular.Documents.TemporaryDocument tempDoc = new Singular.Documents.TemporaryDocument();
            tempDoc.SetDocument(CreateWord().ToArray(), fileName);
            return(new Singular.Web.Result(true)
            {
                Data = Singular.Web.WebServices.FileDownloadHandler.SaveTempFile(tempDoc)
            });
        }