Esempio n. 1
0
        public void BtnRemoveVismaEntry()
        {
            // To remove the vismaEntry it first needs to remove itself from the timesheetEntry (that gets added to the databse).
            TimesheetEntry.Tsentry.vismaEntries.Remove(Entry);

            // Then update the sums by calling the sum method.
            TimesheetConfirmationViewModel.SumVismaEntries();

            // And finally calling the remove method from the timesheetViewModel to remove itself from the page.
            TimesheetEntry.RemoveEntry(this);
        }
Esempio n. 2
0
        public TimesheetEntryConfirmationViewModel(TimesheetEntry entry, TimesheetConfirmationViewModel TsConfirmationViewModel)
        {
            this.TsConfirmationViewModel = TsConfirmationViewModel;
            TypeText      = "Type: " + entry.SelectedTypeComboBoxItem;
            ProjectIdText = "Projekt-ID: " + entry.ProjectID;

            // To prevent the start and end times to contain seconds we restrict the substring to 5 symbols (2 for hours, 1 for the dot, and 2 for the minutes)
            StartTimeText = "Start: " + entry.StartTime.TimeOfDay.ToString().Substring(0, 5);
            EndTimeText   = "S**t: " + entry.EndTime.TimeOfDay.ToString().Substring(0, 5);
            DrivingText   = "Arbejdsplads: " + entry.SelectedRouteComboBoxItem;
            Tsentry       = entry;

            foreach (VismaEntry visma in entry.vismaEntries)
            {
                VismaEntries.Add(new VismaEntryViewModel(visma, this, TsConfirmationViewModel));
            }
        }
Esempio n. 3
0
        public VismaEntryViewModel(VismaEntry entry, TimesheetEntryConfirmationViewModel timesheetEntry, TimesheetConfirmationViewModel TsConfirmationViewModel)
        {
            TimesheetConfirmationViewModel = TsConfirmationViewModel;
            Entry          = entry;
            TimesheetEntry = timesheetEntry;

            // Saves all the rates' names to a list and then adds them as items in the combobox.
            rateNames = TimesheetEntry.Tsentry.timesheet.rates.Select(rate => rate.Name).ToList();
            foreach (string name in rateNames)
            {
                RateNamesCombobox.Add(new ComboBoxItem()
                {
                    Content = name
                });
            }
            // Then it finds the rate which was added to then select the correct rate to show.
            string raten = TimesheetEntry.Tsentry.timesheet.rates
                           .Where(rate => rate.Id == Entry.RateID)
                           .Select(rate => rate.Name).FirstOrDefault();

            SelectedRate = RateNamesCombobox.Where(name => (string)name.Content == raten).FirstOrDefault();
        }