//TODO CHANGE CA ON doit pas avoir 2 methode actAddTab qui font la même chose
        public void actAddTab(program program, UserControl view)
        {
            Tab tab = new Tab(program.organisation.name + " - " + program.program_types.name , view, program, null);

            organisationTabs.Add(tab);
            this.selectedTab = tab;
        }
 public DeleteProgramViewModel(program program)
 {
     this.program = program;
     this.nbrContact = program.contacts.Count();
     this.nbrCampus = program.campus.Count();
     this.cmdDelete = new RelayCommand<Object>(actDelete);
 }
        public EditProgramViewModel(program program)
        {
            this.program = program;
            this.types = db.program_types.ToList();
            //this.typeIndex
            this.begin_date = program.begin_date;
            this.end_date = program.end_date;

            this.cmdEdit = new RelayCommand<Object>(actEdit);
        }
        private void actAdd(object obj)
        {
            program program = new program();

            program.begin_date = begin_date;
            program.end_date = end_date;
            program.program_types = types.ElementAt(typeIndex);

            organisation.programs.Add(program);
            db.SaveChanges();

            mediator.NotifyViewModel(Helper.Event.ADD_PROGRAM, program);

            this.CloseActionAdd();
        }
        public ShowProgramViewModel(program program)
        {
            this.program = program;
            this.description = program.description;

            this.campuses = new ObservableCollection<campu>(program.campus.ToList());
            this.cmdEdit = new RelayCommand<Object>(actEdit);
            this.cmdDelete = new RelayCommand<Object>(actDelete);

            this.cmdEditDescription = new RelayCommand<Object>(actEditDescription);
            this.editDescription = false;

            this.cmdAddCampus = new RelayCommand<Object>(actAddCampus);
            this.cmdEditCampus = new RelayCommand<campu>(actEditCampus);
            this.cmdDeleteCampus = new RelayCommand<campu>(actDeleteCampus);

            mediator.Register(Helper.Event.ADD_CAMPUS, this);
        }
        public void openShowProgramView(program program)
        {
            ShowProgramUCView showProgramView = new ShowProgramUCView();
            showProgramView.DataContext = new ShowProgramViewModel(program);

            ((OrganisationViewModel)mainTabs["organisation"].tabViewModel).actAddTab(program, showProgramView);
        }
        public void openEditProgramView(program program)
        {
            EditProgramViewModel editProgramViewModel = new EditProgramViewModel(program);
            EditProgramView editProgramView = new EditProgramView();

            editProgramView.DataContext = editProgramViewModel;
            editProgramViewModel.CloseActionEdit = new Action(() => editProgramView.Close());

            editProgramView.Show();
        }
        public void openDeleteProgramView(program program)
        {
            DeleteProgramViewModel deleteProgramViewModel = new DeleteProgramViewModel(program);
            DeleteProgramView deleteProgramView = new DeleteProgramView();

            deleteProgramView.DataContext = deleteProgramViewModel;
            deleteProgramViewModel.CloseActionDelete = new Action(() => deleteProgramView.Close());

            deleteProgramView.ShowDialog();
        }
        public void openAddCampusView(program program)
        {
            AddCampusViewModel addCampusViewModel = new AddCampusViewModel(program);
            AddCampusView addCampusView = new AddCampusView();

            addCampusView.DataContext = addCampusViewModel;
            addCampusViewModel.CloseActionAdd = new Action(() => addCampusView.Close());

            addCampusView.Show();
        }
 public AddCampusViewModel(program  program)
 {
     this.program = program;
     this.cmdAdd = new RelayCommand<Object>(actAdd);
 }
 private void actShowProgram(program program)
 {
     mediator.openShowProgramView(program);
 }