Example #1
0
        public ListingItem AddItem(int day, string locality, Time start, Time end, Time lunchStart, Time lunchEnd, Time otherHours)
        {
            if (_items.ContainsKey(day))
            {
                throw new ListingItemAlreadyExistsException();
            }

            ListingItem newItem = new ListingItem(this, day, locality, start, end, lunchStart, lunchEnd, otherHours);

            _items.Add(day, newItem);
            WorkedDays++;
            WorkedHours      += newItem.TimeSetting.WorkedHours;
            LunchHours       += newItem.TimeSetting.LunchHours;
            OtherHours       += newItem.TimeSetting.OtherHours;
            TotalWorkedHours += newItem.TimeSetting.TotalWorkedHours;

            if (!string.IsNullOrEmpty(newItem.Locality))
            {
                Localities.Add(locality);
            }

            return(newItem);
        }