예제 #1
0
        private void SaveListing()
        {
            if (Listing == null)
            {
                throw new Exception("No Listing is set!");
            }

            Listing.Name          = string.IsNullOrEmpty(Name) ? null : Name.Trim();
            Listing.HourlyWage    = _hourlyWage;
            Listing.Employer      = _selectedEmployer == _promptEmployer ? null : _selectedEmployer;
            Listing.Vacation      = Vacation;
            Listing.Holiday       = Holiday;
            Listing.SicknessHours = SicknessHours;
            Listing.VacationDays  = VacationDays;
            Listing.Diets         = Diets;
            Listing.PaidHolidays  = PaidHolidays;
            Listing.Bonuses       = Bonuses;
            Listing.Dollars       = Dollars;
            Listing.Prepayment    = Prepayment;
            Listing.Sickness      = Sickness;

            _listingFacade.Update(Listing);

            if (_hourlyWage != null && _hourlyWage <= 0)
            {
                HourlyWage = null;
            }

            EventAggregator.PublishOnUIThread(new ListingSuccessfulySavedMessage(Listing));
        }
예제 #2
0
        private void SaveListingItem()
        {
            ListingItem newItem = _dayItem.Listing.ReplaceItem(
                _dayItem.Day,
                string.IsNullOrEmpty(_locality) ? null : _locality.Trim(),
                new Time(WorkedTimeViewModel.StartTime),
                new Time(WorkedTimeViewModel.EndTime),
                new Time(WorkedTimeViewModel.LunchStart),
                new Time(WorkedTimeViewModel.LunchEnd),
                new Time(WorkedTimeViewModel.OtherHours)
                );

            _listingFacade.Update(_dayItem.Listing);

            DayItem.Update(newItem);

            EventAggregator.PublishOnUIThread(new ChangeViewMessage <ListingDetailViewModel>());
        }