コード例 #1
0
 public DeleteOrganisationViewModel(organisation organisation)
 {
     this.cmdDelete = new RelayCommand<Object>(actDelete);
     this.organisation = organisation;
     this.nbrContact = organisation.contacts.Count();
     this.nbrProgram = organisation.programs.Count();
 }
コード例 #2
0
        public void actAddTab(organisation organisation, UserControl view)
        {
            Tab tab = new Tab(organisation.name, view , organisation, null);

            organisationTabs.Add(tab);
            this.selectedTab = tab;
        }
コード例 #3
0
        public AddProgramViewModel(organisation organisation)
        {
            this.organisation = organisation;

            this.types = db.program_types.ToList();
            this.begin_date = DateTime.Now;
            this.end_date = DateTime.Now;

            this.cmdAdd = new RelayCommand<Object>(actAdd);
        }
コード例 #4
0
        public ShowOrganisationViewModel(organisation organisation)
        {
            this.organisation = organisation;
            this.cmdEdit = new RelayCommand<organisation>(actEdit);
            this.cmdDelete = new RelayCommand<organisation>(actDelete);
            this.cmdAddProgram = new RelayCommand<organisation>(actAddProgram);
            this.cmdShowProgram = new RelayCommand<program>(actShowProgram);

            db.SaveChanges();
            this.programs = new ObservableCollection<program>(organisation.programs.ToList());

            mediator.Register(Helper.Event.ADD_PROGRAM, this);
            mediator.Register(Helper.Event.DELETE_PROGRAM, this);
        }
コード例 #5
0
        public EditOrganisationViewModel(organisation organisation)
        {
            this.currentOrganisation = organisation;
            this.name = organisation.name;
            this.street = organisation.street;
            this.city = organisation.city;
            this.zip = organisation.zip;
            this.country = organisation.country;

            if (organisation.phone != null)
                this.phone = organisation.phone.number;
            else
                this.phone = "";

            if(organisation.email != null)
                this.email = organisation.email.email1;
            else
                this.email = "";

            this.cmdEdit = new RelayCommand<object>(actEdit);
        }
コード例 #6
0
        public void actAdd(object obj)
        {
            bool error = false;
            this.validName = new Validation();

            organisation organisation = new organisation();

            // Validation nom de l'organisation
            if (!this.name.Equals(""))
            {
                organisation.name = this.name;
                this.validName.message = "Valide";
                this.validName.valid = true;
                NotifyPropertyChanged("validName");
            }
            else
            {
                this.validName.message = "Champ requis";
                this.validName.valid = false;
                NotifyPropertyChanged("validName");
                error = true;
            }

            if (!this.street.Equals(""))
                organisation.street = this.street;

            if (!this.city.Equals(""))
                organisation.city = this.city;

            if (!this.zip.Equals(""))
                organisation.zip = this.zip;

            if (!this.country.Equals(""))
                organisation.country = this.country;

            if (!this.phone.Equals(""))
            {
                phone phone = new phone();
                phone.number = this.phone;
                phone.description = "main";
                phone.main = true;

                organisation.phone = phone;
            }

            if (!this.email.Equals(""))
            {
                email email = new email();
                email.email1 = this.email;
                email.main = true;

                organisation.email = email;
            }

            if (!error)
            {
                // Enregistre dans la base
                db.organisations.Add(organisation);
                db.SaveChanges();

                mediator.NotifyViewModel(Helper.Event.ADD_ORGANISATION, organisation);

                this.CloseActionFormAdd();
            }
        }
コード例 #7
0
 public void actViewDetail(organisation organisation)
 {
     mediator.openShowOrganisationView(organisation);
 }
コード例 #8
0
        public void openShowOrganisationView(organisation organisation)
        {
            ShowOrganisationUCView showOrganisationView = new ShowOrganisationUCView();
            showOrganisationView.DataContext = new ShowOrganisationViewModel(organisation);

            ((OrganisationViewModel)mainTabs["organisation"].tabViewModel).actAddTab(organisation, showOrganisationView);
        }
コード例 #9
0
        public void openEditOrganisationView(organisation organisation)
        {
            EditOrganisationViewModel editOrganisationViewModel = new EditOrganisationViewModel(organisation);
            EditOrganisationView editOrganisationView = new EditOrganisationView();

            editOrganisationView.DataContext = editOrganisationViewModel;
            editOrganisationViewModel.CloseActionFormEdit = new Action(() => editOrganisationView.Close());

            editOrganisationView.Show();
        }
コード例 #10
0
        public void openDeleteOrganisationView(organisation organisation)
        {
            DeleteOrganisationViewModel deleteOrganisationViewModel = new DeleteOrganisationViewModel(organisation);
            DeleteOrganisationView deleteOrganisationView = new DeleteOrganisationView();

            deleteOrganisationView.DataContext = deleteOrganisationViewModel;
            deleteOrganisationViewModel.CloseActionDelete = new Action(() => deleteOrganisationView.Close());

            deleteOrganisationView.ShowDialog();
        }
コード例 #11
0
        public void openAddProgramView(organisation organisation)
        {
            AddProgramViewModel addProgramViewModel = new AddProgramViewModel(organisation);
            AddProgramView addProgramView = new AddProgramView();

            addProgramView.DataContext = addProgramViewModel;
            addProgramViewModel.CloseActionAdd = new Action(() => addProgramView.Close());

            addProgramView.Show();
        }
コード例 #12
0
 private void actEdit(organisation organisation)
 {
     mediator.openEditOrganisationView(this.organisation);
 }