示例#1
0
        private void RemoveItemByDay(int day)
        {
            Listing.RemoveItemByDay(day);
            _dayItems[day - 1].Reset();

            _listingFacade.Save(Listing);
        }
示例#2
0
        private void SaveListing()
        {
            Name = string.IsNullOrEmpty(Name) ? null : Name.Trim();

            Listing newListing = new Listing(SelectedYear, SelectedMonth);

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

            if (_selectedEmployer != _promptEmployer)
            {
                newListing.Employer = _selectedEmployer;
            }

            _listingFacade.Save(newListing);

            SetDefaults();

            EventAggregator.PublishOnUIThread(new ChangeViewMessage(nameof(ListingDetailViewModel)));
            EventAggregator.PublishOnUIThread(new ListingMessage(newListing));
        }
        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.Save(Listing);

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

            EventAggregator.PublishOnUIThread(new ChangeViewMessage(nameof(ListingDetailViewModel)));
        }
        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.Save(_dayItem.Listing);

            DayItem.Update(newItem);

            EventAggregator.PublishOnUIThread(new ChangeViewMessage(nameof(ListingDetailViewModel)));
        }