Esempio n. 1
0
        public List <ArcheoObject> GetArcheoObjColFromXMLDoc(XmlDocument xmlDoc)
        {
            List <ArcheoObject> archeoObjCol = new List <ArcheoObject>();
            //TODO: Das Laden bestehender XML Daten funktioniert nicht korrekt.
            XmlNodeList elemList = xmlDoc.DocumentElement.SelectNodes("/ArcheoObjectsList/ArcheoObject");

            foreach (XmlNode node in elemList)
            {
                ArcheoObject archeoObj = new ArcheoObject();
                archeoObj.SetTitle(node.SelectSingleNode("title").InnerText);
                archeoObj.SetCode(node.SelectSingleNode("code").InnerText);
                //try { archeoObj.SetCurrentNumber(int.Parse(node.SelectSingleNode("currentNumber").InnerText)); }
                //catch (Exception) { Console.WriteLine("Value currentNumber: Error by parse to int"); throw; }
                archeoObj.SetCoordinate(node.SelectSingleNode("coordinate").InnerText);
                try { archeoObj.SetDepth(int.Parse(node.SelectSingleNode("depth").InnerText)); }
                catch (Exception) { Console.WriteLine("Value depth: Error by parse to int"); throw; }
                try { archeoObj.SetWidth(int.Parse(node.SelectSingleNode("width").InnerText)); }
                catch (Exception) { Console.WriteLine("Value width: Error by parse to int"); throw; }
                try { archeoObj.SetHeight(int.Parse(node.SelectSingleNode("height").InnerText)); }
                catch (Exception) { Console.WriteLine("Value height: Error by parse to int"); throw; }
                archeoObj.SetTypOfCoordinate(node.SelectSingleNode("typeOfCoordinate").InnerText);
                archeoObj.SetTypOfBuild(node.SelectSingleNode("typeOfBuild").InnerText);
                archeoObj.SetCoordinate(node.SelectSingleNode("coordinate").InnerText);
                archeoObj.SetDescription(node.SelectSingleNode("description").InnerText);
                archeoObj.SetImagelink(node.SelectSingleNode("imageLink").InnerText);
                archeoObj.SetShortPath(node.SelectSingleNode("shortPath").InnerText);
                archeoObj.SetParticularities(node.SelectSingleNode("particularities").InnerText);
                archeoObjCol.Add((ArcheoObject)archeoObj);
            }
            return(archeoObjCol);
        }
Esempio n. 2
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            archeoObject = new ArcheoObject();
            archeoObject.SetCode(this.textBoxCode.Text);
            archeoObject.SetCoordinate(this.textBoxCoordinate.Text);
            try
            {
                archeoObject.SetDepth(int.Parse(this.textBoxDepth.Text));
            }
            catch
            {
                this.textBoxDepth.Text        = "000";
                this.labelExamDepth.BackColor = Color.Red;
            }
            archeoObject.SetDescription(this.textBoxDescription.Text);
            try
            {
                archeoObject.SetHeight(int.Parse(this.textBoxHeight.Text));
            }
            catch
            {
                this.textBoxHeight.Text        = "000";
                this.labelExamHeight.BackColor = Color.Red;
            }
            archeoObject.SetImagelink(this.textBoxPicturePath.Text);
            archeoObject.SetParticularities(this.textBoxParticularities.Text);
            archeoObject.SetTitle(this.textBoxTitle.Text);
            archeoObject.SetTypOfBuild(this.textBoxTypeOfBuild.Text);
            archeoObject.SetTypOfCoordinate(this.textBoxTypeOfCoordinate.Text);
            try
            {
                archeoObject.SetWidth(int.Parse(this.textBoxWidth.Text));
            }
            catch
            {
                this.textBoxWidth.Text        = "000";
                this.labelExamWidth.BackColor = Color.Red;
            }
            ArcheoObjectCtl archeoObjectCtl = new ArcheoObjectCtl();

            archeoObjectCtl.SetArcheoObject(archeoObject);
            this.buttonSave.Enabled = false;
        }