private async Task OpenDialogDeleteInvitationAsync(SoftwareVaultInvitation softwareVaultInvitation) { if (!await VerifyAdUserAsync()) { return; } //RenderFragment body = (builder) => //{ // builder.OpenComponent(0, typeof(SoftwareVaults.DeleteSoftwareVaultInvitation)); // builder.AddAttribute(1, "Refresh", EventCallback.Factory.Create(this, LoadEmployeeAsync)); // builder.AddAttribute(2, "SoftwareVaultInvitation", softwareVaultInvitation); // builder.CloseComponent(); //}; //await ModalDialogService2.ShowAsync("Delete invitation", body); }
private async Task LoadTableDataAsync() { var currentTotalRows = TotalRecords; TotalRecords = await SoftwareVaultService.GetInvitationsCountAsync(SearchText, Filter); if (currentTotalRows != TotalRecords) { CurrentPage = 1; } SoftwareVaultInvitations = await SoftwareVaultService.GetSoftwareVaultInvitationsAsync((CurrentPage - 1) *DisplayRows, DisplayRows, SortedColumn, SortDirection, SearchText, Filter); SelectedInvitation = null; StateHasChanged(); }
public async Task CreateAndSendInvitationAsync(Employee employee, ServerSettings server, DateTime validTo) { if (employee == null) { throw new ArgumentNullException(nameof(employee)); } if (employee.Id == null) { throw new ArgumentNullException(nameof(employee.Id)); } if (employee.Email == null) { throw new ArgumentNullException(nameof(employee.Email)); } var activationCode = GenerateActivationCode(); var invitation = new SoftwareVaultInvitation() { EmployeeId = employee.Id, Status = SoftwareVaultInvitationStatus.Pending, CreatedAt = DateTime.UtcNow, ValidTo = validTo.Date, AcceptedAt = null, SoftwareVaultId = null, ActivationCode = activationCode }; var created = await _softwareVaultInvitationRepository.AddAsync(invitation); var activation = new SoftwareVaultActivation() { ServerAddress = server.Url, ActivationId = created.Id, ActivationCode = activationCode }; await _emailSenderService.SendSoftwareVaultInvitationAsync(employee, activation, validTo); }
private Task SelectedItemChangedAsync(SoftwareVaultInvitation item) { SelectedInvitation = item; StateHasChanged(); return(Task.CompletedTask); }