private void btnDelete_Click(object sender, RoutedEventArgs e) { if (SelectedCompanyUserDG == null) { return; } SirmiumERPVisualEffects.AddEffectOnDialogShow(this); DeleteConfirmation deleteConfirmationForm = new DeleteConfirmation("pristupna prava korisnika", ""); var showDialog = deleteConfirmationForm.ShowDialog(); if (showDialog != null && showDialog.Value) { new CompanyUserSQLiteRepository().Delete(SelectedCompanyUserDG.Identifier); MainWindow.SuccessMessage = ((string)Application.Current.FindResource("Stavka_je_uspešno_obrisanaUzvičnik")); Thread displayThread = new Thread(() => DisplayItems()); displayThread.IsBackground = true; displayThread.Start(); } SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { if (CurrentBusinessPartner == null) { MainWindow.WarningMessage = "Morate odabrati firmu za brisanje!"; return; } SirmiumERPVisualEffects.AddEffectOnDialogShow(this); // Create confirmation window DeleteConfirmation deleteConfirmationForm = new DeleteConfirmation("firma", CurrentBusinessPartner.Name + CurrentBusinessPartner.Code); var showDialog = deleteConfirmationForm.ShowDialog(); if (showDialog != null && showDialog.Value) { BusinessPartnerResponse response = businessPartnerService.Delete(CurrentBusinessPartner.Identifier); if (!response.Success) { MainWindow.ErrorMessage = "Greška kod brisanja sa servera!"; SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this); return; } response = new BusinessPartnerSQLiteRepository().Delete(CurrentBusinessPartner.Identifier); if (!response.Success) { MainWindow.ErrorMessage = "Greška kod lokalnog brisanja!"; SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this); return; } MainWindow.SuccessMessage = "Firma je uspešno obrisana!"; Thread displayThread = new Thread(() => PopulateData()); displayThread.IsBackground = true; displayThread.Start(); } // Remove blur effects SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this); dgBusinessPartners.Focus(); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { // Check if any data is selected for delete if (CurrentIndividual == null) { MainWindow.ErrorMessage = ("Morate odabrati radnika za brisanje!"); return; } // Show blur effects SirmiumERPVisualEffects.AddEffectOnDialogShow(this); // Create confirmation window DeleteConfirmation deleteConfirmationForm = new DeleteConfirmation("radnika", CurrentIndividual.Name); var showDialog = deleteConfirmationForm.ShowDialog(); if (showDialog != null && showDialog.Value) { // Delete business partner IndividualResponse response = individualService.Delete(CurrentIndividual.Id); // Display data and notifications if (response.Success) { MainWindow.SuccessMessage = ("Podaci su uspešno obrisani!"); Thread displayThread = new Thread(() => PopulateData()); displayThread.IsBackground = true; displayThread.Start(); } else { MainWindow.ErrorMessage = (response.Message); } } // Remove blur effects SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this); dgIndividuals.Focus(); }
private void btnDeleteCity_Click(object sender, RoutedEventArgs e) { if (CurrentCity == null) { MainWindow.WarningMessage = "Morate odabrati grad za brisanje!"; return; } SirmiumERPVisualEffects.AddEffectOnDialogShow(this); // Create confirmation window DeleteConfirmation deleteConfirmationForm = new DeleteConfirmation("grad", CurrentCity.Name); var showDialog = deleteConfirmationForm.ShowDialog(); if (showDialog != null && showDialog.Value) { CityResponse response = cityService.Delete(CurrentCity.Identifier); if (!response.Success) { MainWindow.ErrorMessage = "Greška kod brisanja sa servera!"; SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this); return; } response = new CitySQLiteRepository().Delete(CurrentCity.Identifier); if (!response.Success) { MainWindow.ErrorMessage = "Greška kod lokalnog brisanja!"; SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this); return; } MainWindow.SuccessMessage = "Grad je uspešno obrisan!"; Thread displayThread = new Thread(() => DisplayData()); displayThread.IsBackground = true; displayThread.Start(); } SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this); }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { SirmiumERPVisualEffects.AddEffectOnDialogShow(this); // Save header for any new change btnSaveHeader_Click(sender, e); #region Validation if (!IsHeaderCreated) { MainWindow.WarningMessage = ((string)Application.Current.FindResource("Zaglavlje_nije_sačuvano")); return; } #endregion Thread th = new Thread(() => { SubmitButtonContent = ((string)Application.Current.FindResource("Čuvanje_u_tokuTriTacke")); SubmitButtonEnabled = false; CurrentUser.CompanyUsers = CompanyUsersFromDB.ToList(); UserResponse response = userService.Create(CurrentUser); if (response.Success) { MainWindow.SuccessMessage = ((string)Application.Current.FindResource("Podaci_su_uspešno_sačuvaniUzvičnik")); SubmitButtonContent = ((string)Application.Current.FindResource("Proknjiži")); SubmitButtonEnabled = true; UserCreatedUpdated(); CurrentUser = new UserViewModel(); CurrentUser.Identifier = Guid.NewGuid(); Application.Current.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { if (IsPopup) { FlyoutHelper.CloseFlyoutPopup(this); } else { FlyoutHelper.CloseFlyout(this); } }) ); } else { MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Greška_kod_čuvanja_na_serveruUzvičnik")); SubmitButtonContent = ((string)Application.Current.FindResource("Proknjiži")); SubmitButtonEnabled = true; } }); th.IsBackground = true; th.Start(); SirmiumERPVisualEffects.RemoveEffectOnDialogShow(this); }