Example #1
0
        public TimeSeriesRequest(string requestNameIn, string requestIdIn, int[] timeSeriesIdsIn, TimeSeriesFormat timeSeriesFormatIn = TimeSeriesFormat.CSV, string eMail = "" )
        {
            RequestName = requestNameIn;

            RequestId = requestIdIn;

            TimeSeriesIds = new List<int>(timeSeriesIdsIn);

            RequestFormat = timeSeriesFormatIn;

            UserEmail = eMail;
        }
Example #2
0
        /// <summary>
        /// Format: <servicecode>-<sitename>-<variablename>.<extension>
        /// </summary>
        /// <param name="meta"></param>
        /// <param name="timeSeriesFormat"></param>
        /// <returns></returns>
        public static string GenerateFileName(SeriesMetadata meta, TimeSeriesFormat timeSeriesFormat = TimeSeriesFormat.CSV)
        {
            string fileName = string.Format("{0}-{1}-{2}", meta.ServCode.SanitizeForFilename(), meta.SiteName.SanitizeForFilename(), meta.VariableName.SanitizeForFilename());
            string extension = String.Empty;

            if (TimeSeriesFormat.WaterOneFlow == timeSeriesFormat)
            {
                extension = ".xml";
            }
            else if (TimeSeriesFormat.CSV == timeSeriesFormat)
            {
                //NOTE: Microsoft Excel restricts file path + name + extension to 218 characters max.  Truncate file name if indicated...

                extension = ".csv";

                while (218 < (fileName.Length + extension.Length))
                {
                    fileName = fileName.Substring(0, (fileName.Length - 1));
                }
            }

            return string.Format("{0}{1}", fileName, extension);
        }