Пример #1
0
        /// <summary>
        /// Generates a CSV 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="convertCountToOccurrenceBoolean">
        /// 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>
        /// <returns>
        /// A CSV file.
        /// </returns>
        private FileResult TaxonSpecificGridStatisticsOnSpeciesObservationCountsAsCsv(string filename, bool convertCountToOccurrenceBoolean)
        {
            SpeciesObservationGridCalculator resultCalculator     = new SpeciesObservationGridCalculator(GetCurrentUser(), SessionHandler.MySettings);
            TaxonSpecificGridSpeciesObservationCountResult result = resultCalculator.CalculateMultipleSpeciesObservationGrid();
            TaxonSpecificSpeciesObservationCountGridCsv    file   = FileExportManager.GetTaxonSpecificGridStatisticsOnSpeciesObservationCountsAsCsv(result, convertCountToOccurrenceBoolean);
            MemoryStream returnStream = file.ToStream();

            SetServerDone();
            return(File(
                       returnStream.ToArray(),
                       "text/csv",
                       FilenameGenerator.CreateFilename(filename, FileType.Csv)));
        }
Пример #2
0
        /// <summary>
        /// Generates a CSV file with grid based counts of number of species observations for each selected taxon.
        /// </summary>
        /// <param name="data">
        /// The data.
        /// </param>
        /// <param name="formatCountAsOccurrence">
        /// If set to <c>true</c> the observation count will be written as 1 if the count &gt; 0 and 0 if count = 0;
        /// If set to <c>false</c> the observation count will be written.
        /// </param>
        /// <returns>
        /// A CSV file.
        /// </returns>
        public static TaxonSpecificSpeciesObservationCountGridCsv GetTaxonSpecificGridStatisticsOnSpeciesObservationCountsAsCsv(TaxonSpecificGridSpeciesObservationCountResult data, bool formatCountAsOccurrence)
        {
            TaxonSpecificSpeciesObservationCountGridCsv file = new TaxonSpecificSpeciesObservationCountGridCsv(data, formatCountAsOccurrence);

            return(file);
        }