Exemple #1
0
        public static void Fill_Motif_Surfacique_Grid(C1FlexGrid grid, XmlDocument Doc)
        {
            XmlNodeList nodeList;

            grid.Rows.Count = 1;
            grid.Tag        = Doc;

            root = Doc.DocumentElement;

            grid.Tag = root.SelectSingleNode("surfaciques");

            nodeList = root.SelectNodes("surfaciques/motif");

            foreach (XmlNode unNode in nodeList)
            {
                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["nom"] = unNode.Attributes["nom"].InnerText;
                if (unNode.Attributes.GetNamedItem("hachure") != null)
                {
                    ligne["hachure"] = unNode.Attributes["hachure"].InnerText;
                }
                if (unNode.Attributes.GetNamedItem("angle") != null)
                {
                    ligne["angle"] = unNode.Attributes["angle"].InnerText;
                }
                if (unNode.Attributes.GetNamedItem("echelle") != null)
                {
                    ligne["echelle"] = unNode.Attributes["echelle"].InnerText;
                }
            }
        }
Exemple #2
0
        /*
         *
         * Remplir le grid Code lié */
        public static void Fill_Obs_Codelie_Grid(C1FlexGrid grid)
        {
            XmlNodeList nodeList;
            XmlNode     positionNode;

            grid.Rows.Count = 1;

            nodeList = Selected_Obs_Code.SelectNodes(string.Concat("lien/codelie"));

            if (nodeList.Count > 0)
            {
                foreach (XmlNode unNode in nodeList)
                {
                    positionNode = unNode.Attributes["position"];

                    C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                    ligne["position"] = positionNode.InnerText;
                    ligne["codelie"]  = unNode.InnerText;
                }
            }
            else
            {
                return;
            }
        }
Exemple #3
0
        /*
         *
         * Ajouter un emplacement horaire dans le fichier XML */
        public static void Add_Section_Horaire(object sender, EventArgs e)
        {
            Button     bt        = (Button)sender;
            TextBox    tb        = (TextBox)bt.Tag;
            C1FlexGrid grid      = (C1FlexGrid)tb.Tag;
            XmlNode    originnod = Selected_Section;

            XmlDocument doc = (XmlDocument)mod_global.MF.XmlSectionGrid.Tag;

            if (tb.Text != String.Empty)
            {
                if (mod_global.Check_If_Section_Horaire_Exist(tb.Text, originnod) == true)
                {
                    System.Windows.Forms.MessageBox.Show("Cet horaire existe déjà.");
                    return;
                }

                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["id"] = tb.Text;

                XmlElement heureNode = doc.CreateElement("heure");
                heureNode.SetAttribute("id", tb.Text);

                originnod.AppendChild(heureNode);
                doc.Save(mod_global.MF.XmlSectionStripLabel.Text);

                tb.Text = String.Empty;
            }
            else
            {
                MessageBox.Show("Veuillez saisir un emplacement horaire à ajouter", "Erreur", MessageBoxButtons.OK);
            }
        }
Exemple #4
0
        public static void Fill_Heure_Grid(C1FlexGrid grid)
        {
            XmlNodeList nodeList;

            grid.Rows.Count = 1;

            nodeList = Selected_Section.SelectNodes(string.Concat("heure"));


            if (nodeList.Count > 0)
            {
                foreach (XmlNode unNode in nodeList)
                {
                    C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();

                    if (unNode.Attributes.GetNamedItem("id") != null)
                    {
                        ligne["id"] = unNode.Attributes["id"].InnerText;
                    }
                    if (unNode.InnerText != null)
                    {
                        ligne["correspondance"] = unNode.InnerText;
                    }
                    if (unNode.Attributes.GetNamedItem("type") != null)
                    {
                        ligne["type"] = unNode.Attributes["type"].InnerText;
                    }
                }
            }
        }
Exemple #5
0
        public static void Add_Motif(object sender, EventArgs e)
        {
            Button     bt        = (Button)sender;
            TextBox    tb        = (TextBox)bt.Tag;
            C1FlexGrid grid      = (C1FlexGrid)tb.Tag;
            XmlNode    originnod = (XmlNode)grid.Tag;

            if (tb.Text != String.Empty)
            {
                if (mod_global.Check_If_Motif_Name_Exist(tb.Text) == true)
                {
                    System.Windows.Forms.MessageBox.Show("Ce nom de motif existe déjà.");
                    return;
                }

                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["nom"] = tb.Text;

                XmlElement motifNode = mod_accueil.Motif_Xml.CreateElement("motif");
                motifNode.SetAttribute("nom", tb.Text);

                originnod.AppendChild(motifNode);
                mod_accueil.Motif_Xml.Save(mod_global.MF.XmlMotifStripLabel.Text);

                tb.Text = String.Empty;
            }
            else
            {
                MessageBox.Show("Veuillez saisir un nom de motif à ajouter", "Erreur", MessageBoxButtons.OK);
            }
        }
