protected async System.Threading.Tasks.Task BtnDeleteClick(MouseEventArgs args, dynamic data) { try { if (await DialogService.Confirm("Are you sure you want to delete this record?") == true) { var simpleInvoiceDeleteInvoiceLineResult = await SimpleInvoice.DeleteInvoiceLine(data.InvoiceLineId); if (simpleInvoiceDeleteInvoiceLineResult != null) { await RecalculateMasterAfterChildDelete(invoice, InvoiceLines); } if (simpleInvoiceDeleteInvoiceLineResult != null) { await grid0.Reload(); } } } catch (System.Exception simpleInvoiceDeleteInvoiceLineException) { NotificationService.Notify(new NotificationMessage() { Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to delete InvoiceLine" }); } }
private async Task setup(bool hasUnsyncedData = false, bool userConfirmsSignout = true) { DialogService.Confirm(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()) .Returns(Observable.Return(userConfirmsSignout)); DataSource.HasUnsyncedData().Returns(Observable.Return(hasUnsyncedData)); await ViewModel.Initialize(); }
private void DeleteFriend(Friend friend) { if (DialogService.Confirm("Really want to delete this friend?")) { AllFriends.Remove(friend); DataProvider.Delete(friend); DialogService.ShowMessage("Delete friend successfully"); } }
public void DialogServiceTest1() { IDlgService srv = new DialogService(); srv.Confirm("Prueba de Confirmacion", (res) => { srv.Show($"Resultado: {res}"); }); }
private async Task InactivateContactButtonClicked() { if (await DialogService.Confirm("Setting a contact inactive will also remove all reports for that contact. ", "Inactivate Contact?") == false) { return; } Contact.Active = false; DialogService.Close(Contact); }
private void DeletePersonal(Personal personal) { if (DialogService.Confirm("Möchten Sie wirklich diesen Angestellten löschen?")) { AllPersonals.Remove(personal); DataProvider.Delete(personal); DialogService.ShowMessage("Angestellten erfolgreich gelöscht!"); } }
private async void DeleteTvShowEpisode(TvShowEpisode episode) { var result = await DialogService.Confirm(Resources.MontyNi, Resources.AreYouSure); if (!result) { return; } Novaroma.Helper.DeleteTvShowEpisode(episode, _exceptionHandler); }
public async Task DoesNotLogTheUserOutIfPermissionIsDenied() { DialogService.Confirm( Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()) .Returns(Observable.Return(false)); DataSource.HasUnsyncedData().Returns(Observable.Return(true)); await ViewModel.Initialize(); ViewModel.SignOutCommand.Execute(); await DataSource.DidNotReceive().Logout(); }
private async void DeleteTvShowEpisode(TvShowEpisode episode) { PinTvShowFlyout = true; var result = await DialogService.Confirm(Resources.MontyNi, Resources.AreYouSure); if (result) { Novaroma.Helper.DeleteTvShowEpisode(episode, _exceptionHandler); } PinTvShowFlyout = false; }
protected async System.Threading.Tasks.Task GridDeleteButtonClick(MouseEventArgs args, object data) { try { if (await DialogService.Confirm("Do you want to delete this record?") == true) { //functie delete client and order FirmaCurierat.Models.FirmaCurierat.Clienti data2 = new Models.FirmaCurierat.Clienti(); // drivers2.RemoveAll(d => d.id_sofer == data2.id_sofer); data2 = (Models.FirmaCurierat.Clienti)data; SqlConnection scn = new SqlConnection(); string ServerName = Environment.MachineName; string database = "CurieratVladProiect"; string ConnectionString = String.Format(@"Server={0}\SQLEXPRESS;Initial Catalog={1}; Integrated Security = SSPI", ServerName, database); scn.ConnectionString = ConnectionString; //selectez comanda care urmeaza sa fie stearsa SqlCommand scmd = new SqlCommand("select id_comanda from comenzi where id_client = @id", scn); scmd.Parameters.Clear(); scmd.Parameters.AddWithValue("@id", data2.id_client); scn.Open(); int deletType = Convert.ToInt32(scmd.ExecuteScalar()); //sterg din tipul comenzii conform relatiei scmd = new SqlCommand("delete from tipul_comenzii where id_comanda = @id", scn); scmd.Parameters.AddWithValue("@id", deletType); scmd.ExecuteNonQuery(); //sterg din comenzi scmd = new SqlCommand("delete from comenzi where id_comanda = @id", scn); scmd.Parameters.AddWithValue("@id", deletType); scmd.ExecuteNonQuery(); scmd = new SqlCommand("delete from clienti where id_client = @id", scn); scmd.Parameters.AddWithValue("@id", data2.id_client); scmd.ExecuteNonQuery(); this.StateHasChanged(); clients = new List <FirmaCurierat.Models.FirmaCurierat.Clienti>(); string sqlCommand = "select * from clienti"; clients = await dataHelper.LoadData <FirmaCurierat.Models.FirmaCurierat.Clienti, dynamic>(sqlCommand, new { }, ConnectionString); grid.Refresh(); NotificationService.Notify(NotificationSeverity.Success, $"Order deleted"); } } catch (System.Exception rlvMailerDeleteMailException) { NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to delete order and client"); } }
public async Task DoesNotProceedWithLogoutWhenUserClicksCancelButtonInTheDialog() { ProgressSubject.OnNext(SyncProgress.Syncing); DialogService.Confirm( Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()).Returns(Observable.Return(false)); TestScheduler.Start(); ViewModel.TryLogout.Execute(); InteractorFactory.DidNotReceive().Logout(Arg.Any <LogoutSource>()); await NavigationService.DidNotReceive().Navigate <LoginViewModel>(); }
public async Task ClosesTheViewModelIfUserConfirms() { prepare(); DialogService .Confirm( Arg.Is(Resources.WorkspaceChangedAlertTitle), Arg.Is(Resources.WorkspaceChangedAlertMessage), Arg.Is(Resources.Ok), Arg.Is(Resources.Cancel)) .Returns(Observable.Return(true)); await ViewModel.DoneCommand.ExecuteAsync(); await NavigationService.Received().Close(Arg.Is(ViewModel), Arg.Any <long>()); }
public async Task ProceedsWithLogoutWhenUserClicksSignOutButtonInTheDialog() { ProgressSubject.OnNext(SyncProgress.Syncing); DialogService.Confirm( Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()).Returns(Observable.Return(true)); await ViewModel.TryLogout(); await DataSource.Received().Logout(); await NavigationService.Received().Navigate <LoginViewModel>(); }
public async Task DoesNotProceedWithLogoutWhenUserClicksCancelButtonInTheDialog() { ProgressSubject.OnNext(SyncProgress.Syncing); DialogService.Confirm( Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()).Returns(Observable.Return(false)); await ViewModel.LogoutCommand.ExecuteAsync(); ViewModel.IsLoggingOut.Should().BeFalse(); await DataSource.DidNotReceive().Logout(); await NavigationService.DidNotReceive().Navigate <LoginViewModel>(); }
public void DoesNothingIfUserCancels() { DialogService .Confirm( Arg.Is(Resources.WorkspaceChangedAlertTitle), Arg.Is(Resources.WorkspaceChangedAlertMessage), Arg.Is(Resources.Ok), Arg.Is(Resources.Cancel)) .Returns(Observable.Return(false)); ViewModel.Save.Execute(); TestScheduler.Start(); InteractorFactory.CreateProject(Arg.Any <CreateProjectDTO>()).DidNotReceive().Execute(); NavigationService.DidNotReceive().Close(Arg.Is(ViewModel), Arg.Any <long>()); }
public async Task ProceedsWithLogoutWhenUserClicksSignOutButtonInTheDialog() { ProgressSubject.OnNext(SyncProgress.Syncing); DialogService.Confirm( Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()).Returns(Observable.Return(true)); TestScheduler.Start(); ViewModel.TryLogout.Execute(); await InteractorFactory.Received().Logout(LogoutSource.Settings).Execute(); await NavigationService.Received().Navigate <LoginViewModel>(); }
public async Task ProceedsWithLogoutWhenUserClicksSignOutButtonInTheDialog() { ProgressSubject.OnNext(SyncProgress.Syncing); DialogService.Confirm( Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()).Returns(true); await ViewModel.LogoutCommand.ExecuteAsync(); ViewModel.IsLoggingOut.Should().BeTrue(); await DataSource.Received().Logout(); await NavigationService.Received().Navigate <OnboardingViewModel>(); }
public async Task CreatesProjectInTheSelectedWorkspaceIfUserConfirms() { prepare(); DialogService .Confirm( Arg.Is(Resources.WorkspaceChangedAlertTitle), Arg.Is(Resources.WorkspaceChangedAlertMessage), Arg.Is(Resources.Ok), Arg.Is(Resources.Cancel)) .Returns(Observable.Return(true)); await ViewModel.DoneCommand.ExecuteAsync(); await DataSource.Projects.Received().Create( Arg.Is <CreateProjectDTO>( dto => dto.WorkspaceId == selectedWorkspaceId)); }
public async Task DoesNothingIfUserCancels() { prepare(); DialogService .Confirm( Arg.Is(Resources.WorkspaceChangedAlertTitle), Arg.Is(Resources.WorkspaceChangedAlertMessage), Arg.Is(Resources.Ok), Arg.Is(Resources.Cancel)) .Returns(Observable.Return(false)); await ViewModel.DoneCommand.ExecuteAsync(); await DataSource.Projects.DidNotReceive().Create(Arg.Any <CreateProjectDTO>()); await NavigationService.DidNotReceive().Close(Arg.Is(ViewModel), Arg.Any <long>()); }
public async Task DoesNotProceedWithLogoutWhenUserClicksCancelButtonInTheDialog() { StateObservableSubject.OnNext(SyncState.Pull); DialogService.Confirm( Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()).Returns(false); await ViewModel.LogoutCommand.ExecuteAsync(); ViewModel.IsLoggingOut.Should().BeFalse(); await DataSource.SyncManager.DidNotReceive().Freeze(); await DataSource.DidNotReceive().Logout(); await NavigationService.DidNotReceive().Navigate <OnboardingViewModel>(); }
protected async Task DeleteEmailAlert(int id) { bool?result = await DialogService.Confirm("Are you sure?", "DELETE EMAIL ALERT", new ConfirmOptions() { OkButtonText = "Yes", CancelButtonText = "No", ShowClose = false }); if (result.Value == true) { var deletedNotification = await EmailAlertService.DeleteAsync(id); if (deletedNotification > 0) { } else { } } }
protected async System.Threading.Tasks.Task GridDeleteButtonClick(MouseEventArgs args, dynamic data) { try { if (await DialogService.Confirm("Are you sure you want to delete this record?") == true) { var conDataDeleteCountryResult = await ConData.DeleteCountry(countryId : data.CountryID); if (conDataDeleteCountryResult != null) { await grid0.Reload(); } } } catch (System.Exception conDataDeleteCountryException) { NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to delete Country"); } }
protected async System.Threading.Tasks.Task GridDeleteButtonClick(MouseEventArgs args, dynamic data) { try { if (await DialogService.Confirm("Are you sure you want to delete this record?") == true) { var innovateDbDeleteIdeaResult = await InnovateDb.DeleteIdea(data.id); if (innovateDbDeleteIdeaResult != null) { await grid0.Reload(); } } } catch (System.Exception innovateDbDeleteIdeaException) { NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to delete Idea"); } }
public async Task ReturnsWorkspaceIfNoProjectWasSelected() { DialogService.Confirm( Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>() ).Returns(Observable.Return(true)); long workspaceId = 420; ViewModel.SelectProject .Execute(ProjectSuggestion.NoProject(workspaceId, "")); await NavigationService.Received().Close( Arg.Is(ViewModel), Arg.Is <SelectProjectParameter>( parameter => parameter.WorkspaceId == workspaceId)); }
protected async Task DeleteNotificationTemplate(int id) { bool?result = await DialogService.Confirm("Are you sure?", "DELETE NOTIFICATION TEMPLATE", new ConfirmOptions() { OkButtonText = "Yes", CancelButtonText = "No", ShowClose = false }); if (result.Value == true) { var deletedNotification = await NotificationTemplateService.DeleteAsync(id); if (deletedNotification > 0) { } else { } } }
protected async System.Threading.Tasks.Task GridDeleteButtonClick(MouseEventArgs args, dynamic data) { try { if (await DialogService.Confirm("Are you sure you want to delete this record?") == true) { var blackmailazureDeleteDatumResult = await Blackmailazure.DeleteDatum(userId : data.UserID); if (blackmailazureDeleteDatumResult != null) { await grid0.Reload(); } } } catch (System.Exception blackmailazureDeleteDatumException) { NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to delete Datum"); } }
protected async System.Threading.Tasks.Task GridDeleteButtonClick(MouseEventArgs args, dynamic data) { try { if (await DialogService.Confirm("Are you sure you want to delete this record?") == true) { var bssr4DeleteTblNalogStavkiResult = await Bssr4.DeleteTblNalogStavki(data.ID); if (bssr4DeleteTblNalogStavkiResult != null) { await grid0.Reload(); } } } catch (System.Exception bssr4DeleteTblNalogStavkiException) { NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to delete TblNalogStavki"); } }
protected async Task DeleteActivityLog(int id) { bool?result = await DialogService.Confirm("Are you sure?", "DELETE ACTIVITY LOG", new ConfirmOptions() { OkButtonText = "Yes", CancelButtonText = "No", ShowClose = false }); if (result.Value == true) { var deletedNotification = await ActivityLogService.DeleteAsync(id); if (deletedNotification > 0) { } else { } } }
/// <summary> /// Provoque un appel protégé avec sauvegarde si les modifications d'un thème n'ont pas été enregistré /// </summary> async Task <bool> CallProtectedWithDirtySaveIfRequired(Func <Task <bool> > call) { Exception error = null; try { // Si le thème actuel est à sauvegarder if (CurrentNatalChart.IsDirty) { // On demande à l'utilisateur ce qu'il veut faire var cr = await DialogService.Confirm( AstroAssistant.Resources.Locales.SaveChangesDialogTitle, AstroAssistant.Resources.Locales.SaveChangesDialogMessage, DialogConfirmType.YesNoCancel); if (cr == DialogConfirmResult.Cancel) { return(false); } if (cr == DialogConfirmResult.Yes) { if (!await CurrentNatalChart.Save()) { return(false); } } } // On provoque l'appel return(await call()); } catch (Exception ex) { error = ex; } if (error != null) { await DialogService.ShowError(error); } return(false); }
//functie pentru stergere sofer din baza de date protected async System.Threading.Tasks.Task GridDeleteButtonClick(MouseEventArgs args, object data) { List <Models.FirmaCurierat.Soferi> drivers2 = new List <Models.FirmaCurierat.Soferi>(); FirmaCurierat.Models.FirmaCurierat.Soferi data2 = new Models.FirmaCurierat.Soferi(); data2 = (Models.FirmaCurierat.Soferi)data; drivers2 = drivers; try { if (await DialogService.Confirm("Do you want to delete this record?") == true) { drivers = new List <Models.FirmaCurierat.Soferi>(); SqlConnection scn = new SqlConnection(); string ServerName = Environment.MachineName; string database = "CurieratVladProiect"; string ConnectionString = String.Format(@"Server={0}\SQLEXPRESS;Initial Catalog={1}; Integrated Security = SSPI", ServerName, database); scn.ConnectionString = ConnectionString; SqlCommand scmd = new SqlCommand("delete from soferi where id_sofer = @id", scn); scmd.Parameters.Clear(); scmd.Parameters.AddWithValue("@id", data2.id_sofer); scn.Open(); scmd.ExecuteNonQuery(); } } catch (System.Exception rlvMailerDeleteMailException) { NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Driver has orders in delivery!"); return; } drivers2.RemoveAll(d => d.id_sofer == data2.id_sofer); drivers = drivers2; grid0.Refresh(); this.StateHasChanged(); }