public async Task <IActionResult> PutPaymentInterval(int id, PaymentInterval paymentInterval)
        {
            if (id != paymentInterval.ID)
            {
                return(BadRequest());
            }

            _context.Entry(paymentInterval).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PaymentIntervalExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <PaymentInterval> > PostPaymentInterval(PaymentInterval paymentInterval)
        {
            _context.PaymentInterval.Add(paymentInterval);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPaymentInterval", new { id = paymentInterval.ID }, paymentInterval));
        }
示例#3
0
     public LoanTerms(Percent annualInterestRate,
                      PaymentInterval paymentInterval,
                      Percent administrativeFeeRate,
                      Money administrativeFeeMaxCap
                      )
     {
         AnnualInterestRate      = annualInterestRate;
         PaymentInterval         = paymentInterval;
         AdministrativeFeeRate   = administrativeFeeRate;
         AdministrativeFeeMaxCap = administrativeFeeMaxCap;
         PaymentsInYear          = PaymentInterval switch
         {
             // Estimated values, exact handling depends on domain
             PaymentInterval.Daily => 365.242199,
             PaymentInterval.Weekly => 52.177457,
             // Exact values
             PaymentInterval.Monthly => 12,
             PaymentInterval.Quarterly => 4,
             PaymentInterval.SemiAnnually => 2,
             PaymentInterval.Annually => 1,
             _ => throw new ArgumentOutOfRangeException(
                       nameof(paymentInterval),
                       "Invalid calculation interval value"
                       )
         };
     }
 }
示例#4
0
        static DateTime LastPayDay(DateTime date, PaymentInterval paymentInterval = PaymentInterval.BiWeekly)
        {
            var days = (date - SeedPayDate).Days;
            var i    = (double)paymentInterval;

            return(date.Date.AddDays((-1) * (days % i)));
        }
示例#5
0
 public Bill(string name, decimal amount, PaymentType payType, DayOfWeek day, PaymentInterval interval)
 {
     Name = name;
     Amount = amount;
     PayType = payType;
     Day = day;
     Interval = interval;
 }
        public override IElement CreateEmpty()
        {
            var interval = new PaymentInterval();

            Project.CurrentProject.Elements.AddElement(interval);

            return(interval);
        }
        public IPaymentInterval Create(PaymentIntervalType intervalType)
        {
            var interval = new PaymentInterval(intervalType);

            Project.CurrentProject.Elements.AddElement(interval);

            return(interval);
        }
 private void InitRepositories()
 {
     PatientsRepository = new PatientsRepository();
     months             = new List <string>()
     {
         "Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
     };
     MonthsNames = new Dictionary <int, string>();
     for (int i = 0; i < 12; i++)
     {
         MonthsNames.Add(i, months[i]);
     }
     PaymentInterval = new PaymentInterval();
 }
示例#9
0
        private DateTime GetPeriodEnd(DateTime periodStart, PaymentInterval interval, int intervalCount)
        {
            var retVal = periodStart;

            if (interval == PaymentInterval.Days)
            {
                retVal = retVal.AddDays(Math.Max(1, intervalCount));
            }
            else if (interval == PaymentInterval.Months)
            {
                retVal = retVal.AddMonths(Math.Max(1, intervalCount));
            }
            else if (interval == PaymentInterval.Weeks)
            {
                retVal = retVal.AddYears(Math.Max(1, intervalCount));
            }
            else if (interval == PaymentInterval.Weeks)
            {
                retVal = retVal.AddDays(7 * Math.Max(1, intervalCount));
            }
            return(retVal);
        }
