Beispiel #1
0
    // Changes the current day
    void ChangeDay()
    {
        if (go_classManager.GetComponent <JH_Class_Manager>().currentClass == 0)
        {
            currentDay   = ListDays.Monday;
            tx_days.text = currentDay.ToString();
        }
        if (go_classManager.GetComponent <JH_Class_Manager>().currentClass == 2)
        {
            currentDay   = ListDays.Tuesday;
            tx_days.text = currentDay.ToString();
        }
        if (go_classManager.GetComponent <JH_Class_Manager>().currentClass == 4)
        {
            currentDay   = ListDays.Wednesday;
            tx_days.text = currentDay.ToString();
        }
        if (go_classManager.GetComponent <JH_Class_Manager>().currentClass == 6)
        {
            currentDay   = ListDays.Thursday;
            tx_days.text = currentDay.ToString();
        }
        if (go_classManager.GetComponent <JH_Class_Manager>().currentClass == 8)
        {
            currentDay   = ListDays.Friday;
            tx_days.text = currentDay.ToString();
        }

        tx_time.text = in_currentTime.ToString() + ":00";
    }
        /// <summary>
        /// Method that calculate the payment and return the value.
        /// </summary>
        /// <param name="listWorkedInterval"> A list of WorkedTime.</param>
        /// <returns>The value calculate matching the ValuedIntervals and the WorkedTime</returns>
        public float CalculatePaymentForMatchedDays(List <IWorkedTime> listWorkedInterval)
        {
            List <ITimeInterval> coincidentWordekInterval = listWorkedInterval
                                                            .Where(a => ListDays.Any(b => string.Compare((a as IWorkedTime).Day, b, true) == 0))
                                                            .Select(x => new TimeInterval((x as ITimeInterval).From, (x as ITimeInterval).To)).ToList <ITimeInterval>();

            return(ListValuedIntervals.Sum(x => GetPaymentForMatchedTime(coincidentWordekInterval, x)));
        }
 private void ValidateDays()
 {
     if (ListValuedIntervals.Count() == 0)
     {
         throw new ArgumentException("The list of days is empty.");
     }
     if (ListDays.GroupBy(x => x)
         .Where(group => group.Count() > 1)
         .Count() > 0)
     {
         throw new ArgumentException("The list of days contains one or more repeated value.");
     }
 }