private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            var response = new PhysicalPersonNoteSQLiteRepository().SetStatusDeleted(CurrentPhysicalPersonNoteDG.Identifier);

            if (response.Success)
            {
                MainWindow.SuccessMessage = ((string)Application.Current.FindResource("Stavka_je_uspešno_obrisanaUzvičnik"));

                CurrentPhysicalPersonNoteForm            = new PhysicalPersonNoteViewModel();
                CurrentPhysicalPersonNoteForm.Identifier = Guid.NewGuid();
                CurrentPhysicalPersonNoteForm.ItemStatus = ItemStatus.Added;

                CurrentPhysicalPersonNoteDG = null;

                PhysicalPersonCreatedUpdated();

                Thread displayThread = new Thread(() => DisplayPhysicalPersonNoteData());
                displayThread.IsBackground = true;
                displayThread.Start();
            }
            else
            {
                MainWindow.ErrorMessage = response.Message;
            }
        }
        private void btnAddNote_Click(object sender, RoutedEventArgs e)
        {
            #region Validation

            if (CurrentPhysicalPersonNoteForm.Note == null)
            {
                MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Napomena"));
                return;
            }

            #endregion
            Thread th = new Thread(() =>
            {
                SubmitButtonEnabled = false;
                CurrentPhysicalPersonNoteForm.PhysicalPerson = CurrentPhysicalPerson;

                CurrentPhysicalPersonNoteForm.Company = new CompanyViewModel()
                {
                    Id = MainWindow.CurrentCompanyId
                };
                CurrentPhysicalPersonNoteForm.CreatedBy = new UserViewModel()
                {
                    Id = MainWindow.CurrentUserId
                };

                new PhysicalPersonNoteSQLiteRepository().Delete(CurrentPhysicalPersonNoteForm.Identifier);

                var response = new PhysicalPersonNoteSQLiteRepository().Create(CurrentPhysicalPersonNoteForm);
                if (!response.Success)
                {
                    MainWindow.ErrorMessage = response.Message;

                    CurrentPhysicalPersonNoteForm            = new PhysicalPersonNoteViewModel();
                    CurrentPhysicalPersonNoteForm.Identifier = Guid.NewGuid();
                    CurrentPhysicalPersonNoteForm.ItemStatus = ItemStatus.Added;
                    CurrentPhysicalPersonNoteForm.IsSynced   = false;
                    return;
                }

                CurrentPhysicalPersonNoteForm            = new PhysicalPersonNoteViewModel();
                CurrentPhysicalPersonNoteForm.Identifier = Guid.NewGuid();
                CurrentPhysicalPersonNoteForm.ItemStatus = ItemStatus.Added;
                CurrentPhysicalPersonNoteForm.IsSynced   = false;

                PhysicalPersonCreatedUpdated();
                DisplayPhysicalPersonNoteData();

                Application.Current.Dispatcher.BeginInvoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    new Action(() =>
                {
                    txtNote.Focus();
                })
                    );
                SubmitButtonEnabled = true;
            });
            th.IsBackground = true;
            th.Start();
        }
        public void DisplayPhysicalPersonNoteData()
        {
            PhysicalPersonNoteDataLoading = true;

            PhysicalPersonNoteListResponse response = new PhysicalPersonNoteSQLiteRepository()
                                                      .GetPhysicalPersonNotesByPhysicalPerson(MainWindow.CurrentCompanyId, CurrentPhysicalPerson.Identifier);

            if (response.Success)
            {
                PhysicalPersonNotesFromDB = new ObservableCollection <PhysicalPersonNoteViewModel>(
                    response.PhysicalPersonNotes ?? new List <PhysicalPersonNoteViewModel>());
            }
            else
            {
                PhysicalPersonNotesFromDB = new ObservableCollection <PhysicalPersonNoteViewModel>();
            }

            PhysicalPersonNoteDataLoading = false;
        }