示例#1
0
        public static void Get_Code_Identification(C1TopicBar tpbar)
        {
            XmlNode        root;
            XPathNavigator IdItem;
            XPathNavigator IntituleItem;
            XPathNavigator InspectItem;

            root = mod_global.Get_Codes_Id_DocElement();

            //On utilise un navigateur pour pouvoir trier les noeuds
            XPathNavigator  nav = root.CreateNavigator();
            XPathExpression exp = nav.Compile("//code");

            exp.AddSort("@position", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number);

            foreach (XPathNavigator item in nav.Select(exp))
            {
                IdItem = item.SelectSingleNode("id");

                IntituleItem = item.SelectSingleNode("intitule");
                InspectItem  = item.SelectSingleNode("inspection");

                if (InspectItem.GetAttribute("corresp", "") == "")
                {
                    C1.Win.C1Command.C1TopicLink link = new C1.Win.C1Command.C1TopicLink();
                    if (item.GetAttribute("ajoute", "") == "true")
                    {
                        link.Text = string.Concat("** " + IntituleItem.Value, " - ", IdItem.Value);
                    }
                    else
                    {
                        link.Text = string.Concat(IntituleItem.Value, " - ", IdItem.Value);
                    }
                    link.Tag = IdItem.Value;
                    tpbar.FindPageByTag(item.GetAttribute("parent", "")).Links.Add(link);
                }
            }

            /* ANCIEN CODE DE NS (remplacé par GB le 16/12/2009)
             * XmlNodeList nodeList;
             * XmlNode IdNode;
             * XmlNode IntituleNode;
             *
             * //nodeList = root.SelectNodes(string.Concat("//code"));
             *
             * foreach (XmlNode unNode in nodeList)
             * {
             *  IdNode = unNode.SelectSingleNode("id");
             *  IntituleNode = unNode.SelectSingleNode("intitule");
             *
             *  C1.Win.C1Command.C1TopicLink link = new C1.Win.C1Command.C1TopicLink();
             *  link.Text = string.Concat(IntituleNode.InnerText, " - ", IdNode.InnerText);
             *  link.Tag = IdNode.InnerText;
             *  tpbar.FindPageByTag(unNode.Attributes["parent"].InnerText).Links.Add(link);
             * }*/
        }
示例#2
0
        public static void Fill_Identification_Form(string groupe, FlowLayoutPanel flp)
        {
            XmlNode        root;
            string         unite  = string.Empty;
            bool           ajoute = false;
            XPathNavigator IdItem;
            XPathNavigator ValItem;
            XPathNavigator IntituleItem;
            XPathNavigator RenseigneItem;
            XPathNavigator InspectItem;

            root = mod_global.Get_Codes_Id_DocElement();

            flp.Controls.Clear();

            //On utilise un navigateur pour pouvoir trier les noeuds
            XPathNavigator  nav = root.CreateNavigator();
            XPathExpression exp = nav.Compile(string.Concat("//code[@parent='", groupe, "']"));

            exp.AddSort("@position", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number);

            foreach (XPathNavigator item in nav.Select(exp))
            {
                IdItem        = item.SelectSingleNode("id");
                ValItem       = item.SelectSingleNode("valeur");
                IntituleItem  = item.SelectSingleNode("intitule");
                RenseigneItem = item.SelectSingleNode("renseigne");
                InspectItem   = item.SelectSingleNode("inspection");

                if (InspectItem.GetAttribute("corresp", "") == "")
                {
                    if (item.GetAttribute("ajoute", "") != "")
                    {
                        ajoute = bool.Parse(item.GetAttribute("ajoute", ""));
                    }

                    string nom_complet = IdItem.Value + " | " + IntituleItem.Value;

                    unite = Get_Unite_For_Id_Code(IdItem.Value);
                    if (unite != string.Empty)
                    {
                        nom_complet += " (" + unite + ")";
                    }

                    string value = Get_Value_Identification(IdItem.Value);

                    identification_input id_box = new identification_input(nom_complet, IdItem.Value, value, RenseigneItem.Value, ValItem.GetAttribute("type", ""), ajoute, groupe);

                    ajoute = false;
                    flp.Controls.Add(id_box);
                }
            }

            /* ANCIEN CODE DE NS (remplacé par GB le 16/12/2009)
             * XmlNodeList nodeList;
             * XmlNode IdNode;
             * XmlNode ValNode;
             * XmlNode IntituleNode;
             * XmlNode RenseigneNode;
             *
             * nodeList = root.SelectNodes(string.Concat("//code[@parent='", groupe, "']"));
             *
             * foreach (XmlNode unNode in nodeList)
             * {
             *  IdNode = unNode.SelectSingleNode("id");
             *  ValNode = unNode.SelectSingleNode("valeur");
             *  IntituleNode = unNode.SelectSingleNode("intitule");
             *  RenseigneNode = unNode.SelectSingleNode("renseigne");
             *
             *  if (unNode.Attributes.GetNamedItem("ajoute") != null)
             *      ajoute = bool.Parse(unNode.Attributes.GetNamedItem("ajoute").InnerText);
             *
             *  string nom_complet = IdNode.InnerText + " | " + IntituleNode.InnerText;
             *
             *  unite = Get_Unite_For_Id_Code(IdNode.InnerText);
             *  if (unite != string.Empty)
             *      nom_complet += " (" + unite + ")";
             *
             *  string value = Get_Value_Identification(IdNode.InnerText);
             *
             *  identification_input id_box = new identification_input(nom_complet, IdNode.InnerText, value, RenseigneNode.InnerText, ValNode.Attributes["type"].InnerText, ajoute, groupe);
             *
             *  ajoute = false;
             *  flp.Controls.Add(id_box);
             * }
             */
        }