Exemplo n.º 1
0
        public static void FileOpened(FileImpInfo fileInfo)
        {
            var id   = fileInfo.SmartId;
            var data = db.Find <FileData>(id);

            if (data == null)
            {
                data = new FileData()
                {
                    Id        = id,
                    SmartName = fileInfo.SmartName,
                    LastPath  = fileInfo.FullPath
                };

                db.Insert(data);
            }
            else if (data.LastPath != fileInfo.FullPath)
            {
                db.Update(data);
            }

            var usageData = new FileUsageData
            {
                FileInfoId = id,
                TimeOpened = DateTime.UtcNow
            };

            db.Insert(usageData);
        }
Exemplo n.º 2
0
        public static void SetWatched(long smartId)
        {
            var usageData = new FileUsageData
            {
                FileInfoId = smartId,
                TimeOpened = DateTime.UtcNow,
                TimeClosed = DateTime.UtcNow,
                Completed  = true
            };

            db.Insert(usageData);
        }
Exemplo n.º 3
0
        public static void SetWatchedAll(IEnumerable <long> smartIds)
        {
            var list = new List <FileUsageData>();

            foreach (var smartId in smartIds)
            {
                var usageData = new FileUsageData
                {
                    FileInfoId = smartId,
                    TimeOpened = DateTime.UtcNow,
                    TimeClosed = DateTime.UtcNow,
                    Completed  = true
                };

                list.Add(usageData);
            }

            db.InsertAll(list);
        }