Esempio n. 1
0
 public Shift ToShift()
 {
     return(new Shift
     {
         Bedtime = Bedtime,
         EndTime = LeaveTime,
         StartTime = StartTime,
         HourlyRates = HourlyRates.FromRates(HourlyRate, HourlyRateBetweenBedtimeAndMidnight, HourlyRateAfterMidnight)
     });
 }
Esempio n. 2
0
 private static Sitter CreateSitter(AddBabySitterArgs args)
 {
     return(new Sitter
     {
         FirstName = args.FirstName,
         LastName = args.LastName,
         HourlyRates = HourlyRates.FromRates(
             args.HourlyRate.GetValueOrDefault(HourlyRates.StandardHourlyRate),
             args.HourlyRateBetweenBedtimeAndMidnight.GetValueOrDefault(HourlyRates.StandardHourlyRateBetweenBedtimeAndMidnight),
             args.HourlyRateAfterMidnight.GetValueOrDefault(HourlyRates.StandardHourlyRateAfterMidnight))
     });
 }
Esempio n. 3
0
 public static Sitter CreateSitter(
     string firstName  = null,
     string lastName   = null,
     HourlyRates rates = null)
 {
     return(new Sitter
     {
         FirstName = firstName ?? Guid.NewGuid().ToString(),
         LastName = lastName ?? Guid.NewGuid().ToString(),
         HourlyRates = rates ?? HourlyRates.FromStandardRates()
     });
 }
Esempio n. 4
0
        public Rate CalculateHourlyRate(UserData ud)
        {
            var hr = HourlyRates.FindAll(f => !f.IsMaxRate && ud.TotalHours <= f.MaxHours).OrderBy(o => o.MaxHours).FirstOrDefault();

            if (hr == null)
            {
                hr = HourlyRates.Find(f => f.IsMaxRate);
                if (ud.TotalDays > 1)
                {
                    hr.RatePrice = hr.RatePrice * ud.TotalDays;
                }
            }
            return(hr as Rate);
        }
Esempio n. 5
0
 public static Shift CreateShift(
     Sitter sitter           = null,
     LocalDateTime?startTime = null,
     LocalDateTime?bedtime   = null,
     LocalDateTime?endtime   = null,
     HourlyRates hourlyRates = null)
 {
     return(new Shift
     {
         Bedtime = bedtime ?? new LocalDateTime(2018, 6, 30, 21, 0),
         EndTime = endtime ?? new LocalDateTime(2018, 7, 1, 0, 0),
         HourlyRates = hourlyRates ?? HourlyRates.FromStandardRates(),
         Sitter = sitter ?? CreateSitter(),
         StartTime = startTime ?? new LocalDateTime(2018, 6, 30, 17, 0)
     });
 }