Exemple #6
0
        /*
         *
         * Remplir le grid Items */
        public static void Fill_Obs_Item_Grid(C1FlexGrid grid)
        {
            XmlNodeList nodeList;

            grid.Rows.Count = 1;

            nodeList = Selected_Obs_Carac.SelectNodes(string.Concat("item"));

            if (nodeList.Count > 0)
            {
                foreach (XmlNode unNode in nodeList)
                {
                    C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                    if (unNode.Attributes.GetNamedItem("nom") != null)
                    {
                        ligne["nom"] = unNode.Attributes["nom"].InnerText;
                    }
                    if (unNode.Attributes.GetNamedItem("position") != null)
                    {
                        ligne["position"] = unNode.Attributes["position"].InnerText;
                    }
                    if (unNode.InnerText != null)
                    {
                        ligne["info"] = unNode.InnerText;
                    }
                    if (unNode.Attributes.GetNamedItem("q1") != null)
                    {
                        ligne["q1"] = unNode.Attributes["q1"].InnerText;
                    }
                    if (unNode.Attributes.GetNamedItem("q2") != null)
                    {
                        ligne["q2"] = unNode.Attributes["q2"].InnerText;
                    }
                    if (unNode.Attributes.GetNamedItem("h1") != null)
                    {
                        ligne["h1"] = unNode.Attributes["h1"].InnerText;
                    }
                    if (unNode.Attributes.GetNamedItem("h2") != null)
                    {
                        ligne["h2"] = unNode.Attributes["h2"].InnerText;
                    }
                    if (unNode.Attributes.GetNamedItem("pm1") != null)
                    {
                        ligne["pm1"] = unNode.Attributes["pm1"].InnerText;
                    }
                    if (unNode.Attributes.GetNamedItem("pm2") != null)
                    {
                        ligne["pm2"] = unNode.Attributes["pm2"].InnerText;
                    }
                    if (unNode.Attributes.GetNamedItem("ajoute") != null)
                    {
                        ligne["ajoute"] = unNode.Attributes["ajoute"].InnerText;
                    }
                    if (unNode.Attributes.GetNamedItem("lien") != null)
                    {
                        ligne["lien"] = unNode.Attributes["lien"].InnerText;
                    }
                }
            }
        }
Exemple #7
0
        //----------------------------- Fonctions de remplissage des tableaux -------------------------------

        /*
         *
         * Remplir le grid Codes */
        public static void Fill_Obs_Codes_Grid(C1FlexGrid grid, XmlDocument Doc)
        {
            XmlNodeList nodeList;
            XmlNode     idNode;
            XmlNode     intituleNode;
            XmlNode     caracNode;

            grid.Rows.Count = 1;
            mod_global.MF.XmlObsCaracGrid.Rows.Count = 1;
            mod_global.MF.XmlObsItemGrid.Rows.Count  = 1;

            grid.Tag = Doc;
            //mod_global.MF.XmlObsCaracGrid.Tag = DocElem;
            //mod_global.MF.XmlObsItemGrid.Tag = DocElem;

            root = Doc.DocumentElement;

            nodeList = root.SelectNodes(string.Concat("code"));

            foreach (XmlNode unNode in nodeList)
            {
                idNode       = unNode.SelectSingleNode("id");
                intituleNode = unNode.SelectSingleNode("intitule");
                caracNode    = unNode.SelectSingleNode("caracteristiques");

                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["id"] = idNode.InnerText;

                if (unNode.SelectSingleNode("lien") != null)
                {
                    ligne["codelie"] = unNode.SelectSingleNode("lien").ChildNodes.Count;
                }

                if (unNode.Attributes.GetNamedItem("parent") != null)
                {
                    ligne["parent"] = unNode.Attributes["parent"].InnerText;
                }
                if (unNode.Attributes.GetNamedItem("position") != null)
                {
                    ligne["position"] = unNode.Attributes["position"].InnerText;
                }

                ligne["intitule"] = intituleNode.InnerText;

                if (unNode.Attributes.GetNamedItem("ajoute") != null)
                {
                    ligne["ajoute"] = unNode.Attributes["ajoute"].InnerText;
                }
                if (intituleNode.Attributes.GetNamedItem("intitule") != null)
                {
                    ligne["intitule"] = intituleNode.Attributes["intitule"].InnerText;
                }
                if (intituleNode.Attributes.GetNamedItem("info") != null)
                {
                    ligne["info"] = intituleNode.Attributes["info"].InnerText;
                }
            }
        }
