Beispiel #1
0
        public JobViewModel(IDialogService dialogService, MainWindowViewModel mainWindowViewModel, Job job)
        {
            this.dialogService = dialogService;
            this.mainWindowViewModel = mainWindowViewModel;
            mainWindowViewModel.ViewTitle = "Εργασιες";
            this.db = new CmsContext();
            this.People = new ObservableCollection<Person>(db.People.ToList().OrderByDescending(t => t.FullName));
            Save = new RelayCommand(save, null);
            GoBack = new RelayCommand(goBack, null);
            this.Job = job;

            if(this.Job == null)
            {
                this.Job = new Job();
                this.Job.Id = Guid.NewGuid().ToString();
                this.Job.Implemented = DateTime.Now.Date;
                this.Job.Amount = 0;
                db.Jobs.Add(this.Job);
            }
            else
            {
                this.Job = db.Jobs.Find(job.Id);
            }
        }
Beispiel #2
0
        private void newJob(object obj)
        {
            var job = new Job();
            job.Id = Guid.NewGuid().ToString();
            job.PersonId = Person.Id;
            job.Implemented = DateTime.Now.Date;
            job.Amount = 0;

            Person.Jobs.Add(job);

            SelectedJob = job;

            mainWindowViewModel.SettingsViewModel = new JobFlyOutViewModel(SelectedJob);
            mainWindowViewModel.IsSettingsFlyoutOpen = true;
        }