public bool PostEmptySelectedTempDirectories(List <HKTempModel> selectedTempItemsToDelete)
        {
            try
            {
                foreach (var tempItem in selectedTempItemsToDelete)
                {
                    if (tempItem.Selected)
                    {
                        if (tempItem.Type == "directory")
                        {
                            DirectoryInfo selectedDirectory = new DirectoryInfo(HttpContext.Current.Server.MapPath(GlobalSettings.Path + "/../App_Data/TEMP/" + tempItem.Entry + "/"));
                            // Delete cache folder recursively
                            HkFunctionsHelper.DeleteFolderRecursive(tempDI, selectedDirectory);
                        }
                        else
                        {
                            FileInfo selectedFile = new FileInfo(HttpContext.Current.Server.MapPath(GlobalSettings.Path + "/../App_Data/TEMP/" + tempItem.Entry));
                            HkFunctionsHelper.DeleteFile(tempDI, selectedFile);
                        }
                    }
                }

                return(true);
            }
            catch (IOException ex)
            {
                return(false);
            }
        }
        public HKCacheContentModel GetCacheContent()
        {
            var cachePath = HttpContext.Current.Server.MapPath(GlobalSettings.Path + "/../App_Data/cache/");

            if (Directory.Exists(cachePath))
            {
                List <HKCacheModel> cacheContentList = new List <HKCacheModel>();

                var cacheObjects = cacheDI.GetDirectories();

                foreach (var dir in cacheObjects)
                {
                    HKCacheModel cacheModel = new HKCacheModel
                    {
                        Entry     = dir.Name,
                        Type      = "directory",
                        Dimension = HkFunctionsHelper.SizeSuffix(HkFunctionsHelper.DirSize(dir))
                    };
                    cacheContentList.Add(cacheModel);
                }

                HKCacheContentModel cacheContent = new HKCacheContentModel
                {
                    ListCacheContent = cacheContentList
                };

                return(cacheContent);
            }

            return(null);
        }
        public bool PostEmptyCacheDirectory()
        {
            try
            {
                // Delete cache folder recursively
                HkFunctionsHelper.DeleteFolderRecursive(cacheDI, cacheDI);

                return(true);
            }
            catch (IOException ex)
            {
                return(false);
            }
        }
        public override ActionResult Index(RenderModel model)
        {
            try
            {
                HKCachePageModel HKRecycleBinPageModel = new HKCachePageModel(model.Content, model.CurrentCulture);

                // Delete cache folder recursively
                DirectoryInfo cacheDI = new DirectoryInfo(HttpContext.Server.MapPath(GlobalSettings.Path + "/../App_Data/cache/"));
                HkFunctionsHelper.DeleteFolderRecursive(cacheDI, cacheDI);

                HKRecycleBinPageModel.IsCacheDirectoryCleaned = true;

                LogHelper.Info <string>("FALM Housekeeping - Cleanup Cache Directory successfully completed");

                return(CurrentTemplate(HKRecycleBinPageModel));
            }
            catch (Exception ex)
            {
                LogHelper.Error <Exception>("FALM Housekeeping - " + ex.Message, ex);

                throw new Exception(ex.Message);
            }
        }
        public List <HKTempModel> GetTempContent()
        {
            var tempPath = HttpContext.Current.Server.MapPath(GlobalSettings.Path + "/../App_Data/TEMP/");

            if (Directory.Exists(tempPath))
            {
                List <HKTempModel> tempContentList = new List <HKTempModel>();

                var tempDirObjects = tempDI.GetDirectories();
                foreach (var dir in tempDirObjects)
                {
                    HKTempModel tempModel = new HKTempModel
                    {
                        Entry     = dir.Name,
                        Type      = "directory",
                        Dimension = HkFunctionsHelper.SizeSuffix(HkFunctionsHelper.DirSize(dir))
                    };
                    tempContentList.Add(tempModel);
                }

                var tempFilesObjects = tempDI.GetFiles();
                foreach (var file in tempFilesObjects)
                {
                    HKTempModel tempModel = new HKTempModel
                    {
                        Entry     = file.Name,
                        Type      = "file",
                        Dimension = HkFunctionsHelper.SizeSuffix(file.Length)
                    };
                    tempContentList.Add(tempModel);
                }

                return(tempContentList);
            }

            return(null);
        }