Exemple #8
0
        //--------------------------------------------------------------------------------

        public static void Fill_Autocad_Grid(C1FlexGrid grid, XmlDocument Doc)
        {
            XmlNodeList nodeList;
            XmlNode     idNode;
            XmlNode     intituleNode;
            XmlNode     autocadNode;
            //XmlNode couleurNode;

            int R = 0;
            int G = 0;
            int B = 0;

            grid.Rows.Count = 1;

            grid.Tag = Doc;

            root = Doc.DocumentElement;

            nodeList = root.SelectNodes(string.Concat("code"));

            int i = 0;

            foreach (XmlNode unNode in nodeList)
            {
                R = 0;
                G = 0;
                B = 0;

                idNode       = unNode.SelectSingleNode("id");
                intituleNode = unNode.SelectSingleNode("intitule");
                autocadNode  = unNode.SelectSingleNode("autocad");
                //couleurNode = autocadNode.SelectSingleNode("couleur");

                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["id"]          = idNode.InnerText;
                ligne["intitule"]    = intituleNode.InnerText;
                ligne["representer"] = autocadNode.Attributes["representer"].InnerText;
                ligne["legende"]     = autocadNode.Attributes["legende"].InnerText;

                if (autocadNode.Attributes.GetNamedItem("couleur") != null)
                {
                    R = int.Parse(autocadNode.Attributes["couleur"].InnerText.Split(Char.Parse("|"))[0]);
                    G = int.Parse(autocadNode.Attributes["couleur"].InnerText.Split(Char.Parse("|"))[1]);
                    B = int.Parse(autocadNode.Attributes["couleur"].InnerText.Split(Char.Parse("|"))[2]);
                }

                grid.Styles.Add("color" + i);
                grid.Styles["color" + i].BackColor = Color.FromArgb(R, G, B);
                grid.SetCellStyle(ligne.Index, grid.Cols["couleur"].Index, "color" + i);
                i++;
            }
        }
Exemple #9
0
        //--------------------------------------------------------------------------------

        public static void Fill_Autocad_Item_Grid(C1FlexGrid grid)
        {
            XmlNodeList nodeList;

            grid.Rows.Count = 1;

            //root = Doc.DocumentElement;

            nodeList = Selected_Code.SelectNodes("caracteristiques/caracteristique[@nom='c1']/item");

            if (nodeList.Count > 0)
            {
                foreach (XmlNode unNode in nodeList)
                {
                    C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                    ligne["nom"]      = unNode.Attributes["nom"].InnerText;
                    ligne["intitule"] = unNode.InnerText;


                    //XmlNodeList ExistingMotif = Selected_Code.SelectNodes("autocad/" + type + "/" + type + "[@nom='" + unNode.Attributes["nom"].InnerText + "']");
                    XmlNodeList ExistingMotif = Selected_Code.SelectNodes("autocad/representations/*/representation[@nom='" + unNode.Attributes["nom"].InnerText + "']");

                    if (ExistingMotif.Count > 0)
                    {
                        ligne["type"] = ExistingMotif[0].ParentNode.Name;

                        if (ExistingMotif[0].Attributes.GetNamedItem("motif") != null)
                        {
                            ligne["motif"] = ExistingMotif[0].Attributes["motif"].InnerText;
                        }
                    }
                }
            }
            else
            {
                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["nom"]      = "c1";
                ligne["intitule"] = "Caractéristique 1";

                XmlNodeList ExistingMotif = Selected_Code.SelectNodes("autocad/representations/*/representation[@nom='c1']");

                if (ExistingMotif.Count > 0)
                {
                    ligne["type"] = ExistingMotif[0].ParentNode.Name;
                    if (ExistingMotif[0].Attributes.GetNamedItem("motif") != null)
                    {
                        ligne["motif"] = ExistingMotif[0].Attributes["motif"].InnerText;
                    }
                }
            }
        }
