private void RecordFileAction(DriveData.File file, DriveService service, string actionType) { FileActionService fileActionService = new FileActionService(); string[] userDetails = GetUserDetails(service); FileAction action = new FileAction( file.Id, file.Md5Checksum, "Drive", userDetails[0], userDetails[1], actionType, DateTime.Now); Task.Run(() => { fileActionService.RecordFileAction(action); }); }
static void Main(string[] args) { ConnectionProvider connection = new ConnectionProvider(); TrackedFileService fileTracker = new TrackedFileService(); FileActionService fileActionService = new FileActionService(); List <FileAction> userActions = fileActionService.GetActionsByUser("*****@*****.**"); userActions.ForEach(a => Console.WriteLine(a.ActionTime + " " + a.UserName + " " + a.ActionType + " " + a.FileID + " ")); List <FileAction> fileActions = fileActionService.GetActionsByFile("263262238234", "Box"); fileActions.ForEach(a => Console.WriteLine(a.FileHash)); }
private void RecordFileAction(BoxClient client, string fileID, string actionType) { FileActionService fileActionService = new FileActionService(); Content file = GetBoxItem(client, fileID).Result; BoxUser user = client.UsersManager.GetCurrentUserInformationAsync(new String[2] { "name", "login" }).Result; string userName = user.Name; string userEmail = user.Login; System.Diagnostics.Debug.WriteLine(userName + " " + userEmail); FileAction action = new FileAction( fileID, file.Hash, "Box", userName, userEmail, actionType, DateTime.Now ); fileActionService.RecordFileAction(action); }