示例#10
0
        public static void Initialize(VitecContext context)
        {
            context.Database.EnsureCreated();

            if (context.PaymentInterval.Any())
            {
                return; // database has been seeded
            }

            var paymentIntervals = new PaymentInterval[]
            {
                new PaymentInterval {
                    Interval = new TimeSpan(30), Discount = 0
                },
                new PaymentInterval {
                    Interval = new TimeSpan(90), Discount = 2.5
                },
                new PaymentInterval {
                    Interval = new TimeSpan(180), Discount = 5
                },
                new PaymentInterval {
                    Interval = new TimeSpan(360), Discount = 7.5
                }
            };

            foreach (PaymentInterval p in paymentIntervals)
            {
                context.PaymentInterval.Add(p);
            }

            context.SaveChanges();

            //Look for any subscribers


            var subscribers = new Subscriber[]
            {
                new Subscriber {
                    FirstName = "Victor", LastName = "West-Larsen", Email = "*****@*****.**", PhoneNumber = "12345678", Active = false
                },
                new Subscriber {
                    FirstName = "Kenni", LastName = "Holm", Email = "*****@*****.**", PhoneNumber = "11223344", Active = true
                },
                new Subscriber {
                    FirstName = "Nikolaj", LastName = "Lauridsen", Email = "*****@*****.**", PhoneNumber = "12312312", Active = true
                },
                new Subscriber {
                    FirstName = "Kasper", LastName = "Hoffmann", Email = "*****@*****.**", PhoneNumber = "12341234", Active = false
                }
            };

            foreach (Subscriber s in subscribers)
            {
                context.Subscriber.Add(s);
            }
            context.SaveChanges();

            var products = new Product[]
            {
                new Product {
                    Name = "IntoWords", Description = "Digitalt værktøj der hjælper dig med at skrive og læse, på både bærbare computere, tablets og mobil telefoner", Price = 30
                },
                new Product {
                    Name = "C-Pen", Description = "Skan ord eller sætninger ind på computeren så de kan læses op", Price = 20
                },
                new Product {
                    Name = "Grammateket", Description = "Tjekker din tekst for fejl i stavning, grammatik og kommatering", Price = 25
                },
                new Product {
                    Name = "Matematikleg Flex", Description = "Hjælp til elever med matematikvanskeligheder", Price = 40
                },
                new Product {
                    Name = "MiVo", Description = "Træner brugen af skrivehjælpen i CD-ORD og IntoWords  ", Price = 15
                }
            };

            foreach (Product p in products)
            {
                context.Product.Add(p);
            }
            context.SaveChanges();

            var subscriberProducts = new SubscriberProduct[]
            {
                new SubscriberProduct {
                    SubscribtionStart = DateTime.Now, SubscribtionEnd = Convert.ToDateTime("10,10,2020"),
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 0.0).ID,
                    ProductID         = products.Single(p => p.Name == "MiVo").ID,
                    SubscriberID      = subscribers.Single(s => s.Email == "*****@*****.**").ID
                },

                new SubscriberProduct {
                    SubscribtionStart = DateTime.Now, SubscribtionEnd = Convert.ToDateTime("10,12,2022"),
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 2.5).ID,
                    ProductID         = products.Single(p => p.Name == "IntoWords").ID,
                    SubscriberID      = subscribers.Single(s => s.Email == "*****@*****.**").ID
                }
            };

            foreach (SubscriberProduct s in subscriberProducts)
            {
                context.SubscriberProduct.Add(s);
            }
            context.SaveChanges();


            var productPaymentIntervals = new ProductPaymentInterval[]
            {
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "IntoWords").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 0).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "IntoWords").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 2.5).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "IntoWords").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 5.0).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "IntoWords").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 7.5).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "C-Pen").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 0).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "C-Pen").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 2.5).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "C-Pen").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 5.0).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "C-Pen").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 7.5).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "Grammateket").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 0).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "Grammateket").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 2.5).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "Grammateket").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 5.0).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "Grammateket").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 7.5).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "Matematikleg Flex").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 0).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "Matematikleg Flex").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 2.5).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "Matematikleg Flex").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 5.0).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "Matematikleg Flex").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 7.5).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "MiVo").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 0).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "MiVo").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 2.5).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "MiVo").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 5.0).ID
                },
                new ProductPaymentInterval {
                    ProductID         = products.Single(p => p.Name == "MiVo").ID,
                    PaymentIntervalID = paymentIntervals.Single(p => p.Discount == 7.5).ID
                },
            };

            foreach (ProductPaymentInterval p in productPaymentIntervals)
            {
                context.ProductPaymentInterval.Add(p);
            }
            context.SaveChanges();
        }