Example #1
0
        /// <summary>
        /// Gets date folder corresponding to the path created from the passed date
        /// </summary>
        /// <param name="date"></param>
        /// <param name="folderType">Date which is used for parsing the folder path</param>
        /// <returns>Found folder</returns>
        private Item GetDateFolder(DateTime date, BucketFolderType folderType)
        {
            string rootPath  = RootFolder.Paths.FullPath;
            string yearName  = date.Year.ToString();
            string monthName = date.Month.ToString();
            string dayName   = date.Day.ToString();
            string hourName  = date.Hour.ToString();

            string itemPath = string.Empty;

            switch (folderType)
            {
            case BucketFolderType.Year:
            {
                itemPath = string.Format("{0}/{1}/", rootPath, yearName);
                break;
            }

            case BucketFolderType.Month:
            {
                itemPath = string.Format("{0}/{1}/{2}/", rootPath, yearName, monthName);
                break;
            }

            case BucketFolderType.Day:
            {
                itemPath = string.Format("{0}/{1}/{2}/{3}/", rootPath, yearName, monthName, dayName);
                break;
            }

            case BucketFolderType.Hour:
            {
                itemPath = string.Format("{0}/{1}/{2}/{3}/{4}/", rootPath, yearName, monthName, dayName, hourName);
                break;
            }
            }

            return(_database.GetItem(itemPath));
        }
        /// <summary>
        /// Gets date folder corresponding to the path created from the passed date
        /// </summary>
        /// <param name="date"></param>
        /// <param name="folderType">Date which is used for parsing the folder path</param>
        /// <returns>Found folder</returns>
        private Item GetDateFolder(DateTime date, BucketFolderType folderType)
        {
            string rootPath = RootFolder.Paths.FullPath;
            string yearName = date.Year.ToString();
            string monthName = date.Month.ToString();
            string dayName = date.Day.ToString();
            string hourName = date.Hour.ToString();

            string itemPath = string.Empty;

            switch (folderType)
            {
                case BucketFolderType.Year:
                    {
                        itemPath = string.Format("{0}/{1}/", rootPath, yearName);
                        break;
                    }
                case BucketFolderType.Month:
                    {
                        itemPath = string.Format("{0}/{1}/{2}/", rootPath, yearName, monthName);
                        break;
                    }
                case BucketFolderType.Day:
                    {
                        itemPath = string.Format("{0}/{1}/{2}/{3}/", rootPath, yearName, monthName, dayName);
                        break;
                    }
                case BucketFolderType.Hour:
                    {
                        itemPath = string.Format("{0}/{1}/{2}/{3}/{4}/", rootPath, yearName, monthName, dayName, hourName);
                        break;
                    }
            }

            return _database.GetItem(itemPath);
        }