예제 #1
0
        /// <summary>
        /// Affichage de documents 
        /// </summary>
        public void ApplySearch()
        {
            TreeViewBuilder treeViewBuilder = new TreeViewBuilder(viewGui.TreeViewDoc);

            //Requête
            XmlElement eField;
            XmlDocumentFacade xmlDoc = new XmlDocumentFacade("<Requests/>");
            XmlElement eRequest = xmlDoc.AddNode(null, "Request", "");
               			xmlDoc.AddAttributeNode(eRequest, "operation", "Select");
               			xmlDoc.AddAttributeNode(eRequest, "object", "Document");

             			XmlElement eFields = xmlDoc.AddNode(eRequest, "Fields", "");

             			eField = xmlDoc.AddNode(eFields, "Field", "");
             			xmlDoc.AddAttributeNode(eField, "name", "caption");

            Console.WriteLine(xmlDoc.ToString());

            IList dossiers = viewGui.Controller.RequestModel(xmlDoc.ToString());
            treeViewBuilder.Fill(dossiers);
        }
예제 #2
0
        ///<summary>
        ///Sauvegarde du document de la vue
        ///</summary>
        public void SaveCurrentView()
        {
            //Récupération du controleur de la vue active
            string key = viewGui.NotebookViews.CurrentPage.ToString();
            IController controller = (IController) viewGui.Controller.RegisteredControllers[key];

            if (controller == null)
                throw new ArgumentNullException(string.Format("Pas de controleur associé à la clé {0}", key));

            string idDoc = controller.View.DocumentID;

            //Si l'identifiant de document est nul alors c'est un nouveau document, donc un nouveau dossier
            //dans le cas d'un document maitre
            if (idDoc.Length == 0) {
            }

            //Créer un nouveau dossier
            XmlElement eField;
            XmlDocumentFacade xmlDoc = new XmlDocumentFacade("<Requests/>");
            XmlElement eRequest = xmlDoc.AddNode(null, "Request", "");
               			xmlDoc.AddAttributeNode(eRequest, "operation", "Insert");
               			xmlDoc.AddAttributeNode(eRequest, "object", "MasterDocument");

             			XmlElement eFields = xmlDoc.AddNode(eRequest, "Fields", "");

             			eField = xmlDoc.AddNode(eFields, "Field", DateTime.Now.ToString());
             			xmlDoc.AddAttributeNode(eField, "name", "creation");

             	 		eField = xmlDoc.AddNode(eFields, "Field", controller.View.MasterCaption);
             			xmlDoc.AddAttributeNode(eField, "name", "masterCaption");

             			eField = xmlDoc.AddNode(eFields, "Field", controller.View.Caption);
             			xmlDoc.AddAttributeNode(eField, "name", "caption");

             			string docContent = controller.View.SaveToXML();
             			Console.WriteLine("Contenu du document à sauvegarder : " + docContent);
             			eField = xmlDoc.AddNode(eFields, "Field", docContent);
             			xmlDoc.AddAttributeNode(eField, "name", "content");

            Console.WriteLine(xmlDoc.ToString());

               			 viewGui.Controller.RequestModel(xmlDoc.ToString());
        }