Exemple #10
0
        //--------------------------------------------------------------------------------------------------

        public static void Add_Id_Code(object sender, EventArgs e)
        {
            Button      bt        = (Button)sender;
            TextBox     tb        = (TextBox)bt.Tag;
            C1FlexGrid  grid      = (C1FlexGrid)tb.Tag;
            XmlDocument doc       = (XmlDocument)mod_global.MF.XmlIdCodeGrid.Tag;
            XmlNode     originnod = doc.DocumentElement;

            if (tb.Text != String.Empty)
            {
                if (mod_global.Check_If_Identification_Code_Name_Exist(tb.Text.ToUpper(), doc) == true)
                {
                    System.Windows.Forms.MessageBox.Show("Ce code d'identification existe déjà.");
                    return;
                }

                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["id"] = tb.Text;

                //ici
                XmlElement codeNode = doc.CreateElement("code");
                XmlElement idNode   = doc.CreateElement("id");
                idNode.InnerText = tb.Text.ToUpper();
                XmlElement intituleNode   = doc.CreateElement("intitule");
                XmlElement valeurNode     = doc.CreateElement("valeur");
                XmlElement saisieNode     = doc.CreateElement("saisie");
                XmlElement renseigneNode  = doc.CreateElement("renseigne");
                XmlElement inspectionNode = doc.CreateElement("inspection");

                codeNode.AppendChild(idNode);
                codeNode.AppendChild(intituleNode);
                codeNode.AppendChild(valeurNode);
                codeNode.AppendChild(saisieNode);
                codeNode.AppendChild(renseigneNode);
                codeNode.AppendChild(inspectionNode);

                originnod.AppendChild(codeNode);

                doc.Save(mod_global.MF.XmlIdStripLabel.Text);

                tb.Text = String.Empty;
            }
            else
            {
                MessageBox.Show("Veuillez saisir un code à ajouter", "Erreur", MessageBoxButtons.OK);
            }
        }
Exemple #11
0
        /*
         *
         * Ajouter un Code Lié dans le fichier XML */

        public static void Add_Obs_Code_Lie(object sender, EventArgs e)
        {
            Button     bt   = (Button)sender;
            TextBox    tb   = (TextBox)bt.Tag;
            C1FlexGrid grid = (C1FlexGrid)tb.Tag;

            XmlDocument doc       = (XmlDocument)mod_global.MF.XmlObsCodesGrid.Tag;
            XmlNode     originnod = Selected_Obs_Code;

            if (tb.Text != String.Empty)
            {
                if (mod_global.Check_If_Observation_Code_Lie_Exist(tb.Text, doc))
                {
                    System.Windows.Forms.MessageBox.Show("Ce code lié existe déjà.");
                    return;
                }

                XmlNodeList           nodelist = Selected_Obs_Code.SelectNodes("lien/codelie");
                C1.Win.C1FlexGrid.Row ligne    = grid.Rows.Add();
                ligne["codelie"]  = tb.Text;
                ligne["position"] = nodelist.Count;


                XmlElement itemNode = doc.CreateElement("codelie");
                itemNode.InnerText = tb.Text;
                itemNode.SetAttribute("position", nodelist.Count.ToString());

                originnod = originnod.SelectSingleNode("lien");
                originnod.AppendChild(itemNode);

                // Recharger les tableaux
                Fill_Obs_Codes_Grid(mod_global.MF.XmlObsCodesGrid, doc);
                Fill_Obs_Codelie_Grid(mod_global.MF.XmlObsCodeLieGrid);
                Fill_Obs_Carac_Grid(mod_global.MF.XmlObsCaracGrid);

                doc.Save(mod_global.MF.XmlObsStripLabel.Text);

                tb.Text = String.Empty;
            }
            else
            {
                MessageBox.Show("Veuillez saisir une code à ajouter", "Erreur", MessageBoxButtons.OK);
            }
        }
Exemple #12
0
        /*
         *
         * Remplir le grid Caractéristiques */
        public static void Fill_Obs_Carac_Grid(C1FlexGrid grid)
        {
            XmlNodeList nodeList;

            grid.Rows.Count = 1;
            mod_global.MF.XmlObsItemGrid.Rows.Count = 1;

            nodeList = Selected_Obs_Code.SelectNodes(string.Concat("caracteristiques/caracteristique"));

            foreach (XmlNode unNode in nodeList)
            {
                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();

                ligne["nom"]    = unNode.Attributes["nom"].InnerText;
                ligne["nbitem"] = unNode.ChildNodes.Count;

                if (unNode.Attributes.GetNamedItem("type") != null)
                {
                    ligne["type"] = unNode.Attributes["type"].InnerText;
                }
                if (unNode.Attributes.GetNamedItem("intitule") != null)
                {
                    ligne["intitule"] = unNode.Attributes["intitule"].InnerText;
                }
                if (unNode.Attributes.GetNamedItem("unite") != null)
                {
                    ligne["unite"] = unNode.Attributes["unite"].InnerText;
                }
                if (unNode.Attributes.GetNamedItem("renseigne") != null)
                {
                    ligne["renseigne"] = unNode.Attributes["renseigne"].InnerText;
                }
                if (unNode.Attributes.GetNamedItem("ajoute") != null)
                {
                    ligne["ajoute"] = unNode.Attributes["ajoute"].InnerText;
                }
                if (unNode.Attributes.GetNamedItem("abreviation") != null)
                {
                    ligne["abreviation"] = unNode.Attributes["abreviation"].InnerText;
                }
            }
        }
