Beispiel #1
0
        public List <Oper> readOpers()
        {
            List <Oper> catalog = new List <Oper>();
            XmlDocument xDoc    = new XmlDocument();

            xDoc.Load("../../OperBase.xml");
            XmlElement xRoot = xDoc.DocumentElement; // получим корневой элемент

            foreach (XmlNode xnode in xRoot)         // обход всех узлов в корневом элементе
            {
                Oper    temp = new Oper();
                XmlNode attr = xnode.Attributes.GetNamedItem("ID");
                temp.ID = Convert.ToInt32(attr.Value);
                // обходим все дочерние узлы
                foreach (XmlNode childnode in xnode.ChildNodes)
                {
                    if (childnode.Name == "style")
                    {
                        temp.Style = childnode.InnerText;
                    }
                }
                catalog.Add(temp);
            }
            return(catalog);
        }
Beispiel #2
0
 public Zayavka(int tek, string C, int O, string Cost, string Time, string date, Clients clients, Opers opers)
 {
     this.ID     = tek;
     this.client = clients.findByFIO(C);
     this.oper   = opers.findByID(O);
     this.cost   = Convert.ToInt32(Cost);
     this.time   = Time;
     this.date   = date;
 }
Beispiel #3
0
        public void ReadData()
        {
            XmlElement Main   = xDoc.DocumentElement;// получим корневой элемент
            XmlNode    xRootC = Main.SelectSingleNode("clients");

            foreach (XmlNode xnodeC in xRootC)// обход всех узлов в корневом элементе
            {
                Client  tempC = new Client();
                XmlNode attr  = xnodeC.Attributes.GetNamedItem("ID");
                tempC.ID = Convert.ToInt32(attr.Value);
                // обходим все дочерние узлы
                foreach (XmlNode childnode in xnodeC.ChildNodes)
                {
                    if (childnode.Name == "FIO")
                    {
                        tempC.FIO = childnode.InnerText;
                    }
                }
                C.AddClient(tempC);
            }

            XmlNode xRootO = Main.SelectSingleNode("opers");

            foreach (XmlNode xnodeO in xRootO)// обход всех узлов в корневом элементе
            {
                Oper    temp = new Oper();
                XmlNode attr = xnodeO.Attributes.GetNamedItem("ID");
                temp.ID = Convert.ToInt32(attr.Value);
                // обходим все дочерние узлы
                foreach (XmlNode childnode in xnodeO.ChildNodes)
                {
                    if (childnode.Name == "style")
                    {
                        temp.Style = childnode.InnerText;
                    }
                }
                O.AddOper(temp);
            }

            XmlNode xRootZ = Main.SelectSingleNode("Zayavki");

            foreach (XmlNode xnodeZ in xRootZ)
            {
                Zayavka temp = new Zayavka();
                XmlNode attr = xnodeZ.Attributes.GetNamedItem("ID");
                temp.ID = Convert.ToInt32(attr.Value);
                // обходим все дочерние узлы
                foreach (XmlNode childnode in xnodeZ.ChildNodes)
                {
                    if (childnode.Name == "Client")
                    {
                        temp.client = C.findByID(Convert.ToInt32(childnode.InnerText));
                    }
                    if (childnode.Name == "OperrationType")
                    {
                        temp.oper = O.findByID(Convert.ToInt32(childnode.InnerText));
                    }
                    if (childnode.Name == "Cost")
                    {
                        temp.cost = Convert.ToInt32(childnode.InnerText);
                    }
                    if (childnode.Name == "During")
                    {
                        temp.time = childnode.InnerText;
                    }
                    if (childnode.Name == "Nomenklatura")
                    {
                        temp.nomen = childnode.InnerText;
                    }
                    if (childnode.Name == "Date")
                    {
                        temp.date = childnode.InnerText;
                    }
                }
                Z.AddZayavka(temp);
            }
        }