예제 #1
0
        private static TaxOfficeInfo ProcessChangeName(DateTime date, TaxOfficeChange change, List <TaxOfficeInfo> oldEntries)
        {
            var oldEntry = oldEntries.Single(x => x.ValidUntil == null);

            // Alten Eintrag löschen
            oldEntries.Remove(oldEntry);
            if (oldEntry.ValidSince == null || oldEntry.ValidSince.Value != date)
            {
                // Neuen "alten" Eintrag erstellen, wenn das "Gültig von"-Datum nicht dem aktuellen Datum entspricht.
                oldEntries.Add(
                    new TaxOfficeInfo(
                        oldEntry.BufaNr,
                        oldEntry.Name,
                        oldEntry.SupportsElsterAnmeldung,
                        oldEntry.Province,
                        oldEntry.IsTest,
                        oldEntry.ValidSince,
                        date,
                        oldEntry.RedirectTo));
            }

            return(new TaxOfficeInfo(
                       oldEntry.BufaNr,
                       change.Name ?? oldEntry.Name,
                       change.SupportsElsterAnmeldung ?? oldEntry.SupportsElsterAnmeldung,
                       oldEntry.Province,
                       oldEntry.IsTest,
                       date,
                       redirectTo: oldEntry.RedirectTo));
        }
예제 #2
0
 private static TaxOfficeInfo ProcessChangeValid(DateTime date, TaxOfficeChange change, List <TaxOfficeInfo> oldEntries)
 {
     if (change.IsValid)
     {
         Debug.Assert(oldEntries.Count != 0 && oldEntries.All(x => x.ValidUntil.HasValue), "Ensure that we have entries that are all invalid.");
         var oldEntry = oldEntries.OrderByDescending(x => x.ValidUntil).First();
         return(new TaxOfficeInfo(
                    oldEntry.BufaNr,
                    oldEntry.Name,
                    oldEntry.SupportsElsterAnmeldung,
                    oldEntry.Province,
                    oldEntry.IsTest,
                    date,
                    redirectTo: oldEntry.RedirectTo));
     }
     else
     {
         Debug.Assert(oldEntries.Any(x => x.ValidUntil == null), "Ensure that we have at least one active tax office.");
         var oldEntry = oldEntries.SingleOrDefault(x => x.ValidUntil == null);
         oldEntries.Remove(oldEntry);
         return(new TaxOfficeInfo(
                    oldEntry.BufaNr,
                    oldEntry.Name,
                    oldEntry.SupportsElsterAnmeldung,
                    oldEntry.Province,
                    oldEntry.IsTest,
                    oldEntry.ValidSince,
                    date,
                    oldEntry.RedirectTo));
     }
 }
예제 #3
0
        private static TaxOfficeInfo ProcessRedirectTo(DateTime date, TaxOfficeChange change, List <TaxOfficeInfo> oldEntries)
        {
            Debug.Assert(oldEntries.Any(x => x.ValidUntil == null), "Ensure that the tax office exists.");
            var oldEntry = oldEntries.Single(x => x.ValidUntil == null);

            // Alten Eintrag löschen
            oldEntries.Remove(oldEntry);
            if (!change.IsValid)
            {
                return(new TaxOfficeInfo(
                           oldEntry.BufaNr,
                           oldEntry.Name,
                           change.SupportsElsterAnmeldung ?? oldEntry.SupportsElsterAnmeldung,
                           oldEntry.Province,
                           oldEntry.IsTest,
                           oldEntry.ValidSince,
                           date,
                           change.NewBufaNr));
            }

            if (oldEntry.ValidSince == null || oldEntry.ValidSince.Value != date)
            {
                // Neuen "alten" Eintrag erstellen, wenn das "Gültig von"-Datum nicht dem aktuellen Datum entspricht.
                oldEntries.Add(
                    new TaxOfficeInfo(
                        oldEntry.BufaNr,
                        oldEntry.Name,
                        oldEntry.SupportsElsterAnmeldung,
                        oldEntry.Province,
                        oldEntry.IsTest,
                        oldEntry.ValidSince,
                        date,
                        oldEntry.RedirectTo));
            }

            return(new TaxOfficeInfo(
                       oldEntry.BufaNr,
                       oldEntry.Name,
                       change.SupportsElsterAnmeldung ?? oldEntry.SupportsElsterAnmeldung,
                       oldEntry.Province,
                       oldEntry.IsTest,
                       date,
                       redirectTo: change.NewBufaNr));
        }
