Ejemplo n.º 1
0
        private void DeleteFiles(string fileStatus)
        {
            var errorFiles = FileManagerRepository.GetFilesByFileStatus(fileStatus);
            var stores     = errorFiles.GroupBy(r => r.StoreId);
            var errorList  = new List <int>();

            foreach (var store in stores)
            {
                try
                {
                    int storeId = store.Key;
                    ConnectGoogleDrive(storeId);
                    errorList.AddRange(DeleteGoogleDriveFiles(errorFiles));
                }
                catch (Exception ex)
                {
                    Logger.Error(ex, "ConnectGoogleDrive:DeleteFiles:" + ex.Message, fileStatus);
                }
            }

            errorFiles = errorFiles.Where(r => !errorList.Contains(r.Id)).ToList();
            DeleteFileFromDb(fileStatus, errorFiles);
        }