Ejemplo n.º 1
0
        /// <summary>
        /// Enregistrement de ma ToDolist
        /// </summary>
        /// <param name="toDoList"> ma ToDoList</param>
        /// <returns>VOToDoList</returns>
        public VOProjet EnregistrerNouvelleToDoList(VOProjet toDoList)
        {
            string nomProjet = toDoList.NomDuProjet;

            // Ouverture du dossier
            var section = ConfigurationManager.GetSection("gestionTaches") as NameValueCollection;
            string repertoire = section["repertoireStockage"].ToString();

            if (!Directory.Exists(repertoire))
            {
                return null;
            }

            // Obtention du chemin complet
            string cheminComplet = Path.Combine(repertoire, nomProjet + Constants.ExtensionFichierXml);

            return BllFactory.GetBllGestionTaches().ModifierFichierTachesXml(cheminComplet, toDoList);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Création d'une nouvelle gestion de projet
        /// </summary>
        /// <param name="nomProjet">Nom du projet</param>
        /// <param name="cheminFichier">Chemin du fichier</param>
        /// <returns>VOToDoList</returns>
        public VOProjet CreerFichierTachesXml(string nomProjet, string cheminFichier)
        {
            VOProjet nouvelleTodolist = new VOProjet(nomProjet, cheminFichier);

            /*System.IO.FileStream fichier = System.IO.File.Create(cheminFichier);

            // Création d'un objet permettant la sérialisation d'un objet de type VOToDoList
            XmlSerializer serialiser = new XmlSerializer(typeof(VOProjet));

            // Sérialisation du fichier
            serialiser.Serialize(fichier, nouvelleTodolist);
            fichier.Close();*/

            using (FileStream fichier = System.IO.File.Create(cheminFichier))
            {
                // Création d'un objet permettant la sérialisation d'un objet de type VOToDoList
                XmlSerializer serialiser = new XmlSerializer(typeof(VOProjet));

                // Sérialisation du fichier
                serialiser.Serialize(fichier, nouvelleTodolist);
            }
            return nouvelleTodolist;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Fonction qui permet d'ouvri une popup
        /// </summary>
        private void OuvrirProjet()
        {
            var visualizerService = Resolve<IUIVisualizerService>();

            object popup;

            // Ouverture de la popup d'ouverture de projet
            var res = visualizerService.ShowDialog(typeof(PopupOuvrirTodolistView), new PopupOuvrirTodolistViewModel(), out popup);

            // Cast pour manipuler l'objet PopupOuvrirTodolistViewModel
            PopupOuvrirTodolistViewModel popupCast = (PopupOuvrirTodolistViewModel)popup;
            // res = popupCast.OuvertureActivee;

            // Gestion de l'exception dans le cas où le repertoire n'existe pas
            if (popupCast.ListeCouranteTodolist == null)
            {
                throw new TodolistPluginException("Pas de fichier");
            }

            if (res == true)
            {
                ListeCategoriesMenuVM = new ObservableCollection<CategoriesMenuViewModel>();
                this.Personnes = new ObservableCollection<VOPersonne>();
                this.Personnes.CollectionChanged += new NotifyCollectionChangedEventHandler(Personnes_CollectionChanged);

                ProjetOuvert = popupCast.ProjetAOuvrir;
                var methodeOuvrirNouveauProjet = ServiceProvider.Resolve<IOuvrirProjet>();
                methodeOuvrirNouveauProjet.InterfaceOuvrirProjet(ProjetOuvert.ListeDesTaches);
                OnProjetOuvertChanged();
                OnPersonneChanged();
                OnCategorieChanged();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Fonction qui enregistre les modifications sur le projet
        /// </summary>
        private void EnregistrerModif()
        {
            string enregistrer = MessageBox.Show("Voulez-vous enregistrer les modifications", "Enregistrer", MessageBoxButton.YesNo).ToString();

            if (enregistrer == "Yes")
            {
                var background = new BackgroundWorker();
                background.DoWork += (DoWorkEventHandler)((sender, e) =>
                    {
                        var erreur = WcfHelper.Execute<IServiceGestionTaches>(
                            client =>
                            {
                                OnProjetEnregistrerChanged();
                                ProjetOuvert = client.EnregistrerToDoList(ProjetOuvert);
                            });

                            if (erreur != null)
                            {
                                throw new OgpPluginException("", erreur);
                            }
                    });

                //background.RunWorkerCompleted += background_RunWorkerCompleted;
                background.RunWorkerAsync();

            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Permet d'ouvrir une nouvelle gestion de projet
        /// </summary>
        private void CreerTodolist()
        {
            var visualizerService = Resolve<IUIVisualizerService>();
            object popupCreation;

            var ouverturePopupCreation = visualizerService.ShowDialog(typeof(NouvelleGestionTache), new NouvelleGestionTacheViewModel(), out popupCreation);

            if (ouverturePopupCreation == true)
            {
                var exception = WcfHelper.Execute<IServiceGestionTaches>(client =>
                {
                    ListeCategoriesMenuVM = new ObservableCollection<CategoriesMenuViewModel>();
                    this.Personnes = new ObservableCollection<VOPersonne>();
                    this.Personnes.CollectionChanged += new NotifyCollectionChangedEventHandler(Personnes_CollectionChanged);
                    // this.CategoriesProjet = new ObservableCollection<VOCategorie>();
                    // this.CategoriesProjet.CollectionChanged += new NotifyCollectionChangedEventHandler(Categories_CollectionChanged);
                    ProjetOuvert = client.NouvelleToDoList(((NouvelleGestionTacheViewModel)popupCreation).NomDuProjet);
                    projetOuvert.ListeDesTaches = new ObservableCollection<VOTache>();
                    projetOuvert.Categories = new ObservableCollection<VOCategorie>();
                    OnProjetOuvertChanged();

                    var methodeOuvrirNouveauProjet = ServiceProvider.Resolve<IOuvrirProjet>();
                    methodeOuvrirNouveauProjet.InterfaceOuvrirProjet(ProjetOuvert.ListeDesTaches);
                });
                if (ProjetOuvert == null)
                {
                    throw new TodolistPluginException("Pas de fichier");

                }

                // TODO gérer exception
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Permet d'ouvrir et de sérialiser les modifications
 /// </summary>
 /// <param name="cheminFichier">Chemin du projet</param>
 /// <param name="toDoList">Nom de ma ToDoList</param>
 /// <returns>VOToDoList</returns>
 public VOProjet ModifierFichierTachesXml(string cheminFichier, VOProjet toDoList)
 {
     /*System.IO.FileStream fichier = System.IO.File.Open(cheminFichier, FileMode.Open);
     XmlSerializer serialiser = new XmlSerializer(typeof(VOProjet));
      serialiser.Serialize(fichier, toDoList);
     fichier.Close();*/
     using (FileStream fichier = System.IO.File.Open(cheminFichier, FileMode.Create))
     {
         XmlSerializer serialiser = new XmlSerializer(typeof(VOProjet));
         serialiser.Serialize(fichier, toDoList);
     }
     return toDoList;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Fonction qui enregistre les modifications sur le projet
        /// </summary>
        private void EnregistrerModif()
        {
            string enregistrer = MessageBox.Show("Voulez-vous enregistrer les modifications", "Enregistrer", MessageBoxButton.YesNo).ToString();

            if (enregistrer == "Yes")
            {
                var erreur = WcfHelper.Execute<IServiceGestionTaches>(
                    client =>
                    {
                        OnProjetEnregistrerChanged();
                        ProjetOuvert = client.EnregistrerToDoList(ProjetOuvert);
                    });

                if (erreur != null)
                {
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Méthode qui enregistre les modifications du projet
        /// </summary>
        /// <param name="toDoList">Nom de ma ToDoList</param>
        /// <returns>VOToDoList</returns>
        public VOProjet EnregistrerToDoList(VOProjet toDoList)
        {
            IAllGestionTaches allGestionTaches = AllFactory.GetAllGestionTaches();

            return allGestionTaches.EnregistrerNouvelleToDoList(toDoList);
        }
Ejemplo n.º 9
0
        private void CreerTodolist()
        {
            var methodeOuvrirNouvelOnglet = ServiceProvider.Resolve<ICentralOnglets>();

            var visualizerService = Resolve<IUIVisualizerService>();
            object popupCreation;

            var ouverturePopupCreation = visualizerService.ShowDialog(typeof(NouvelleGestionTache), new NouvelleGestionTacheViewModel(), out popupCreation);

            if (ouverturePopupCreation == true)
            {
                var todoListViewModel = new TodolistViewModel();
                Plugin.Todolist.Todolist Todol = new Plugin.Todolist.Todolist { DataContext = todoListViewModel };

                Todol.Title = ((NouvelleGestionTacheViewModel)popupCreation).NomDuProjet;
                methodeOuvrirNouvelOnglet.AjoutOnglet(Todol);

                var exception = WcfHelper.Execute<IServiceGestionTaches>(client =>
                {
                    ProjetOuvert = client.NouvelleToDoList(Todol.Title);
                    ProjetOuvert.ListeDesTaches = new ObservableCollection<VOTache>();
                    ProjetOuvert.Categories = new ObservableCollection<VOCategorie>();
                    todoListViewModel.AfficherTacheOuverture(ProjetOuvert.ListeDesTaches);
                });
                if (ProjetOuvert == null)
                {
                    throw new TodolistPluginException("Pas de fichier");
                }
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Méthode permettant d'ajouter une tache
 /// </summary>
 /// <param name="nouvelleToDoList">Projet auquel on ajoute une tâche</param>
 /// <param name="nouvelleTache">tâche à ajouter</param>
 public void AjouterTache(VOProjet nouvelleToDoList, VOTache nouvelleTache)
 {
     // nouvelleToDoList.ListeDesTaches.Add(nouvelleTache);
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Foncion qui permet d'ajouter des personnes à une tâche
        /// </summary>
        /// <param name="projet"> Liste de VOProjet</param>
        private void AjouterPersonneProjet(VOProjet projet)
        {
            foreach (var per in listeTachesViewModel)
            {
                per.PersonneProjet.Clear();
                ObservableCollection<string> test = new ObservableCollection<string>();
                foreach (var liste in projet.ListeDesTaches)
                {
                    if (per.Titre == liste.Titre)
                    {
                        test = liste.ListePersonnesXml;
                        if (test.Count != 0)
                        {
                            per.ListePersonnesXml = liste.ListePersonnesXml;
                            foreach (var personnes in projet.Personnes)
                            {
                                bool affecte = false;

                                foreach (var t in test)
                                {
                                    if (personnes.Nom == t)
                                    {
                                        affecte = true;
                                    }
                                }
                                if (affecte)
                                {
                                    PersonneViewModel p2 = new PersonneViewModel();
                                    p2.Nom = personnes.Nom;
                                    p2.Affecte = true;
                                    per.PersonneAjout(p2);
                                }
                                else
                                {
                                    PersonneViewModel p2 = new PersonneViewModel();
                                    p2.Nom = personnes.Nom;
                                    p2.Affecte = false;
                                    per.PersonneAjout(p2);
                                }
                            }
                        }
                        else
                        {
                            foreach (var personnes in projet.Personnes)
                            {
                                PersonneViewModel p2 = new PersonneViewModel();
                                p2.Nom = personnes.Nom;
                                p2.Affecte = false;
                                per.PersonneAjout(p2);
                            }
                        }
                    }
                }
            }
        }