private void BtnDelete_Click(object sender, RoutedEventArgs e) { var response = new InputInvoiceNoteSQLiteRepository().SetStatusDeleted(CurrentInputInvoiceNoteDG.Identifier); if (response.Success) { MainWindow.SuccessMessage = ((string)Application.Current.FindResource("Stavka_je_uspešno_obrisanaUzvičnik")); CurrentInputInvoiceNoteForm = new InputInvoiceNoteViewModel(); CurrentInputInvoiceNoteForm.Identifier = Guid.NewGuid(); CurrentInputInvoiceNoteForm.ItemStatus = ItemStatus.Added; CurrentInputInvoiceNoteDG = null; InputInvoiceCreatedUpdated(); Thread displayThread = new Thread(() => DisplayInputInvoiceNoteData()); displayThread.IsBackground = true; displayThread.Start(); } else { MainWindow.ErrorMessage = response.Message; } }
public void DisplayInputInvoiceNoteData() { InputInvoiceNoteDataLoading = true; InputInvoiceNoteListResponse response = new InputInvoiceNoteSQLiteRepository() .GetInputInvoiceNotesByInputInvoice(MainWindow.CurrentCompanyId, CurrentInputInvoice.Identifier); if (response.Success) { InputInvoiceNotesFromDB = new ObservableCollection <InputInvoiceNoteViewModel>( response.InputInvoiceNotes ?? new List <InputInvoiceNoteViewModel>()); } else { InputInvoiceNotesFromDB = new ObservableCollection <InputInvoiceNoteViewModel>(); } InputInvoiceNoteDataLoading = false; }
private void DisplayInputInvoiceNoteData() { NoteDataLoading = true; InputInvoiceNoteListResponse response = new InputInvoiceNoteSQLiteRepository() .GetInputInvoiceNotesByInputInvoice(MainWindow.CurrentCompanyId, CurrentInputInvoice.Identifier); if (response.Success) { NotesFromDB = new ObservableCollection <InputInvoiceNoteViewModel>( response.InputInvoiceNotes ?? new List <InputInvoiceNoteViewModel>()); } else { NotesFromDB = new ObservableCollection <InputInvoiceNoteViewModel>(); MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Greška_prilikom_učitavanja_podatakaUzvičnik")); } NoteDataLoading = false; }
private void btnAddNote_Click(object sender, RoutedEventArgs e) { #region Validation if (CurrentInputInvoiceNoteForm.Note == null) { MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Obavezno_poljeDvotačka_Napomena")); return; } #endregion Thread th = new Thread(() => { SubmitButtonEnabled = false; CurrentInputInvoiceNoteForm.InputInvoice = CurrentInputInvoice; CurrentInputInvoiceNoteForm.Company = new CompanyViewModel() { Id = MainWindow.CurrentCompanyId }; CurrentInputInvoiceNoteForm.CreatedBy = new UserViewModel() { Id = MainWindow.CurrentUserId }; new InputInvoiceNoteSQLiteRepository().Delete(CurrentInputInvoiceNoteForm.Identifier); var response = new InputInvoiceNoteSQLiteRepository().Create(CurrentInputInvoiceNoteForm); if (!response.Success) { MainWindow.ErrorMessage = response.Message; CurrentInputInvoiceNoteForm = new InputInvoiceNoteViewModel(); CurrentInputInvoiceNoteForm.Identifier = Guid.NewGuid(); CurrentInputInvoiceNoteForm.ItemStatus = ItemStatus.Added; CurrentInputInvoiceNoteForm.IsSynced = false; return; } CurrentInputInvoiceNoteForm = new InputInvoiceNoteViewModel(); CurrentInputInvoiceNoteForm.Identifier = Guid.NewGuid(); CurrentInputInvoiceNoteForm.ItemStatus = ItemStatus.Added; CurrentInputInvoiceNoteForm.IsSynced = false; InputInvoiceCreatedUpdated(); DisplayInputInvoiceNoteData(); Application.Current.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { txtNote.Focus(); }) ); SubmitButtonEnabled = true; }); th.IsBackground = true; th.Start(); }