Exemplo n.º 1
0
        private void Sync()
        {
            new LimitationSQLiteRepository().Sync(limitationService);

            new LimitationEmailSQLiteRepository().Sync(limitationEmailService);

            CurrentLimitation = new LimitationSQLiteRepository().GetLimitation(MainWindow.CurrentCompanyId)?.Limitation;

            DisplayEmailData();
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            Thread th = new Thread(() =>
            {
                SaveButtonContent = " Wird geschpeichert... ";
                SaveButtonEnabled = false;

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

                CurrentLimitation.IsSynced  = false;
                CurrentLimitation.UpdatedAt = DateTime.Now;

                LimitationResponse response = new LimitationSQLiteRepository().Delete(CurrentLimitation.Identifier);
                response = new LimitationSQLiteRepository().Create(CurrentLimitation);
                if (!response.Success)
                {
                    MainWindow.ErrorMessage = "Lokaler Speicherfehler!";
                    SaveButtonContent       = " SAČUVAJ ";
                    SaveButtonEnabled       = true;
                    return;
                }

                response = limitationService.Create(CurrentLimitation);
                if (!response.Success)
                {
                    MainWindow.ErrorMessage = "Die Daten wurden im Lokal gespeichert. Server-Speicherfehler!";
                    SaveButtonContent       = " SAČUVAJ ";
                    SaveButtonEnabled       = true;
                }

                if (response.Success)
                {
                    MainWindow.SuccessMessage = "Daten wurden erfolgreich gespeichert!";
                    SaveButtonContent         = " SAČUVAJ ";
                    SaveButtonEnabled         = true;
                }
            });

            th.IsBackground = true;
            th.Start();
        }