예제 #1
0
        public PersonViewModel(IDialogService dialogService, MainWindowViewModel mainWindowViewModel, Person person)
        {
            this.mainWindowViewModel = mainWindowViewModel;
            this.mainWindowViewModel.PropertyChanged += MainWindowViewModel_PropertyChanged;
            this.dialogService = dialogService;
            this.Person = person;
            mainWindowViewModel.ViewTitle = "Πελατες";
            GoBack = new RelayCommand(goBack, null);
            Save = new RelayCommand(save, null);
            NewJob = new RelayCommand(newJob, null);
            EditJob = new RelayCommand(editJob, o=>o!=null);
            DeleteJob = new RelayCommand(deleteJob, o => o != null);
            NewToDo = new RelayCommand(newToDo, null);
            EditToDo = new RelayCommand(editToDo, o => o != null);
            DeleteToDo = new RelayCommand(deleteToDo, o => o != null);

            this.db = new CmsContext();

            if (this.Person == null)
            {
                this.Person = new Person();
                Person.Id = Guid.NewGuid().ToString();
                db.People.Add(Person);
            }
            else
            {
                Person = db.People.Find(person.Id);
            }
        }
예제 #2
0
파일: JobsViewModel.cs 프로젝트: akkgr/cms
 public JobsViewModel(IDialogService dialogService, MainWindowViewModel mainWindowViewModel)
 {
     this.dialogService = dialogService;
     this.mainWindowViewModel = mainWindowViewModel;
     mainWindowViewModel.ViewTitle = "Εργασιες";
     db = new CmsContext();
     StartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
     EndDate = StartDate.AddMonths(1);            
     FindItem = new RelayCommand(findItem, null);
     NewItem = new RelayCommand(newItem, null);
     EditItem = new RelayCommand(editItem, o => o != null);
     DeleteItem = new RelayCommand(deleteItem, o => o != null);
     getData();
 }
예제 #3
0
파일: ToDoViewModel.cs 프로젝트: akkgr/cms
        public ToDoViewModel(IDialogService dialogService, MainWindowViewModel mainWindowViewModel, ToDo toDo)
        {
            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.ToDo = toDo;

            if (this.ToDo == null)
            {
                this.ToDo = new ToDo();
                this.ToDo.Id = Guid.NewGuid().ToString();
                this.ToDo.ToDoDate = DateTime.Now.Date;
                this.ToDo.Done = false;
                db.ToDoes.Add(this.ToDo);
            }
            else
            {
                this.ToDo = db.ToDoes.Find(toDo.Id);
            }
        }
예제 #4
0
파일: JobViewModel.cs 프로젝트: akkgr/cms
        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);
            }
        }