Exemple #1
0
        private void CopyListing() // todo redirect to overview / listing detail + flashMessage etc...
        {
            Listing newListing = _listingFactory.Create(Listing.Year, Listing.Month);

            newListing.Name          = ListingName;
            newListing.Employer      = Listing.Employer;
            newListing.Vacation      = Listing.Vacation;
            newListing.Holiday       = Listing.Holiday;
            newListing.SicknessHours = Listing.SicknessHours;
            newListing.HourlyWage    = Listing.HourlyWage;
            newListing.VacationDays  = Listing.VacationDays;
            newListing.Diets         = Listing.Diets;
            newListing.PaidHolidays  = Listing.PaidHolidays;
            newListing.Bonuses       = Listing.Bonuses;
            newListing.Dollars       = Listing.Dollars;
            newListing.Prepayment    = Listing.Prepayment;
            newListing.Sickness      = Listing.Sickness;

            TimeSetting ts = null;

            if (ChangeItemsTimes == true)
            {
                ts = WorkedTimeSettingViewModel.TimeSetting;
            }

            foreach (KeyValuePair <int, ListingItem> item in Listing.Items)
            {
                newListing.AddItem(item.Value.Day, item.Value.Locality, ts ?? item.Value.TimeSetting);
            }

            _listingFacade.StoreListing(newListing);

            EventAggregator.PublishOnUIThread(new ListingSuccessfullyCopiedMessage(newListing));
        }
Exemple #2
0
        private void SaveListing()
        {
            Name = string.IsNullOrEmpty(Name) ? null : Name.Trim();

            Listing newListing = _listingFactory.Create(SelectedYear, SelectedMonth);

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

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

            _listingFacade.StoreListing(newListing);

            SetDefaults();

            EventAggregator.PublishOnUIThread(new ListingSuccessfulySavedMessage(newListing));
        }