private void NewPermissionRequest() { ShowAllPermissions(); Console.WriteLine("Choose permission Id"); string permissionChoice = Console.ReadLine(); Console.WriteLine("Define duration of permission"); string duration = Console.ReadLine(); string outputMessage = ""; bool isConsentGiven = ConsentAPI.CheckForConsent(Convert.ToInt32(this.userID), Convert.ToInt32(permissionChoice), out outputMessage); if (outputMessage != "" && !isConsentGiven) { Console.WriteLine(PermissionAPI.CreatePermissionRequest(this.userID, permissionChoice, duration)); DateTime dateDuration = new DateTime(); dateDuration = DateTime.Now; dateDuration = dateDuration.AddHours(Convert.ToDouble(duration)); Console.WriteLine(ConsentAPI.SaveConsent(Convert.ToInt32(this.userID), Convert.ToInt32(permissionChoice), dateDuration)); } else { Console.WriteLine(outputMessage); } }
private void btnSelectPermission_Click(object sender, RoutedEventArgs e) { DateTime expirationTime = new DateTime(); expirationTime = DateTime.Now; expirationTime = expirationTime.AddHours(Convert.ToDouble(_viewModel.PermissionDuration)); ConsentAPI.SaveConsent(_viewModel.UserID, _viewModel.SelectedPermission.PermissionID, expirationTime); _viewModel.ClearPermissionList(); this.Close(); }