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)); }
private void GeneratePdfs() { string filePath = _filePathDialogService.GetFilePath <SaveFileDialog>( string.Format("Výčetky {0}", SelectedYear), d => { d.Filter = "PDF dokument (*.pdf)|*.pdf"; } ); if (string.IsNullOrEmpty(filePath)) { return; } IOverlayToken ot = Overlay.DisplayOverlay(PrepareViewModel <ProgressViewModel>(), true); Task.Run(() => { List <Listing> list = new List <Listing>(); for (int month = 0; month < 12; month++) { list.Add(_listingFactory.Create(SelectedYear, month + 1)); } Document doc = _multipleListingReportFactory.Create(list, new DefaultListingPdfReportSetting()); _listingReportGenerator.Save(filePath, doc); ot.HideOverlay(); EventAggregator.PublishOnUIThread(new ListingPdfSuccessfullyGeneratedMessage()); }); }
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)); }