public void DisplayPhysicalPersonItemData()
        {
            PhysicalPersonItemDataLoading = true;

            PhysicalPersonItemListResponse response = new PhysicalPersonItemSQLiteRepository()
                                                      .GetPhysicalPersonItemsByPhysicalPerson(MainWindow.CurrentCompanyId, CurrentPhysicalPerson.Identifier);

            if (response.Success)
            {
                PhysicalPersonItemsFromDB = new ObservableCollection <PhysicalPersonItemViewModel>(
                    response.PhysicalPersonItems ?? new List <PhysicalPersonItemViewModel>());
            }
            else
            {
                PhysicalPersonItemsFromDB = new ObservableCollection <PhysicalPersonItemViewModel>();
            }

            PhysicalPersonItemDataLoading = false;
        }
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            var response = new PhysicalPersonItemSQLiteRepository().SetStatusDeleted(CurrentPhysicalPersonItemDG.Identifier);

            if (response.Success)
            {
                MainWindow.SuccessMessage                = ((string)Application.Current.FindResource("Stavka_je_uspešno_obrisanaUzvičnik"));
                CurrentPhysicalPersonItemForm            = new PhysicalPersonItemViewModel();
                CurrentPhysicalPersonItemForm.Identifier = Guid.NewGuid();
                CurrentPhysicalPersonItemForm.ItemStatus = ItemStatus.Added;

                CurrentPhysicalPersonItemDG = null;

                PhysicalPersonCreatedUpdated();

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

            if (CurrentPhysicalPersonItemForm.Name == null)
            {
                MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Naziv"));
                return;
            }

            if (CurrentPhysicalPersonItemForm.FamilyMember == null)
            {
                MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Naziv"));
                return;
            }

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

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

                new PhysicalPersonItemSQLiteRepository().Delete(CurrentPhysicalPersonItemForm.Identifier);

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

                    CurrentPhysicalPersonItemForm            = new PhysicalPersonItemViewModel();
                    CurrentPhysicalPersonItemForm.Identifier = Guid.NewGuid();
                    CurrentPhysicalPersonItemForm.ItemStatus = ItemStatus.Added;
                    CurrentPhysicalPersonItemForm.IsSynced   = false;

                    return;
                }

                CurrentPhysicalPersonItemForm            = new PhysicalPersonItemViewModel();
                CurrentPhysicalPersonItemForm.Identifier = Guid.NewGuid();
                CurrentPhysicalPersonItemForm.ItemStatus = ItemStatus.Added;
                CurrentPhysicalPersonItemForm.IsSynced   = false;

                PhysicalPersonCreatedUpdated();
                DisplayPhysicalPersonItemData();

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