예제 #1
0
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            var response = new OutputInvoiceNoteSQLiteRepository().SetStatusDeleted(CurrentOutputInvoiceNoteDG.Identifier);

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

                CurrentOutputInvoiceNoteForm            = new OutputInvoiceNoteViewModel();
                CurrentOutputInvoiceNoteForm.Identifier = Guid.NewGuid();
                CurrentOutputInvoiceNoteForm.ItemStatus = ItemStatus.Added;

                CurrentOutputInvoiceNoteDG = null;

                OutputInvoiceCreatedUpdated();

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

            if (CurrentOutputInvoiceNoteForm.Note == null)
            {
                MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Obavezno_poljeDvotačka_Napomena"));
                return;
            }

            #endregion
            Thread th = new Thread(() =>
            {
                SubmitButtonEnabled = false;
                CurrentOutputInvoiceNoteForm.OutputInvoice = CurrentOutputInvoice;

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

                new OutputInvoiceNoteSQLiteRepository().Delete(CurrentOutputInvoiceNoteForm.Identifier);

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

                    CurrentOutputInvoiceNoteForm            = new OutputInvoiceNoteViewModel();
                    CurrentOutputInvoiceNoteForm.Identifier = Guid.NewGuid();
                    CurrentOutputInvoiceNoteForm.ItemStatus = ItemStatus.Added;
                    CurrentOutputInvoiceNoteForm.IsSynced   = false;
                    return;
                }
                CurrentOutputInvoiceNoteForm            = new OutputInvoiceNoteViewModel();
                CurrentOutputInvoiceNoteForm.Identifier = Guid.NewGuid();
                CurrentOutputInvoiceNoteForm.ItemStatus = ItemStatus.Added;
                CurrentOutputInvoiceNoteForm.IsSynced   = false;
                OutputInvoiceCreatedUpdated();

                DisplayOutputInvoiceNoteData();

                Application.Current.Dispatcher.BeginInvoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    new Action(() =>
                {
                    txtNote.Focus();
                })
                    );

                SubmitButtonEnabled = true;
            });
            th.IsBackground = true;
            th.Start();
        }
예제 #3
0
        public void DisplayOutputInvoiceNoteData()
        {
            OutputInvoiceNoteDataLoading = true;

            OutputInvoiceNoteListResponse response = new OutputInvoiceNoteSQLiteRepository()
                                                     .GetOutputInvoiceNotesByOutputInvoice(MainWindow.CurrentCompanyId, CurrentOutputInvoice.Identifier);

            if (response.Success)
            {
                OutputInvoiceNotesFromDB = new ObservableCollection <OutputInvoiceNoteViewModel>(
                    response.OutputInvoiceNotes ?? new List <OutputInvoiceNoteViewModel>());
            }
            else
            {
                OutputInvoiceNotesFromDB = new ObservableCollection <OutputInvoiceNoteViewModel>();
            }

            OutputInvoiceNoteDataLoading = false;
        }