예제 #4
0
 private static TaxOfficeInfo ProcessNew(DateTime date, TaxOfficeChange change)
 {
     return(new TaxOfficeInfo(change.BufaNr, change.Name, change.SupportsElsterAnmeldung.GetValueOrDefault(), change.Province, change.IsTest, date));
 }
        private static TaxOfficeInfo ProcessChangeName(DateTime date, TaxOfficeChange change, List<TaxOfficeInfo> oldEntries)
        {
            var oldEntry = oldEntries.Single(x => x.ValidUntil == null);

            // Alten Eintrag löschen
            oldEntries.Remove(oldEntry);
            if (oldEntry.ValidSince == null || oldEntry.ValidSince.Value != date)
            {
                // Neuen "alten" Eintrag erstellen, wenn das "Gültig von"-Datum nicht dem aktuellen Datum entspricht.
                oldEntries.Add(
                    new TaxOfficeInfo(
                        oldEntry.BufaNr,
                        oldEntry.Name,
                        oldEntry.SupportsElsterAnmeldung,
                        oldEntry.Province,
                        oldEntry.IsTest,
                        oldEntry.ValidSince,
                        date,
                        oldEntry.RedirectTo));
            }

            return new TaxOfficeInfo(
                oldEntry.BufaNr,
                change.Name ?? oldEntry.Name,
                change.SupportsElsterAnmeldung ?? oldEntry.SupportsElsterAnmeldung,
                oldEntry.Province,
                oldEntry.IsTest,
                date,
                redirectTo: oldEntry.RedirectTo);
        }
        private static TaxOfficeInfo ProcessRedirectTo(DateTime date, TaxOfficeChange change, List<TaxOfficeInfo> oldEntries)
        {
            Debug.Assert(oldEntries.Any(x => x.ValidUntil == null), "Ensure that the tax office exists.");
            var oldEntry = oldEntries.Single(x => x.ValidUntil == null);

            // Alten Eintrag löschen
            oldEntries.Remove(oldEntry);
            if (!change.IsValid)
            {
                return new TaxOfficeInfo(
                    oldEntry.BufaNr,
                    oldEntry.Name,
                    change.SupportsElsterAnmeldung ?? oldEntry.SupportsElsterAnmeldung,
                    oldEntry.Province,
                    oldEntry.IsTest,
                    oldEntry.ValidSince,
                    date,
                    change.NewBufaNr);
            }

            if (oldEntry.ValidSince == null || oldEntry.ValidSince.Value != date)
            {
                // Neuen "alten" Eintrag erstellen, wenn das "Gültig von"-Datum nicht dem aktuellen Datum entspricht.
                oldEntries.Add(
                    new TaxOfficeInfo(
                        oldEntry.BufaNr,
                        oldEntry.Name,
                        oldEntry.SupportsElsterAnmeldung,
                        oldEntry.Province,
                        oldEntry.IsTest,
                        oldEntry.ValidSince,
                        date,
                        oldEntry.RedirectTo));
            }

            return new TaxOfficeInfo(
                oldEntry.BufaNr,
                oldEntry.Name,
                change.SupportsElsterAnmeldung ?? oldEntry.SupportsElsterAnmeldung,
                oldEntry.Province,
                oldEntry.IsTest,
                date,
                redirectTo: change.NewBufaNr);
        }
 private static TaxOfficeInfo ProcessNew(DateTime date, TaxOfficeChange change)
 {
     return new TaxOfficeInfo(change.BufaNr, change.Name, change.SupportsElsterAnmeldung.GetValueOrDefault(), change.Province, change.IsTest, date);
 }
 private static TaxOfficeInfo ProcessChangeValid(DateTime date, TaxOfficeChange change, List<TaxOfficeInfo> oldEntries)
 {
     if (change.IsValid)
     {
         Debug.Assert(oldEntries.Count != 0 && oldEntries.All(x => x.ValidUntil.HasValue), "Ensure that we have entries that are all invalid.");
         var oldEntry = oldEntries.OrderByDescending(x => x.ValidUntil).First();
         return new TaxOfficeInfo(
             oldEntry.BufaNr,
             oldEntry.Name,
             oldEntry.SupportsElsterAnmeldung,
             oldEntry.Province,
             oldEntry.IsTest,
             date,
             redirectTo: oldEntry.RedirectTo);
     }
     else
     {
         Debug.Assert(oldEntries.Any(x => x.ValidUntil == null), "Ensure that we have at least one active tax office.");
         var oldEntry = oldEntries.SingleOrDefault(x => x.ValidUntil == null);
         oldEntries.Remove(oldEntry);
         return new TaxOfficeInfo(
             oldEntry.BufaNr,
             oldEntry.Name,
             oldEntry.SupportsElsterAnmeldung,
             oldEntry.Province,
             oldEntry.IsTest,
             oldEntry.ValidSince,
             date,
             oldEntry.RedirectTo);
     }
 }