示例#1
0
        public static bool AddRecentFileIfNotDuplicate(Models.RecentFileModel file)
        {
            bool didAdd = false;

            var existingEntryResult = db.Query(@"
                    select *
                    from RecentFiles
                    where LOWER(FullPath) = :path
                ", new Dictionary <string, object>
            {
                { ":path", file.Path.ToLower() }
            });

            if (!existingEntryResult.Any())
            {
                db.Command(@"
                    insert into RecentFiles(FileName, FullPath)
                    values(:name, :path)
                    ", new Dictionary <string, object>
                {
                    { ":name", file.FileName },
                    { ":path", file.Path }
                });
                didAdd = true;
            }

            return(didAdd);
        }
示例#2
0
 public static void RenameRecentFile(Models.RecentFileModel file, string newName)
 {
     db.Command(@"
             update RecentFiles
             set FileName = :name
             where LOWER(FullPath) = :path
         ", new Dictionary <string, object>
     {
         { ":name", newName },
         { ":path", file.Path.ToLower() }
     });
 }