Exemple #13
0
        /*
         *
         * Ajouter un Item dans le fichier XML */
        public static void Add_Obs_Item(object sender, EventArgs e)
        {
            Button     bt        = (Button)sender;
            TextBox    tb        = (TextBox)bt.Tag;
            C1FlexGrid grid      = (C1FlexGrid)tb.Tag;
            XmlNode    originnod = Selected_Obs_Carac;

            XmlDocument doc = (XmlDocument)mod_global.MF.XmlObsCodesGrid.Tag;

            if (tb.Text != String.Empty)
            {
                if (mod_global.Check_If_Observation_Item_Name_Exist(tb.Text, originnod) == true)
                {
                    System.Windows.Forms.MessageBox.Show("Cet item existe déjà.");
                    return;
                }

                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["nom"] = tb.Text;

                XmlElement itemNode = doc.CreateElement("item");
                itemNode.SetAttribute("nom", tb.Text);
                itemNode.SetAttribute("ajoute", "true");
                originnod.AppendChild(itemNode);

                // Recharger les tableaux
                Fill_Obs_Carac_Grid(mod_global.MF.XmlObsCaracGrid);
                Fill_Obs_Item_Grid(mod_global.MF.XmlObsItemGrid);

                doc.Save(mod_global.MF.XmlObsStripLabel.Text);

                tb.Text = String.Empty;
            }
            else
            {
                MessageBox.Show("Veuillez saisir un nom d'item à ajouter", "Erreur", MessageBoxButtons.OK);
            }
        }
Exemple #14
0
        public static void Fill_Section_Grid(C1FlexGrid grid, XmlDocument Doc)
        {
            XmlNodeList nodeList;

            grid.Rows.Count = 1;
            mod_global.MF.XmlHeureGrid.Rows.Count = 1;
            grid.Tag = Doc;

            root = Doc.DocumentElement;

            nodeList = root.SelectNodes(string.Concat("section"));

            foreach (XmlNode unNode in nodeList)
            {
                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["id"]       = unNode.Attributes["id"].InnerText;
                ligne["ouvrage"]  = unNode.Attributes["ouvrage"].InnerText;
                ligne["forme"]    = unNode.Attributes["forme"].InnerText;
                ligne["position"] = unNode.Attributes["position"].InnerText;
                ligne["intitule"] = unNode.Attributes["intitule"].InnerText;
                ligne["image"]    = unNode.Attributes["image"].InnerText;
            }
        }
