Esempio n. 1
0
        private async void BtnPrepareNotes_Click(object sender, RoutedEventArgs e)
        {
            var service         = new NotesBuildingService(Settings.Default.RootDir);
            var notesToOverride = LbCreatedNotesCompanies.SelectedItems.Cast <Company>().ToList();
            var notesToAdd      = LbValidCompanies.SelectedItems.Cast <Company>().ToList();

            if (notesToOverride.Any())
            {
                var msg = GetOverrideMessage(notesToOverride);

                var answer = ShowConfirmationDialog(msg, "Prepisivanje podataka");

                if (answer == MessageBoxResult.Cancel)
                {
                    return;
                }
            }

            await ShowInfoDialog("Izrađujem podatke za bilješke", "Obrada");

            OnBackgroundWorkStart?.Invoke();

            try
            {
                var dataToAdd      = service.GetDataForNotes(notesToAdd);
                var dataToOverride = service.GetDataForNotes(notesToOverride);

                service.AddNotesForCompanies(dataToAdd);
                service.UpdateNotesForCompanies(dataToOverride);

                OnBackgroundWorkEnd?.Invoke();

                await ShowInfoDialog("Podaci za bilješke spremljeni.", "Kraj operacije");

                await LoadCompaniesAsync().ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                HandleException(ex);
                OnBackgroundWorkEnd?.Invoke();
            }
        }
Esempio n. 2
0
 public void TestInitialize()
 {
     root = "C:/Users/evlakre/Downloads/GFI/2019";
     sut  = new NotesBuildingService(root);
 }