コード例 #1
0
        /// <summary>
        /// Generates an Excel (xml/xlsx) file with grid based counts of number of species observations for each selected taxon.
        /// </summary>
        /// <param name="filename">
        /// The filename (without file extension).
        /// </param>
        /// <param name="formatCountAsOccurrence">
        /// If set to <c>true</c> the observation count will be written as 1 if the count > 0 and 0 if count = 0;
        /// If set to <c>false</c> the observation count will be written.
        /// </param>
        /// <param name="addSettings"></param>
        /// <param name="addProvenance"></param>
        /// <returns>
        /// A Excel file of the type xml or xlsx.
        /// </returns>
        private FileResult TaxonSpecificGridStatisticsOnSpeciesObservationCountsAsExcel(string filename, bool formatCountAsOccurrence, bool addSettings = true, bool addProvenance = true)
        {
            SetServerDone();
            if (SessionHandler.MySettings.Presentation.FileFormat.ExcelFileSettings.IsSettingsDefault())
            {
                TaxonSpecificGridStatisticsOnSpeciesObservationCountsExcelXlsx file =
                    FileExportManager.GetTaxonSpecificGridStatisticsOnSpeciesObservationCountsAsExcelXlsx(
                        GetCurrentUser(),
                        SessionHandler.MySettings.Presentation.Map.DownloadCoordinateSystemId,
                        formatCountAsOccurrence,
                        addSettings,
                        addProvenance);

                MemoryStream returnStream = file.ToStream();
                return(File(returnStream, XlsxExcelFileMimeType, CreateXlsxExcelFileName(filename)));
            }
            else
            {
                TaxonSpecificGridStatisticsOnSpeciesObservationCountsExcelXml file = FileExportManager.GetTaxonSpecificGridStatisticsOnSpeciesObservationCountsAsExcelXml(GetCurrentUser(), SessionHandler.MySettings.Presentation.Map.DownloadCoordinateSystemId, formatCountAsOccurrence, addSettings, addProvenance);
                MemoryStream returnStream = file.ToStream();
                return(File(returnStream, XmlExcelFileMimeType, CreateXmlExcelFileName(filename)));
            }
        }
コード例 #2
0
        /// <summary>
        /// Creates an xlsx excel file with multiple grid species observation counts.
        /// </summary>
        /// <param name="currentUser">The user context.</param>
        /// <param name="coordinateSystem">The coordinate system.</param>
        /// <param name="formatCountAsOccurrence">if set to <c>true</c> the result cells will be set to 1 if there are any observations; otherwise 0.</param>
        /// <param name="addSettings">True if settings sheet should be included</param>
        /// <param name="addProvenance">True if provenance sheet should be included.</param>
        /// <returns>The xlsx excel file.</returns>
        public static TaxonSpecificGridStatisticsOnSpeciesObservationCountsExcelXlsx GetTaxonSpecificGridStatisticsOnSpeciesObservationCountsAsExcelXlsx(IUserContext currentUser, CoordinateSystemId coordinateSystem, bool formatCountAsOccurrence, bool addSettings, bool addProvenance)
        {
            var file = new TaxonSpecificGridStatisticsOnSpeciesObservationCountsExcelXlsx(currentUser, coordinateSystem, formatCountAsOccurrence, addSettings, addProvenance);

            return(file);
        }