Beispiel #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));
        }