/// <summary>
        /// Insert PreAbonnementProdukt in Abonnementer
        /// </summary>
        /// <param name="PreAbonnementId"></param>
        /// <returns></returns>
        private void UpdateAbonnemnt(int PreAbonnementId)
        {
            var obj = PreAbonnementRepositry.GetById(PreAbonnementId);

            var details = new Abonnementer
            {
                Ugedag             = (DayOfWeek)obj.DayOfWeek,
                RuteIndex          = obj.TurLevering.Zindex,
                LeveringsAdresseId = obj.AddressId,
                KundeId            = obj.TurLevering.KundeId,
                KundeNr            = obj.Adresser.KundeNr,
                StartDato          = obj.StartDate,
                SlutDato           = obj.EndDate,
                Antal          = obj.Antal,
                ProduktNr      = obj.ProduktNr,
                Interval       = obj.Interval,
                CreatedDate    = obj.CreatedAt,
                PrintPakkeList = (bool)obj.TurLevering.PrintPakkeListe
            };

            AbonnementerRepository.Update(details);
            unitOfWork.Commit();
        }
 public static bool IsIntervalOther(this AbonnementProdukt abonnementProdukt, Abonnementer abonnement, DateTime leveringsDato,
                                    int week, int year)
 {
     if (abonnementProdukt.Interval == Interval.FørstDagHverMåned)
     {
         DateTime Date = TimeTool.GetDate(year, week, (int)DayOfWeek.Sunday);
         for (int i = 0; i < 7; i++)
         {
             if (Date.Day == 1)
             {
                 break;
             }
             else
             {
                 Date = Date.AddDays(-1);
             }
         }
         if (Date.Day == 1 && abonnementProdukt.IsActive(Date) && !abonnementProdukt.OnPause(Date))
         {
             return(true);
         }
     }
     else if (abonnementProdukt.Interval == Interval.SidstDagHverMåned)
     {
         DateTime Date = TimeTool.GetDate(year, week, (int)DayOfWeek.Monday);
         for (int i = 0; i <= 6; i++)
         {
             if (Date.AddDays(1).Day == 1)
             {
                 break;
             }
             else
             {
                 Date = Date.AddDays(1);
             }
         }
         if (Date.AddDays(1).Day == 1 && abonnementProdukt.IsActive(Date) && !abonnementProdukt.OnPause(Date))
         {
             return(true);
         }
     }
     else if (abonnementProdukt.Interval == Interval.SidstArbejdsdagIMåned)
     {
         DateTime Date = TimeTool.GetDate(year, week, (int)DayOfWeek.Monday);
         for (int i = 0; i <= 4; i++)
         {
             if (Date.AddDays(1).Day == 1 || Date.DayOfWeek == DayOfWeek.Friday)
             {
                 break;
             }
             else
             {
                 Date = Date.AddDays(1);
             }
         }
         if ((Date.AddDays(1).Day == 1 || Date.DayOfWeek == DayOfWeek.Friday) && abonnementProdukt.IsActive(Date) &&
             !abonnementProdukt.OnPause(Date))
         {
             return(true);
         }
     }
     else if (abonnementProdukt.Interval == Interval.FørstArbejdsdagIMåned)
     {
         DateTime Date = TimeTool.GetDate(year, week, (int)DayOfWeek.Friday);
         for (int i = 0; i <= 4; i++)
         {
             if (Date.Day == 1)
             {
                 break;
             }
             else
             {
                 Date = Date.AddDays(-1);
             }
         }
         if (Date.Day == 1 && abonnementProdukt.IsActive(Date) && !abonnementProdukt.OnPause(Date))
         {
             return(true);
         }
     }
     else if (abonnementProdukt.Interval == Interval.SidsteValgteDagIMåned)
     {
         DateTime Date = TimeTool.GetDate(year, week, (int)DayOfWeek.Monday);
         for (int i = 0; i <= 6; i++)
         {
             if (Date.DayOfWeek == abonnement.Ugedag || Date.AddDays(1).Day == 1)
             {
                 break;
             }
             else
             {
                 Date = Date.AddDays(1);
             }
         }
         if (Date.DayOfWeek == abonnement.Ugedag && Date.AddDays(7).Day <= 7 &&
             abonnementProdukt.IsActive(Date) && !abonnementProdukt.OnPause(Date))
         {
             return(true);
         }
     }
     else if (abonnementProdukt.Interval == Interval.FørsteValgteDagIMåned)
     {
         DateTime Date = TimeTool.GetDate(year, week, (int)DayOfWeek.Sunday);
         for (int i = 0; i <= 6; i++)
         {
             if (Date.DayOfWeek == abonnement.Ugedag || Date.Day == 1)
             {
                 break;
             }
             else
             {
                 Date = Date.AddDays(-1);
             }
         }
         if (Date.Day <= 7 && Date.DayOfWeek == abonnement.Ugedag && abonnementProdukt.IsActive(Date) && !abonnementProdukt.OnPause(Date))
         {
             return(true);
         }
     }
     else if (abonnementProdukt.Interval == Interval.LigeMåned)
     {
         var date = TimeTool.GetDate(year, week, abonnement.Ugedag);
         if (date.Month % 2 == 0 &&
             date.Day <= 7 && abonnement.Ugedag == date.DayOfWeek &&
             abonnementProdukt.IsActive(date) &&
             !abonnementProdukt.OnPause(date))
         {
             return(true);
         }
     }
     else if (abonnementProdukt.Interval == Interval.UligeMåned)
     {
         var date = TimeTool.GetDate(year, week, abonnement.Ugedag);
         if (date.Month % 2 == 1 &&
             date.Day <= 7 &&
             abonnement.Ugedag == date.DayOfWeek &&
             abonnementProdukt.IsActive(date) &&
             !abonnementProdukt.OnPause(date))
         {
             return(true);
         }
     }
     return(false);
 }