Exemple #15
0
        //--------------------------- Fonctions d'ajout et de suppression ---------------------------------

        /*
         *
         * Ajouter un type de section dans le fichier XML */
        public static void Add_Section_Type(object sender, EventArgs e)
        {
            Button      bt        = (Button)sender;
            TextBox     tb        = (TextBox)bt.Tag;
            C1FlexGrid  grid      = (C1FlexGrid)tb.Tag;
            XmlDocument doc       = (XmlDocument)mod_global.MF.XmlSectionGrid.Tag;
            XmlNode     originnod = doc.DocumentElement;

            if (tb.Text != String.Empty)
            {
                if (mod_global.Check_If_Section_Type_Exist(tb.Text.ToUpper(), doc) == true)
                {
                    System.Windows.Forms.MessageBox.Show("Ce type de section existe déjà.");
                    return;
                }

                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["id"] = tb.Text;

                //ici
                XmlElement sectionNode = doc.CreateElement("section");
                sectionNode.SetAttribute("id", tb.Text);
                sectionNode.SetAttribute("ouvrage", "");
                sectionNode.SetAttribute("forme", "");
                sectionNode.SetAttribute("intitule", "");
                sectionNode.SetAttribute("position", "");
                sectionNode.SetAttribute("image", "");
                XmlElement horaire = Create_One_Horaire("12H", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("12H30", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("1H", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("1H30", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("2H", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("2H30", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("3H", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("3H30", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("4H", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("4H30", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("5H", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("5H30", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("6H", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("6H30", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("7H", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("7H30", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("8H", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("8H30", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("9H00", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("9H30", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("10H", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("10H30", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("11H", doc);
                sectionNode.AppendChild(horaire);
                horaire = Create_One_Horaire("11H30", doc);
                sectionNode.AppendChild(horaire);

                originnod.AppendChild(sectionNode);

                doc.Save(mod_global.MF.XmlSectionStripLabel.Text);

                tb.Text = String.Empty;
            }
            else
            {
                MessageBox.Show("Veuillez saisir un type de section à ajouter", "Erreur", MessageBoxButtons.OK);
            }
        }
Exemple #16
0
        public static void Fill_Id_Codes_Grid(C1FlexGrid grid, XmlDocument Doc)
        {
            XmlNodeList nodeList;
            XmlNode     idNode;
            XmlNode     intituleNode;
            XmlNode     renseigneNode;
            XmlNode     saisieNode;
            XmlNode     valeurNode;

            grid.Rows.Count = 1;
            mod_global.MF.XmlIdItemGrid.Rows.Count = 1;
            grid.Tag = Doc;

            root = Doc.DocumentElement;

            nodeList = root.SelectNodes(string.Concat("code"));

            foreach (XmlNode unNode in nodeList)
            {
                idNode        = unNode.SelectSingleNode("id");
                intituleNode  = unNode.SelectSingleNode("intitule");
                renseigneNode = unNode.SelectSingleNode("renseigne");
                saisieNode    = unNode.SelectSingleNode("saisie");
                valeurNode    = unNode.SelectSingleNode("valeur");

                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["id"]        = idNode.InnerText;
                ligne["nbitem"]    = valeurNode.ChildNodes.Count;
                ligne["parent"]    = unNode.Attributes["parent"].InnerText;
                ligne["position"]  = unNode.Attributes["position"].InnerText;
                ligne["intitule"]  = intituleNode.InnerText;
                ligne["renseigne"] = renseigneNode.InnerText;
                ligne["saisie"]    = saisieNode.InnerText;

                if (valeurNode.Attributes.GetNamedItem("type") != null)
                {
                    ligne["type"] = valeurNode.Attributes["type"].InnerText;
                }
                if (valeurNode.Attributes.GetNamedItem("unite") != null)
                {
                    ligne["unite"] = valeurNode.Attributes["unite"].InnerText;
                }

                if (unNode.Attributes.GetNamedItem("reporte") != null)
                {
                    ligne["reporte"] = unNode.Attributes["reporte"].InnerText;
                }
                if (unNode.Attributes.GetNamedItem("ajoute") != null)
                {
                    ligne["ajoute"] = unNode.Attributes["ajoute"].InnerText;
                }
                if (unNode.SelectSingleNode("inspection") != null)
                {
                    ligne["inspection"] = unNode.SelectSingleNode("inspection").InnerText;
                }
                if (unNode.SelectSingleNode("inspection").Attributes["corresp"] != null)
                {
                    ligne["corresp"] = unNode.SelectSingleNode("inspection").Attributes["corresp"].InnerText;
                }
                if (unNode.SelectSingleNode("intitule").Attributes["info"] != null)
                {
                    ligne["info"] = unNode.SelectSingleNode("intitule").Attributes["info"].InnerText;
                }
            }
        }
Exemple #17
0
        //--------------------------- Fonctions d'ajout et de suppression ---------------------------------

        /*
         *
         * Ajouter un Code dans le fichier XML */
        public static void Add_Obs_Code(object sender, EventArgs e)
        {
            Button      bt        = (Button)sender;
            TextBox     tb        = (TextBox)bt.Tag;
            C1FlexGrid  grid      = (C1FlexGrid)tb.Tag;
            XmlDocument doc       = (XmlDocument)mod_global.MF.XmlObsCodesGrid.Tag;
            XmlNode     originnod = doc.DocumentElement;

            if (tb.Text != String.Empty)
            {
                if (mod_global.Check_If_Observation_Code_Name_Exist(tb.Text.ToUpper(), doc) == true)
                {
                    System.Windows.Forms.MessageBox.Show("Ce code d'observation existe déjà.");
                    return;
                }

                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["id"] = tb.Text;

                //ici
                XmlElement codeNode = doc.CreateElement("code");
                codeNode.SetAttribute("ajoute", "true");
                XmlElement idNode = doc.CreateElement("id");
                idNode.InnerText = tb.Text.ToUpper();
                XmlElement intituleNode         = doc.CreateElement("intitule");
                XmlElement caracteristiquesNode = doc.CreateElement("caracteristiques");

                XmlElement carac = Create_One_Caracteristique("c1", doc);
                caracteristiquesNode.AppendChild(carac);
                carac = Create_One_Caracteristique("c2", doc);
                caracteristiquesNode.AppendChild(carac);
                carac = Create_One_Caracteristique("q1", doc);
                caracteristiquesNode.AppendChild(carac);
                carac = Create_One_Caracteristique("q2", doc);
                caracteristiquesNode.AppendChild(carac);
                carac = Create_One_Caracteristique("h1", doc);
                caracteristiquesNode.AppendChild(carac);
                carac = Create_One_Caracteristique("h2", doc);
                caracteristiquesNode.AppendChild(carac);
                carac = Create_One_Caracteristique("pm1", doc);
                caracteristiquesNode.AppendChild(carac);
                carac = Create_One_Caracteristique("pm2", doc);
                caracteristiquesNode.AppendChild(carac);
                carac = Create_One_Caracteristique("assemblage", doc);
                caracteristiquesNode.AppendChild(carac);
                carac = Create_One_Caracteristique("video", doc);
                caracteristiquesNode.AppendChild(carac);
                carac = Create_One_Caracteristique("photo", doc);
                caracteristiquesNode.AppendChild(carac);
                carac = Create_One_Caracteristique("audio", doc);
                caracteristiquesNode.AppendChild(carac);
                carac = Create_One_Caracteristique("remarques", doc);
                caracteristiquesNode.AppendChild(carac);

                codeNode.AppendChild(idNode);
                codeNode.AppendChild(intituleNode);
                codeNode.AppendChild(caracteristiquesNode);

                originnod.AppendChild(codeNode);

                doc.Save(mod_global.MF.XmlObsStripLabel.Text);

                // Recharger les tableaux
                Fill_Obs_Codes_Grid(mod_global.MF.XmlObsCodesGrid, doc);

                tb.Text = String.Empty;
            }
            else
            {
                MessageBox.Show("Veuillez saisir un code à ajouter", "Erreur", MessageBoxButtons.OK);
            }
        }
Exemple #18
0
        private void LoadView(int cheDo)
        {
            InstalCsStyle();

            fg.BeginUpdate();

            fg.ClearRows();
            if (cheDo == 1)
            {
            }
            if (cheDo == 2)
            {
                fg.Cols[1].Caption = "Chủ nhật";
                fg.Cols[1].Width   = 205;
                fg.Cols[1].Style   = csNghi;
                for (int c = 0; c < 7; ++c)
                {
                    C1.Win.C1FlexGrid.Column col = fg.Cols.Add();
                    col.Width   = 200;
                    col.Caption = "Thứ " + (c + 2);
                    col.Name    = c.ToString();
                }
                for (int r = 1; r <= 30; ++r)
                {
                    C1.Win.C1FlexGrid.Row row = fg.Rows.Add();
                    for (int c = fg.Cols.Fixed; c < fg.Cols.Count; ++c)
                    {
                        if (r % 6 == 0)
                        {
                            this.fg.SetCellStyle(r, c, "b");
                        }
                    }
                }
                for (int c = fg.Cols.Fixed + 1; c < fg.Cols.Count; ++c)
                {
                    fg.Cols[c].Style = csNgayThuong;
                }
                fg.Cols[fg.Cols.Fixed].Style = csNghi;
                DateTime d = firstDayCalendar;
                for (int r = fg.Rows.Fixed; r < fg.Rows.Count; r += 6)
                {
                    for (int c = fg.Cols.Fixed; c < fg.Cols.Count; ++c)
                    {
                        if (d.Day == 1)
                        {
                            fg[r, c] = d.Day + " tháng " + d.Month;
                        }
                        else
                        {
                            fg[r, c] = d.Day;
                        }
                        d = d.AddDays(1);
                    }
                }
            }
            if (cheDo == 3)
            {
                DateTime date = monthCalendar.SelectionRange.Start;
                int      totalCalendarDays = 42; // matrix 7 x 5

                // set the first month day
                DateTime firstDayMonth = new DateTime(date.Year, date.Month, 1);

                // set the lastmonth day
                DateTime lastDayMonth = new DateTime(date.Year, date.Month, DateTime.DaysInMonth(date.Year, date.Month));

                // now get the first day week of the first day month (0-6 Sun-Sat)
                byte firstDayWeek = (byte)firstDayMonth.DayOfWeek;

                // now get the first day week of the last day month (0-6 Sun-Sat)
                byte lastDayWeek = (byte)lastDayMonth.DayOfWeek;

                // now the first day show in calendar is the first day month minus the days to 0 (sunday)
                firstDayCalendar = firstDayMonth.Subtract(TimeSpan.FromDays(firstDayWeek));
                int tempDays = (lastDayMonth - firstDayCalendar).Days;

                lastDayCalendar = lastDayMonth.Add(TimeSpan.FromDays(totalCalendarDays - tempDays - 1));

                for (int r = 1; r <= 36; ++r)
                {
                    C1.Win.C1FlexGrid.Row row = fg.Rows.Add();
                    for (int c = fg.Cols.Fixed; c < fg.Cols.Count; ++c)
                    {
                        if (r % 6 == 0)
                        {
                            this.fg.SetCellStyle(r, c, "b");
                        }
                    }
                }
                for (int c = fg.Cols.Fixed + 1; c < fg.Cols.Count; ++c)
                {
                    fg.Cols[c].Style = csNgayThuong;
                }
                DateTime    d             = firstDayCalendar;
                clsCongViec cls           = new clsCongViec();
                DataTable   dt_DsNgayNghi = cls.DS_NgayNghi(firstDayCalendar, lastDayCalendar);

                for (int r = fg.Rows.Fixed; r < fg.Rows.Count; r += 6)
                {
                    for (int c = fg.Cols.Fixed; c < fg.Cols.Count; ++c)
                    {
                        if (d.Day == 1)
                        {
                            fg[r, c] = d.Day + "/" + d.Month;
                        }
                        else
                        {
                            fg[r, c] = d.Day + "/" + d.Month;
                        }
                        if (d.Date == dtNow.Date)
                        {
                            for (int i = 0; i < 1; ++i)
                            {
                                CellRange range = fg.GetCellRange(r + i, c);
                                range.Style = csNgayHomNay;
                            }
                        }
                        if (Trong_DsNgayNghi(dt_DsNgayNghi, d))
                        {
                            for (int i = 0; i < 1; ++i)
                            {
                                CellRange range = fg.GetCellRange(r + i, c);
                                range.Style = csNghi;
                            }
                        }
                        d = d.AddDays(1);
                    }
                }

                LoadCalendar(cheDo, firstDayCalendar);

                fg.AllowMerging = AllowMergingEnum.Custom;
                for (int i = fg.Rows.Fixed; i < fg.Rows.Count; ++i)
                {
                    fg.Rows[i].AllowMerging = true;
                }
            }

            fg.EndUpdate();
            fg.AllowMerging = AllowMergingEnum.Free;
        }
Exemple #19
0
        public static void Fill_Observation_Grid(C1FlexGrid grid)
        {
            XmlNodeList nodeList;
            XmlNode     root;
            int         DiffereCount = 0;

            //grid.Clear(ClearFlags.UserData);
            grid.Rows.Count = 1;

            root = mod_accueil.SVF.DocumentElement;

            nodeList = root.SelectNodes(string.Concat("/inspection/ouvrage[@nom='", mod_accueil.OUVRAGE, "']/observations/code"));

            foreach (XmlNode unNode in nodeList)
            {
                C1.Win.C1FlexGrid.Row ligne = grid.Rows.Add();
                ligne["pm1"] = double.Parse(Get_Pm(unNode, false));
                if (Get_Pm2(unNode, false) != String.Empty)
                {
                    ligne["pm2"] = double.Parse(Get_Pm2(unNode, false));
                }
                ligne["code"]  = unNode.FirstChild.InnerText;
                ligne["forme"] = unNode.Attributes["forme"].InnerText;
                ligne["num"]   = unNode.Attributes["num"].InnerText;
                //ligne["observation"] = unNode.ChildNodes[1].InnerText + "\n\n" + Get_Caracteristiques(unNode);
                if (OBS_GRID_EXPANDED == false)
                {
                    ligne["observation"] = Get_Caracteristiques_In_RTF_Paragraph_Collapse(unNode);
                }
                else
                {
                    ligne["observation"] = Get_Caracteristiques_In_RTF_Paragraph(unNode);
                }

                if (Is_Differe_Field_To_Fill(unNode) == true)
                {
                    grid.SetCellStyle(ligne.SafeIndex, 6, "DiffereStyle");
                    DiffereCount += 1;
                }

                //code de changement de section
                if (unNode.FirstChild.InnerText == "AEC" | unNode.FirstChild.InnerText == "CEC")
                {
                    grid.Rows[ligne.SafeIndex].Style = grid.Styles["SectionChangeStyle"];
                }
                //grid.SetCellStyle(ligne.SafeIndex, 4, "SectionChangeStyle");
            }

            //Si le nbre d'observation à compléter est > 0, on affiche le nbre dans la barre de menu
            if (DiffereCount > 0)
            {
                mod_global.MF.ObsDiffereSp.Visible      = true;
                mod_global.MF.ObsDiffereLb.Visible      = true;
                mod_global.MF.ObsDiffereCountLb.Visible = true;

                mod_global.MF.ObsDiffereCountLb.Text = DiffereCount.ToString();
            }
            else
            {
                mod_global.MF.ObsDiffereSp.Visible      = false;
                mod_global.MF.ObsDiffereLb.Visible      = false;
                mod_global.MF.ObsDiffereCountLb.Visible = false;
            }

            //On classe le tableau en fonction de la colonne position (1)
            grid.Sort(last_sort_order, last_sort_column);
        }