public ArcheoObject NewArcheoObject()
        {
            ArcheoObject archeoObject = new ArcheoObject();

            archeoObjects.Add(archeoObject);
            return(archeoObject);
        }
        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);
        }
        public ArcheoObject GetArcheoObject(List <ArcheoObject> archeoObjects, String code)
        {
            this.archeoObjects = archeoObjects;
            ArcheoObject archeoObject = null;

            foreach (ArcheoObject item in this.archeoObjects)
            {
                if (item.GetCode().Equals(code))
                {
                    archeoObject = item;
                    break;
                }
            }
            return(archeoObject);
        }
Exemple #4
0
 internal void SetArcheoObjectInForm(ArcheoObject archeoObject)
 {
     this.archeoObject                 = archeoObject;
     this.textBoxCode.Text             = archeoObject.GetCode();
     this.textBoxCoordinate.Text       = archeoObject.GetCoordinate();
     this.textBoxDepth.Text            = archeoObject.GetDepth().ToString();
     this.textBoxDescription.Text      = archeoObject.GetDescription();
     this.textBoxHeight.Text           = archeoObject.GetHeight().ToString();
     this.textBoxParticularities.Text  = archeoObject.GetParticularities();
     this.textBoxPicturePath.Text      = archeoObject.GetShortPath();
     this.textBoxTitle.Text            = archeoObject.GetTitle();
     this.textBoxTypeOfBuild.Text      = archeoObject.GetTypeOfBuild();
     this.textBoxTypeOfCoordinate.Text = archeoObject.GetTypeOfCoordinate();
     this.textBoxWidth.Text            = archeoObject.GetWidth().ToString();
 }
Exemple #5
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;
        }
Exemple #6
0
        public void ExportToWord(ArcheoObject archeoObject, string fullFileName)
        {
            object      documentTyp      = 0;
            object      visible          = true;
            object      fileName         = fullFileName;
            string      fullTemplateName = new FilePaths().getTemplatePath();
            object      templateName     = fullTemplateName;
            object      missing          = System.Reflection.Missing.Value;
            Application oWordApp         = new Application();

            oWordApp.Visible = true;
            Document oWordDoc = oWordApp.Documents.Add(ref templateName, missing, documentTyp, visible);

            oWordDoc.Activate();

            int  test  = oWordDoc.Bookmarks.Count;
            bool test1 = oWordDoc.Bookmarks.Exists("Title");

            string[] textmarkes = { "Title", "Code", "Heigth", "Width", "Depth", "Width", };
            object   textmarke  = textmarkes[0].ToString();

            oWordDoc.Bookmarks.get_Item(ref textmarke).Range.Text = archeoObject.GetTitle();
            textmarke = textmarkes[1].ToString();
            oWordDoc.Bookmarks.get_Item(ref textmarke).Range.Text = archeoObject.GetCode();
            textmarke = textmarkes[2].ToString();
            oWordDoc.Bookmarks.get_Item(ref textmarke).Range.Text = archeoObject.GetCode();
            textmarke = textmarkes[3].ToString();
            oWordDoc.Bookmarks.get_Item(ref textmarke).Range.Text = archeoObject.GetHeight().ToString();
            textmarke = textmarkes[4].ToString();
            oWordDoc.Bookmarks.get_Item(ref textmarke).Range.Text = archeoObject.GetWidth().ToString();
            textmarke = textmarkes[5].ToString();
            oWordDoc.Bookmarks.get_Item(ref textmarke).Range.Text = archeoObject.GetDepth().ToString();



            oWordDoc.Close();
            oWordApp.Quit();
            //oWordDoc.SaveAs2(fileName);
        }
 public void SetArcheoObject(ArcheoObject archeoObject)
 {
     ArcheoObject archeoObject1 = GetArcheoObject(this.archeoObjects, archeoObject.GetCode());
 }