From e7b08fae9ed6c6f5495510f4ad93c8e4c759ff48 Mon Sep 17 00:00:00 2001 From: PremKumarMadhanRaj <41164082+PremKumarMadhanRaj@users.noreply.github.com> Date: Tue, 1 Feb 2022 17:20:56 +0530 Subject: [PATCH] bug(BLAZ-19123): Persistence related issue in Dashboard layout component has been resolved. --- Models/SQLFileProvider.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Models/SQLFileProvider.cs b/Models/SQLFileProvider.cs index eeac5b7..3af25de 100644 --- a/Models/SQLFileProvider.cs +++ b/Models/SQLFileProvider.cs @@ -145,7 +145,7 @@ public FileManagerResponse GetFiles(string path, bool showHiddenItems, params Fi files.Add(childFiles); } reader.Close(); - + cwd.FilterId = GetFilterId(cwd.Id); foreach (var file in files) { file.FilterId = GetFilterId(file.Id); @@ -806,6 +806,7 @@ public FileManagerResponse Delete(string path, string[] names, params FileManage Id = reader["ItemID"].ToString() }; } + reader.Close(); } catch (SqlException ex) { Console.WriteLine(ex.ToString()); } finally { sqlConnection.Close(); } @@ -1123,16 +1124,7 @@ public FileManagerResponse Search(string path, string searchString, bool showHid if (path == null) { path = string.Empty; }; var searchWord = searchString; FileManagerDirectoryContent searchData; - FileManagerDirectoryContent cwd = new FileManagerDirectoryContent(); - cwd.Name = data[0].Name; - cwd.Size = data[0].Size; - cwd.IsFile = false; - cwd.DateModified = data[0].DateModified; - cwd.DateCreated = data[0].DateCreated; - cwd.HasChild = data[0].HasChild; - cwd.Type = data[0].Type; - sqlConnection.Open(); - cwd.FilterPath = GetFilterPath(data[0].Id); + FileManagerDirectoryContent cwd = data[0]; sqlConnection.Close(); AccessPermission permission = GetPermission(cwd.Id, cwd.ParentID, cwd.Name, cwd.IsFile, path); cwd.Permission = permission; @@ -1263,7 +1255,7 @@ public FileManagerResponse Copy(string path, string targetPath, string[] names, lastId = GetLastInsertedValue(); sqlConnection.Close(); sqlConnection.Open(); - SqlDataReader reader = (new SqlCommand(("Select * from " + this.tableName + " where ItemID=" + item.Id), sqlConnection)).ExecuteReader(); + SqlDataReader reader = (new SqlCommand(("Select * from " + this.tableName + " where ItemID=" + lastId), sqlConnection)).ExecuteReader(); while (reader.Read()) { var copyFiles = new FileManagerDirectoryContent