static string[] getDirectory(DataAccess da)
 {
     string[] dir;
     const string directAddition = @"Engineering Base\EB-Exporte\Dokumentation";
     if (da.FolderProject.Substring(da.FolderProject.Length - 1, 1) == @"\")
         dir = Directory.GetDirectories(String.Format("{0}{1}", da.FolderProject, directAddition));
     else
         dir = Directory.GetDirectories(String.Format("{0}\\{1}", da.FolderProject, directAddition));
     return dir;
 }
        static void Main(string[] args)
        {
            string[] files;

            DataAccess da = new DataAccess();

            IXConnFactory connFact = new IXConnFactory("http://SERVER-SQL:8080/ix-Projekte_und_Fibu/ix", "", "1.0");
            conn = connFact.Create("Faermann", "Faermann", "EDV-Faermann-8", null);

            string[] directs = getDirectory(da);

            string parentId = setParentId(da);

            foreach (string direct in directs)
            {
                if (!isItemExist(nameItem(direct), parentId, false))
                    createFolder(nameItem(direct), parentId);
                files = Directory.GetFiles(direct);
                foreach (string file in files)
                {
                    if (!isItemExist(nameItem(file), parentId,true))
                        createDocument(file, String.Format("{0}/{1}", parentId, nameItem(direct)));
                }
            }
        }
        static string setParentId(DataAccess da)
        {
            string parentId = "";

            parentId = String.Format("{0}/{1}/{2}/{3}", "ARCPATH:", "Projekte", da.FolderPrTypELOName, da.AnlageName);
            if (!isItemExist(da.Ebene2Name, parentId, false))
                    createFolder(da.Ebene2Name, parentId);
            parentId = String.Format("{0}/{1}",parentId, da.Ebene2Name);
            if (!isItemExist(da.Ebene3Name50, parentId, false))
                    createFolder(da.Ebene3Name50, parentId);
            if (!isItemExist(da.Ebene3Name60, parentId, false))
                    createFolder(da.Ebene3Name60, parentId);
            parentId = String.Format("{0}/{1}", parentId, da.Ebene3Name50);
               // parentId = String.Format("ARCPATH:{0}", parentId);
            return parentId;
        }