Ejemplo n.º 1
0
        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)));
                    }
                }
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // Defaultwerte
            string arcPath        = "ARCPATH[1]:/Administration/Business Solutions";
            string winPath        = "E:/Temp/sol";
            string ixUrl          = "http://srvpdevbs01vm:8010/ix-invoice/ix";
            string user           = "******";
            string pwd            = "elo";
            string exportref      = "false";
            string maskname       = "ELOScripts";
            var    cmdLineOptions = new ExportSol.CommandLineOptions();

            if (CommandLine.Parser.Default.ParseArguments(args, cmdLineOptions))
            {
                Debug.WriteLine("arcpath: {0}", cmdLineOptions.arcpath);
                Debug.WriteLine("winpath: {0}", cmdLineOptions.winpath);
                Debug.WriteLine("ixurl: {0}", cmdLineOptions.ixurl);
                Debug.WriteLine("user: {0}", cmdLineOptions.user);
                Debug.WriteLine("pwd: {0}", cmdLineOptions.pwd);
                Debug.WriteLine("exportref: {0}", cmdLineOptions.exportref);
                Debug.WriteLine("maskname: {0}", cmdLineOptions.maskname);
                arcPath   = cmdLineOptions.arcpath;
                winPath   = cmdLineOptions.winpath;
                ixUrl     = cmdLineOptions.ixurl;
                user      = cmdLineOptions.user;
                pwd       = cmdLineOptions.pwd;
                exportref = cmdLineOptions.exportref;
                maskname  = cmdLineOptions.maskname;
            }
            else
            {
                Debug.WriteLine("cmdLineOptions not avaible");
            }

            try
            {
                IXConnFactory connFact         = new IXConnFactory(ixUrl, "ExportSol", "1.0");
                IXConnection  conn             = connFact.Create(user, pwd, null, null);
                bool          exportreferences = exportref.Equals("true") ? true : false;
                FindChildren(conn, arcPath, winPath, exportreferences, maskname);
                Console.WriteLine("ticket=" + conn.LoginResult.clientInfo.ticket);
                conn.Logout();
            }
            catch (byps.BException e)
            {
                if (e.Source != null)
                {
                    Console.WriteLine("byps.BException message: {0}", e.Message);
                    Debug.WriteLine("byps.BException message: {0}", e.Message);
                }
            }
            catch (System.Net.WebException e)
            {
                if (e.Source != null)
                {
                    Console.WriteLine("System.Net.WebException message: {0}", e.Message);
                    Debug.WriteLine("System.Net.WebException message: {0}", e.Message);
                }
            }
        }
Ejemplo n.º 3
0
        public void run()
        {
            lockKey = "mykey";

            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // Get the current archive key
                int keyIdBeforeLock = ix.Ix.lockArchive(null);
                Logger.instance().log("key before lock=" + keyIdBeforeLock);

                // LOCK
                int keyIdBeforeLock2 = ix.Ix.lockArchive(lockKey);

                // Get the current archive key
                int keyIdAfterLock = ix.Ix.lockArchive(null);
                Logger.instance().log("key after lock=" + keyIdAfterLock);

                // UNLOCK
                int keyIdBeforeUnlock = ix.Ix.lockArchive("0");
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 4
0
        public static void StartAppManager(KonfigurationIx ixConf)
        {
            try
            {
                IXConnFactory connFact = new IXConnFactory(ixConf.ixUrl, "Start AppManager", "1.0");
                IXConnection  ixConn   = connFact.Create(ixConf.user, ixConf.pwd, null, null);

                string ticket        = ixConn.LoginResult.clientInfo.ticket;
                string ixUrl         = ixConn.EndpointUrl;
                string appManagerUrl = ixUrl.Replace("ix-", "wf-");
                appManagerUrl = appManagerUrl.Replace("/ix", "/apps/app");
                appManagerUrl = appManagerUrl + "/elo.webapps.AppManager";
                appManagerUrl = appManagerUrl + "/?lang=de";
                appManagerUrl = appManagerUrl + "&ticket=" + ticket;
                appManagerUrl = appManagerUrl + "&timezone=Europe%2FBerlin";
                Http.OpenUrl(appManagerUrl);
            }
            catch (byps.BException e)
            {
                if (e.Source != null)
                {
                    MessageBox.Show("Falsche Verbindungsdaten zu ELO \n" + e.Message, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    Debug.WriteLine("byps.BException message: {0}", e.Message);
                }
            }
            catch (System.Net.WebException e)
            {
                if (e.Source != null)
                {
                    MessageBox.Show("Indexserver-Verbindung ungültig \n User: "******"\n IxUrl: " + ixConf.ixUrl, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    Debug.WriteLine("System.Net.WebException message: {0}", e.Message);
                }
            }
        }
Ejemplo n.º 5
0
        public static void StartAdminConsole(KonfigurationIx ixConf)
        {
            try
            {
                IXConnFactory connFact = new IXConnFactory(ixConf.ixUrl, "Start AdminConsole", "1.0");
                IXConnection  ixConn   = connFact.Create(ixConf.user, ixConf.pwd, null, null);

                string   ticket          = ixConn.LoginResult.clientInfo.ticket;
                string   ixUrl           = ixConn.EndpointUrl;
                string[] adminConsole    = ixUrl.Split('/');
                string   adminConsoleUrl = adminConsole[0] + "//" + adminConsole[2] + "/AdminConsole";
                adminConsoleUrl = adminConsoleUrl + "/?lang=de";
                adminConsoleUrl = adminConsoleUrl + "&ticket=" + ticket;
                adminConsoleUrl = adminConsoleUrl + "&timezone=Europe%2FBerlin";
                Http.OpenUrl(adminConsoleUrl);
            }
            catch (byps.BException e)
            {
                if (e.Source != null)
                {
                    MessageBox.Show("Falsche Verbindungsdaten zu ELO \n" + e.Message, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    Debug.WriteLine("byps.BException message: {0}", e.Message);
                }
            }
            catch (System.Net.WebException e)
            {
                if (e.Source != null)
                {
                    MessageBox.Show("Indexserver-Verbindung ungültig \n User: "******"\n IxUrl: " + ixConf.ixUrl, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    Debug.WriteLine("System.Net.WebException message: {0}", e.Message);
                }
            }
        }
Ejemplo n.º 6
0
        public static void StartExportElo(string profilename, KonfigurationIx ixConf)
        {
            try
            {
                IXConnFactory connFact = new IXConnFactory(ixConf.ixUrl, "StartExportElo", "1.0");
                IXConnection  conn     = connFact.Create(ixConf.user, ixConf.pwd, null, null);
                string        winPath  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ExportElo\\" + profilename;
                if (!Directory.Exists(winPath))
                {
                    Directory.CreateDirectory(winPath);
                }

                FindChildren(conn, ixConf.arcPath, winPath, ixConf.exportReferences, ixConf.maskName);

                Debug.WriteLine("ticket=" + conn.LoginResult.clientInfo.ticket);
                conn.Logout();
            }
            catch (byps.BException e)
            {
                if (e.Source != null)
                {
                    MessageBox.Show("Falsche Verbindungsdaten zu ELO \n" + e.Message, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    Debug.WriteLine("byps.BException message: {0}", e.Message);
                }
            }
            catch (System.Net.WebException e)
            {
                if (e.Source != null)
                {
                    MessageBox.Show("Indexserver-Verbindung ungültig \n User: "******"\n IxUrl: " + ixConf.ixUrl, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    Debug.WriteLine("System.Net.WebException message: {0}", e.Message);
                }
            }
        }
Ejemplo n.º 7
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);

                Logger.instance().log("Version=" + connFact.Version);
                Logger.instance().log("ImplVersion=" + ix.ImplVersion);
                Logger.instance().log("InterfaceVersion=" + ix.InterfaceVersion);
                Logger.instance().log("ClientVersion=" + ix.ClientVersion);

                LoginResult loginResult = ix.LoginResult;

                // If successfully logged on, you can find the ticket here:
                // loginResult.clientInfo.ticket.
                Logger.instance().log("login successfully, ticket=" + loginResult.clientInfo.ticket);
                Logger.instance().log("ticket lifetime seconds=" + loginResult.ticketLifetime);
                Logger.instance().log("user ID=" + loginResult.user.id);

                // Otherwise an exception was thrown in ix.Ix.login() and you will not
                // reach this lines.

                // Use in subsequent calls always the returned ClientInfo object (contains ticket).
                // ci = ix.Login.ci


                ix.Ix.checkoutWorkflowTemplate("6439", "", WFDiagramC.mbAll, LockC.NO);
                FindWorkflowInfo findInfo = new FindWorkflowInfo();
                findInfo.type = WFTypeC.TEMPLATE;
                FindResult findResult = ix.Ix.findFirstWorkflows(findInfo, 100, WFDiagramC.mbLean);
                Logger.instance().log("wfs=" + findResult.workflows);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    ix.Dispose();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 8
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // Create a root folder based on keywording form "Email".
                // Parent is the "imaginary" archive entry with object ID = 1.
                String   parentId = "1";
                String   maskId   = "email";
                EditInfo ed       = ix.Ix.createSord(parentId, maskId, EditInfoC.mbAll);
                ed.sord.name = "New Sord";

                ViewAndEditSordDlg dlg = new ViewAndEditSordDlg();
                dlg.init(ix, ed);
                dlg.ShowDialog(null);

                // CHECKIN
                int objId = ix.Ix.checkinSord(dlg.getSord(), SordC.mbAll, LockC.NO);
                Logger.instance().log("Created sord successfully, objId=" + objId);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 9
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // Create a document
                EditInfo ed = ix.Ix.createDoc("1", null, null, EditInfoC.mbSordDoc);
                ed.sord.name     = "document with sticky notes";
                ed.document      = new Document();
                ed.document.docs = new DocVersion[1] {
                    new DocVersion()
                };
                ed.document.docs[0].ext           = "tif";
                ed.document.docs[0].pathId        = ed.sord.path;
                ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;
                ed.document = ix.Ix.checkinDocBegin(ed.document);
                ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, @"..\..\00000001.TIF");
                ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);

                Note[] notes = new Note[3];

                // Create a normal sticky note
                notes[0]      = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_NORMAL, null);
                notes[0].desc = "This is a normal sticky note";

                // Create a personal note
                notes[1]      = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_PERSONAL, null);
                notes[1].desc = "This is a personal note";

                // Create a stamp note
                notes[2]      = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_STAMP, null);
                notes[2].desc = "This is a stamp note";

                int[] noteIds = ix.Ix.checkinNotes(null, notes, NoteC.mbAll, LockC.NO);
                Logger.instance().log("noteIds=" + noteIds);
            }
            finally
            {
                ix.Logout();
            }
        }
Ejemplo n.º 10
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  conn     = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                conn     = connFact.Create(userName, userPwd, "myComputer", null);
                Logger.instance().log("login OK");

                Logger.instance().log("Check whether OCR is available...");
                bool avail = checkOcrAvail(conn);
                Logger.instance().log("OCR is available=" + avail);

                if (avail)
                {
                    String fileName = "..\\..\\sample.tif";

                    Logger.instance().log("Recognize file synchronously");
                    String text = recognizeFileSync(conn, fileName);
                    Logger.instance().log("text=" + text.Substring(0, 100) + "...");

                    // Recognize rectangle.
                    // Rectangle units are given in per thousand of document width resp. height.
                    Logger.instance().log("Recognize rect ");
                    int pmLeft = 50, pmTop = 100, pmRight = 200, pmBottom = 1000;
                    text = recognizeRect(conn, fileName, pmLeft, pmTop, pmRight, pmBottom);
                    Logger.instance().log("text=" + text.Substring(0, 100) + "...");

                    // Return character positions
                    Logger.instance().log("Recognize file return character positions");
                    recognizeFileCharPos(conn, fileName);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                if (conn != null)
                {
                    Logger.instance().log("IX logout...");
                    conn.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 11
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login ...");
                ClientInfo ci = new ClientInfo();
                ci.timeZone = "GMT+01:00"; // "Europe/Berlin";
                ix          = connFact.CreateSso(ci, Environment.MachineName);
                LoginResult loginResult = ix.LoginResult;

                // If successfully logged on, you can find the ticket here:
                // loginResult.clientInfo.ticket.
                Logger.instance().log("login successfully, ticket=" + loginResult.clientInfo.ticket);
                Logger.instance().log("ticket lifetime seconds=" + loginResult.ticketLifetime);
                Logger.instance().log("user ID=" + loginResult.user.id);

                // Otherwise an exception was thrown in ix.Ix.login() and you will not
                // reach this lines.

                // Use in subsequent calls always the returned ClientInfo object (contains ticket).
                // ci = ix.Login.ci
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 12
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                FindInfo findInfo = new FindInfo();
                findInfo.findDirect                  = new FindDirect();
                findInfo.findDirect.query            = "buch sord.type:[254 TO 255]";
                findInfo.findDirect.searchInFulltext = true;
                findInfo.findDirect.searchInIndex    = true;
                findInfo.findDirect.searchInMemo     = true;
                findInfo.findDirect.searchInSordName = true;

                FindResult findResult = ix.Ix.findFirstSords(findInfo, 100, SordC.mbAll);
                for (int i = 0; i < findResult.sords.Length; i++)
                {
                    Logger.instance().log(findResult.sords[i].name + "," + findResult.sords[i].type);
                }

                ix.Ix.findClose(findResult.searchId);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 13
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  conn     = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                conn     = connFact.Create(userName, userPwd, "myComputer", null);
                Logger.instance().log("login OK");

                Logger.instance().log("Check whether OCR is available...");
                bool avail = checkOcrAvail(conn);
                Logger.instance().log("OCR is available=" + avail);

                if (avail)
                {
                    Logger.instance().log("Query languages:");
                    OcrInfo ocrInfo = new OcrInfo();
                    ocrInfo.queryLanguages = new OcrInfoQueryLanguages();

                    // Extenal language names should be returned in this language
                    ocrInfo.messagesLanguage = OcrInfoC.MESSAGES_LANGUAGE_GERMAN;

                    OcrResult ocrResult = conn.Ix.processOcr(ocrInfo);
                    for (int i = 0; i < ocrResult.queryLanguages.externalLangs.Length; i++)
                    {
                        Logger.instance().log("external=" + ocrResult.queryLanguages.externalLangs[i]);
                        Logger.instance().log("internal=" + ocrResult.queryLanguages.internalLangs[i]);
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                if (conn != null)
                {
                    Logger.instance().log("IX logout...");
                    conn.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 14
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                SelectKeywordDlg dlg = new SelectKeywordDlg(ix);
                dlg.ShowDialog();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 15
0
        public static void ShowReportMatchUnittest(KonfigurationIx ixConf)
        {
            try
            {
                IXConnFactory connFact = new IXConnFactory(ixConf.ixUrl, "Show Report Match Unittest", "1.0");
                IXConnection  ixConn   = connFact.Create(ixConf.user, ixConf.pwd, null, null);

                List <string> jsTexts = RepoUtils.LoadTextDocs("ARCPATH[(E10E1000-E100-E100-E100-E10E10E10E00)]:/Business Solutions/_global/Unit Tests", ixConn);
                SortedDictionary <string, bool> dicRFs           = RegisterFunctions.GetRFs(ixConn, jsTexts, ixConf.package);
                SortedDictionary <string, bool> dicASDirectRules = ASDirectRules.GetRules(ixConn, jsTexts, ixConf.package);
                SortedDictionary <string, bool> dicActionDefs    = ActionDefinitions.GetActionDefs(ixConn, jsTexts, ixConf.package);

                string htmlDoc = Http.CreateHtmlReport(dicRFs, dicASDirectRules, dicActionDefs);

                string reportUrl = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ReportElo";
                if (!Directory.Exists(reportUrl))
                {
                    Directory.CreateDirectory(reportUrl);
                }

                File.WriteAllText(Path.Combine(reportUrl, "Report.html"), htmlDoc);
                reportUrl = reportUrl + "\\Report.html";
                Http.OpenUrl(reportUrl);
            }
            catch (byps.BException e)
            {
                if (e.Source != null)
                {
                    MessageBox.Show("Falsche Verbindungsdaten zu ELO \n" + e.Message, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    Debug.WriteLine("byps.BException message: {0}", e.Message);
                }
            }
            catch (System.Net.WebException e)
            {
                if (e.Source != null)
                {
                    MessageBox.Show("Indexserver-Verbindung ungültig \n User: "******"\n IxUrl: " + ixConf.ixUrl, "ELO Connection", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    Debug.WriteLine("System.Net.WebException message: {0}", e.Message);
                }
            }
        }
Ejemplo n.º 16
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  conn     = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                conn     = connFact.Create(userName, userPwd, "myComputer", null);
                Logger.instance().log("login OK");

                Logger.instance().log("Check whether OCR is available...");
                bool avail = checkOcrAvail(conn);
                Logger.instance().log("OCR is available=" + avail);

                if (avail)
                {
                    String fileName = "..\\..\\sample.tif";

                    Logger.instance().log("Recognize file asynchronously");
                    String text = recognizeFileAsync(conn, fileName, 30);
                    Logger.instance().log("text=" + text.Substring(0, 100) + "...");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                if (conn != null)
                {
                    Logger.instance().log("IX logout...");
                    conn.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 17
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix1      = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login connections...");
                ix1 = connFact.Create(userName, userPwd, "myComputer-conn1", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                EventBusWatchFolderEventsDlg dlg = new EventBusWatchFolderEventsDlg(ix1);
                dlg.ShowDialog();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix1 != null)
                {
                    Logger.instance().log("IX logout...");
                    ix1.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 18
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // Create a document
                EditInfo ed = ix.Ix.createDoc("1", null, null, EditInfoC.mbSordDoc);
                ed.sord.name     = "document with annotations";
                ed.document      = new Document();
                ed.document.docs = new DocVersion[1] {
                    new DocVersion()
                };
                ed.document.docs[0].ext           = "tif";
                ed.document.docs[0].pathId        = ed.sord.path;
                ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;
                ed.document = ix.Ix.checkinDocBegin(ed.document);
                ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, @"..\..\00000001.TIF");
                ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);

                List <Note> notes = new List <Note>();

                // -------------------------------------------------------
                // Do not use the member Note.desc for annotations because
                // it contains position and formatting information.
                // -------------------------------------------------------

                // Text on a opaque rectangle
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_NOTE_WITHFONT, null);
                    note.noteText.text = "This is an annotation with font=" + note.noteText.fontInfo.faceName;

                    note.color = NetColorToEloColor(System.Drawing.Color.RosyBrown);
                    note.noteText.fontInfo.height *= 2;
                    note.noteText.fontInfo.bold    = true;
                    note.noteText.fontInfo.italic  = true;
                    note.noteText.fontInfo.RGB     = NetColorToEloColor(System.Drawing.Color.SkyBlue);

                    note.XPos   = 100;
                    note.YPos   = 200;
                    note.width  = 1000;
                    note.height = 500;

                    notes.Add(note);
                }

                // Horizontal line
                if (true)
                {
                    Note      note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_HORIZONTAL_LINE, null);
                    PointInfo p1   = new PointInfo();
                    p1.x = 100;
                    p1.y = 750;
                    PointInfo p2 = new PointInfo();
                    p2.x = p1.x + 900;
                    p2.y = p1.y;
                    note.noteFreehand.points = new PointInfo[] { p1, p2 };

                    note.noteFreehand.width = 20; // Pen width

                    note.color = NetColorToEloColor(System.Drawing.Color.Violet);

                    notes.Add(note);
                }

                // Freehand line (this example draws a circle)
                if (true)
                {
                    Note             note   = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_FREEHAND, null);
                    List <PointInfo> points = new List <PointInfo>();
                    for (int i = 0; i < 360; i += 5)
                    {
                        double    alpha = 2 * Math.PI * (double)i / 360.0;
                        PointInfo p     = new PointInfo();
                        p.x = 200 + (int)(Math.Sin(alpha) * 100);
                        p.y = 900 + (int)(Math.Cos(alpha) * 100);
                        points.Add(p);
                    }
                    note.noteFreehand.points = points.ToArray();

                    note.noteFreehand.width = 50; // Pen width

                    note.color = NetColorToEloColor(System.Drawing.Color.Tomato);

                    notes.Add(note);
                }

                // Draws a half-transparent rectangle
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_MARKER, null);
                    note.XPos   = 400;
                    note.YPos   = 800;
                    note.width  = 300;
                    note.height = 200;
                    note.color  = NetColorToEloColor(System.Drawing.Color.YellowGreen);

                    notes.Add(note);
                }

                // Draws a filled (opaque) rectangle
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_FILLEDRECTANGLE, null);
                    note.XPos   = 800;
                    note.YPos   = 800;
                    note.width  = 300;
                    note.height = 200;
                    note.color  = NetColorToEloColor(System.Drawing.Color.YellowGreen);

                    notes.Add(note);
                }

                // Draws a strikeout line
                if (true)
                {
                    Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_STRIKEOUT, null);

                    PointInfo p1 = new PointInfo();
                    p1.x = 100;
                    p1.y = 1100;
                    PointInfo p2 = new PointInfo();
                    p2.x = p1.x + 900;
                    p2.y = p1.y;
                    note.noteFreehand.points = new PointInfo[] { p1, p2 };

                    note.noteFreehand.width          = 100;
                    note.noteFreehand.strikeoutWidth = 20;
                    note.noteFreehand.strikeoutColor = NetColorToEloColor(System.Drawing.Color.Red);

                    note.color = NetColorToEloColor(System.Drawing.Color.Yellow);

                    notes.Add(note);
                }


                int[] noteIds = ix.Ix.checkinNotes(null, notes.ToArray(), NoteC.mbAll, LockC.NO);
                Logger.instance().log("noteIds=" + noteIds);
            }
            finally
            {
                ix.Logout();
            }
        }
Ejemplo n.º 19
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // 1. Create archive hirarchie

                // root folder
                Sord sordRoot = ix.Ix.createSord("1", null, EditInfoC.mbSord).sord;
                sordRoot.name = "C# example FindFirstFindNext";
                sordRoot.id   = ix.Ix.checkinSord(sordRoot, SordC.mbAll, LockC.NO);

                // create sords
                Logger.instance().log("create sords...");
                for (int i = 0; i < nbOfChildren; i++)
                {
                    String namePrefix = "" + i;
                    while (namePrefix.Length < 4)
                    {
                        namePrefix = "0" + namePrefix;
                    }
                    Sord sord = ix.Ix.createSord(sordRoot.guid, null, EditInfoC.mbSord).sord;
                    sord.name = namePrefix + "-o-" + namePrefix;
                    sord.id   = ix.Ix.checkinSord(sord, SordC.mbAll, LockC.NO);
                }
                Logger.instance().log("create sords OK");

                // 2. List hirarchie
                Logger.instance().log("find...");

                // Prepare FindInfo object
                FindInfo findInfo = new FindInfo();
                findInfo.findChildren          = new EloixClient.IndexServer.FindChildren();
                findInfo.findChildren.parentId = sordRoot.guid;

                // find
                FindResult findResult = ix.Ix.findFirstSords(findInfo, 1000, SordC.mbAll);
                Logger.instance().log("found #=" + findResult.sords.Length);
                for (int i = 0; i < findResult.sords.Length; i++)
                {
                    Logger.instance().log("sord.id=" + findResult.sords[i].id + ", sord.name=" + findResult.sords[i].name);
                }
                ix.Ix.findClose(findResult.searchId);
                Logger.instance().log("find OK");

                bool cleanUp = true;
                if (cleanUp)
                {
                    Logger.instance().log("clean up...");
                    DeleteOptions delOpts = new DeleteOptions();
                    delOpts.deleteFinally = true;
                    ix.Ix.deleteSord(null, sordRoot.guid, LockC.NO, null);
                    ix.Ix.deleteSord(null, sordRoot.guid, LockC.NO, delOpts);
                    Logger.instance().log("clean up OK");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 20
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix1      = null;
            IXConnection  ix2      = null;

            // generate an event type that is most likely only used by me.
            myEventType = computeMyEventType();

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // LOGIN
                Logger.instance().log("login connections...");
                ix1 = connFact.Create(userName, userPwd, "myComputer-conn1", null);
                ix2 = connFact.Create(userName, userPwd, "myComputer-conn2", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // Add event bus handlers.
                // This handlers are called for the received events from a background thread.
                // Thus we cannot update the user interfache in this threads directly.
                // The handlers will add the received events to the list receivedMessages and
                // the items of the list are printed from the main thread.
                ix1.EventBusApi.EventBusHandler += new EventBusApi.ProcessEventBusEvents(EventBusApi_EventBusHandler1);
                ix2.EventBusApi.EventBusHandler += new EventBusApi.ProcessEventBusEvents(EventBusApi_EventBusHandler2);

                // Add listeners to our private event.
                ix1.EventBusApi.BroadcastBus.AddListener(myEventType);
                ix2.EventBusApi.BroadcastBus.AddListener(myEventType);

                Logger.instance().log("conn1.subsId=" + ix1.EventBusApi.SubscriberId);
                Logger.instance().log("conn2.subsId=" + ix2.EventBusApi.SubscriberId);

                // Each connection sends 3 events to the other connection.
                // Here, the event data is a simple string. But it could be a Sord e.g. too.
                Logger.instance().log("send events");
                for (int i = 0; i < 3; i++)
                {
                    EventBusApi.Bus bbus1 = ix1.EventBusApi.BroadcastBus;
                    bbus1.Send(myEventType, "Hello conn2 - " + i);

                    EventBusApi.Bus bbus2 = ix2.EventBusApi.BroadcastBus;
                    bbus2.Send(myEventType, "Hello conn1 - " + i);
                }

                // Wait for the events and print them.
                Logger.instance().log("wait 1");
                Thread.Sleep(1 * 1000);

                // Print received messages
                Logger.instance().log("received:");
                foreach (String s in receivedMessages)
                {
                    Logger.instance().log(s);
                }

                if (receivedMessages.Count != 6)
                {
                    Logger.instance().log("Error: 6 events should have been received");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix1 != null && ix2 != null)
                {
                    Logger.instance().log("IX logout...");
                    ix1.Logout();
                    ix2.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 21
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                Logger.instance().log("get nodes...");
                FindTasksInfo findInfo = new FindTasksInfo();
                findInfo.inclWorkflows = true;
                FindResult findResult = ix.Ix.findFirstTasks(findInfo, 10);

                int idx = 0;
                while (true)
                {
                    Logger.instance().log("#nodes=" + findResult.tasks.Length);
                    for (int i = 0; i < findResult.tasks.Length; i++)
                    {
                        WFCollectNode node = findResult.tasks[i].wfNode;
                        Logger.instance().log("name=" + node.nodeName);
                        Logger.instance().log("  flowId=" + node.nodeId + ", nodeId=" + node.nodeId);
                        Logger.instance().log("  objId=" + node.objId + ", userId=" + node.userId);
                    }

                    if (!findResult.moreResults)
                    {
                        break;
                    }

                    idx       += findResult.tasks.Length;
                    findResult = ix.Ix.findNextTasks(findResult.searchId, idx, 10);
                }

                Logger.instance().log("get nodes OK");
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Constructor using initial values from the given property maps.
 /// </summary>
 /// <param name="props">
 /// Connection properties. Possible properties are PROP_* in FWConnFactory and IXConnFactory.
 /// </param>
 /// <param name="sessOpts">Session options. See class SessionOptionsC for possible values.</param>
 public FWConnFactory(IXProperties props, IXProperties sessOpts)
     : base(props, sessOpts)
 {
     innerFact = new IXConnFactory(props, sessOpts);
 }
Ejemplo n.º 23
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // 1. Create archive structure
                Logger.instance().log("create structure...");

                // create root folder s1
                EditInfo ed = ix.Ix.createSord("1", "0", EditInfoC.mbAll);
                Sord     s1 = ed.sord;
                s1.name = "s1 C# example FindByIndexValues";
                s1.id   = ix.Ix.checkinSord(s1, SordC.mbAll, LockC.NO);

                ///     d1, name=The Inner Circle,		AUTHOR=T. Coraghessan Boyle,	PRICE=039
                ///     d2  name=The Shifting Tide,		AUTHOR=Anne Perry,				PRICE=037
                ///     d3  name=Feel,					AUTHOR=Robbie Williams,			PRICE=142
                ///     d4	name=The Da Vinci Code,     AUTHOR=Dan Brown,				PRICE=032
                ///
                Sord d1 = internalCreateBook(ix, CONST, s1.guid, "The Inner Circle", "T. Coraghessan Boyle", "039");
                Sord d2 = internalCreateBook(ix, CONST, s1.guid, "The Shifting Tide", "Anne Perry", "037");
                Sord d3 = internalCreateBook(ix, CONST, s1.guid, "Feel", "Robbie Williams", "142");
                Sord d4 = internalCreateBook(ix, CONST, s1.guid, "The Da Vinci Code", "Dan Brown", "032");

                Logger.instance().log("create structure OK");

                // 2. Find books from Authors with names from "A" to "J"
                internalFindBooks(ix, CONST, s1.guid, "A* ... J*", "");
                // Finds: The Da Vinci Code,The Shifting Tide

                // 3. Find books from Authors with names from "J"
                internalFindBooks(ix, CONST, s1.guid, "J*...*", "");
                // Finds: Feel,The Inner Circle

                // 4. Find books from Authors with names from "J" and price higher than 100
                internalFindBooks(ix, CONST, s1.guid, "J*...", "100...*");
                // Finds: Feel

                bool cleanUp = true;
                if (cleanUp)
                {
                    Logger.instance().log("clean up...");
                    ix.Ix.deleteSord(null, s1.guid, LockC.NO, null);
                    Logger.instance().log("clean up OK");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 24
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // Create a Sord object to generate some report information
                Logger.instance().log("create sord...");
                Sord sord = ix.Ix.createSord("1", null, EditInfoC.mbSord).sord;
                sord.name = "C# Example Report";
                sord.id   = ix.Ix.checkinSord(sord, SordC.mbLean, LockC.NO);
                Logger.instance().log("create sord OK");

                // Wait some seconds. Report information is wirtten with a little
                // time delay after the action was taken.
                Logger.instance().log("sleep two seconds ...");
                System.Threading.Thread.Sleep(2000);
                Logger.instance().log("sleep two seconds OK");

                // Find report entries to sord
                Logger.instance().log("find report...");
                FindReportInfo findReport = new FindReportInfo();
                findReport.objId = sord.guid;
                FindResult findResult = ix.Ix.findFirstReportInfos(findReport, 10);

                int idx = 0;
                while (true)
                {
                    ReportInfo[] rinfos = findResult.reportInfos;
                    Logger.instance().log("find report OK, #infos=" + rinfos.Length);

                    // Dump report information.
                    // There could be more information since already deleted sord objects
                    // could have had the same ID.
                    for (int i = 0; i < rinfos.Length; i++)
                    {
                        Logger.instance().log("  action=" + rinfos[i].action);
                        Logger.instance().log("    time=" + rinfos[i].actTimeISO);
                        Logger.instance().log("    user="******"    text=" + rinfos[i].text);
                    }

                    if (!findResult.moreResults)
                    {
                        break;
                    }

                    idx       += rinfos.Length;
                    findResult = ix.Ix.findNextReportInfos(findResult.searchId, idx, 10);
                }

                DeleteOptions delOpts = new DeleteOptions();
                delOpts.deleteFinally = true;
                ix.Ix.deleteSord(null, sord.guid, LockC.NO, null);
                ix.Ix.deleteSord(null, sord.guid, LockC.NO, delOpts);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 25
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // 1. Create sord for document without version

                // Initialize Sord object
                EditInfo ed = ix.Ix.createDoc("1", "0", null, EditInfoC.mbSordDocAtt);
                ed.sord.name = "C# example CheckinAttachment";

                // Create attachment file
                String attFile = internalCreateTestFile("CheckinNewAttachment attachment file", "txt");

                // Supply the extension of the document
                ed.document.atts           = new DocVersion[1];
                ed.document.atts[0]        = new DocVersion();
                ed.document.atts[0].ext    = ix.GetFileExt(attFile);
                ed.document.atts[0].pathId = ed.sord.path;
                // ed.document.atts[0].encryptionSet = ignored

                // CheckinDocBegin: let IndexServer generate an URL to upload the document
                ed.document = ix.Ix.checkinDocBegin(ed.document);
                Logger.instance().log("prepared upload URL=" + ed.document.atts[0].url + ", att-guid=" + ed.document.atts[0].guid);

                // Upload the document
                String uploadResult = ix.Upload(ed.document.atts[0].url, attFile);
                ed.document.atts[0].uploadResult = uploadResult;
                Logger.instance().log("upload succeeded");
                System.IO.File.Delete(attFile);

                // CheckinDocEnd: uploadResult contains the document information from ELODM.
                // Pass this information to
                ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);
                Logger.instance().log("inserted document:");
                Logger.instance().log("  objId=" + ed.document.objId);
                Logger.instance().log("  attId=" + ed.document.atts[0].id);
                Logger.instance().log("  att-guid=" + ed.document.atts[0].guid);
                Logger.instance().log("  URL=" + ed.document.atts[0].url);

                // 2. Checkout and show document
                ed = ix.Ix.checkoutDoc(ed.sord.guid, null, EditInfoC.mbAll, LockC.NO);
                String tempName2 = internalMakeTempFileName(ed.document.atts[0].ext);
                ix.Download(ed.document.atts[0].url, tempName2);

                // Uncomment this to show document in notepad:
                // System.Diagnostics.Process.Start("notepad.exe", tempName2);
                // System.Threading.Thread.Sleep(3000);

                System.IO.File.Delete(tempName2);

                bool cleanUp = true;
                if (cleanUp)
                {
                    // Delete Document
                    DeleteOptions delOpts = new DeleteOptions();
                    delOpts.deleteFinally = true;
                    ix.Ix.deleteSord(null, ed.sord.guid, LockC.NO, null);
                    ix.Ix.deleteSord(null, ed.sord.guid, LockC.NO, delOpts);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 26
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // Example for initializing an encryption set with a new internal password.
                // If you uncomment this lines, aready encrypted documents of this encryption set
                // cannot be decrypted anymore since the internal key is lost!
                // Logger.instance().log("init encryption set ...");
                //initializeNewEncryptionSet(ix, CONST, 13, "CS-TEST", encryptionPassword);
                // Logger.instance().log("init encryption set OK");

                // checkin example document and encrypt it
                string objId = checkinDocEncrypted(ix, CONST);

                // checkout example document
                checkoutDocDecryptedUsingSessionOption(ix, CONST, objId);

                // checkout example document
                checkoutDocDecryptedUsingUrlExt(ix, CONST, objId);

                bool cleanUp = true;
                if (cleanUp)
                {
                    // Delete Document
                    DeleteOptions delOpts = new DeleteOptions();
                    delOpts.deleteFinally = true;
                    ix.Ix.deleteSord(null, objId, LockC.NO, null);
                    ix.Ix.deleteSord(null, objId, LockC.NO, delOpts);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 27
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                connFact = new IXConnFactory(url, "IX-Examples", "1.0");
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // Create a root folder based on keywording form "Basic entry".
                // Parent is the "imaginary" archive entry with object ID = 1.
                String   parentId = "1";
                String   maskId   = "";
                EditInfo editInfo = ix.Ix.createSord(parentId, maskId, EditInfoC.mbSord);

                Logger.instance().log("created sord, GUID=" + editInfo.sord.guid);
                Logger.instance().log("name=" + editInfo.sord.name + ", #objKeys=" + editInfo.sord.objKeys.Length);

                // Change the storage mask to "Email"
                editInfo.sord.name = "C# change mask";                 // to show, that attributes are not changed in changeSordMask
                editInfo           = ix.Ix.changeSordMask(editInfo.sord, "Email", EditInfoC.mbSord);

                Logger.instance().log("created sord, GUID=" + editInfo.sord.guid + ", objId=" + editInfo.sord.id);
                Logger.instance().log("name=" + editInfo.sord.name + ", #objKeys=" + editInfo.sord.objKeys.Length);

                // Hint: The Sord object was not saved, neither by createSord nor changeSordMask.
                //       You have to call checkinSord to save it to the database.
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 28
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // get templates
                Logger.instance().log("get workflow templates...");
                IdName[] idNames = ix.Ix.collectWorkFlows(WFTypeC.TEMPLATE);
                Logger.instance().log("  #workflows=" + idNames.Length);
                for (int i = 0; i < idNames.Length; i++)
                {
                    Logger.instance().log("  id=" + idNames[i].id + ", name=" + idNames[i].name);
                }
                Logger.instance().log("get workflow templates OK");

                // get active workflows
                Logger.instance().log("get active workflows...");
                idNames = ix.Ix.collectWorkFlows(WFTypeC.ACTIVE);
                Logger.instance().log("  #workflows=" + idNames.Length);
                for (int i = 0; i < idNames.Length; i++)
                {
                    Logger.instance().log("  id=" + idNames[i].id + ", name=" + idNames[i].name);
                }
                Logger.instance().log("get active workflows OK");

                // get finished workflows
                Logger.instance().log("get finished workflows...");
                idNames = ix.Ix.collectWorkFlows(WFTypeC.FINISHED);
                Logger.instance().log("  #workflows=" + idNames.Length);
                for (int i = 0; i < idNames.Length; i++)
                {
                    Logger.instance().log("  id=" + idNames[i].id + ", name=" + idNames[i].name);
                }
                Logger.instance().log("get finished workflows OK");
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 29
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // Create a root folder
                Sord e1 = ix.Ix.createSord("1", "0", EditInfoC.mbSord).sord;
                e1.name = "e1";
                e1.id   = ix.Ix.checkinSord(e1, SordC.mbAll, LockC.NO);
                Logger.instance().log("created e1: id=" + e1.id);

                // Create 100 Sords
                String[] guids = new String[nbOfDocs];

                long diffTicks = 0;
                for (int i = 0; i < nbOfDocs; i++)
                {
                    // Initialize a EditInfo object
                    long     t1 = System.DateTime.Now.Ticks;
                    EditInfo ed = ix.Ix.createDoc(e1.guid, "Email", null, EditInfoC.mbSordDocAtt);
                    long     t2 = System.DateTime.Now.Ticks;
                    diffTicks += (t2 - t1);

                    // Add some index attributes
                    ed.sord.name = "e1." + i;
                    for (int idx = 0; idx < ed.sord.objKeys.Length; idx++)
                    {
                        ed.sord.objKeys[idx].data = new String[] { ed.sord.name + ".idx" + idx };
                    }

                    // Create a file
                    String docFile = internalCreateTestFile("DocPerformance " + ed.sord.name, "txt");

                    // checkinDocBegin
                    ed.document.docs                  = new DocVersion[1];
                    ed.document.docs[0]               = new DocVersion();
                    ed.document.docs[0].ext           = ix.GetFileExt(docFile);
                    ed.document.docs[0].pathId        = ed.sord.path;
                    ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet;
                    ed.document = ix.Ix.checkinDocBegin(ed.document);

                    // upload
                    t1 = System.DateTime.Now.Ticks;
                    ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, docFile);
                    t2         = System.DateTime.Now.Ticks;
                    diffTicks += (t2 - t1);

                    // checkinDocEnd
                    t1          = System.DateTime.Now.Ticks;
                    ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO);
                    t2          = System.DateTime.Now.Ticks;
                    diffTicks  += (t2 - t1);

                    guids[i] = ed.sord.guid;
                    if ((i + 1) % 20 == 0)
                    {
                        Logger.instance().log("create: " + (i + 1) + "/" + nbOfDocs);
                    }

                    System.IO.File.Delete(docFile);
                }

                // Log time values
                logTimeValues("create", diffTicks, nbOfDocs);

                // 2. Read 100 Documents
                diffTicks = 0;
                for (int i = 0; i < nbOfDocs; i++)
                {
                    // checkoutDoc
                    long     t1 = System.DateTime.Now.Ticks;
                    EditInfo ed = ix.Ix.checkoutDoc(guids[i], null, EditInfoC.mbSordDocAtt, LockC.NO);

                    // download
                    String docFile = internalMakeTempFileName(ed.document.docs[0].ext);
                    ix.Download(ed.document.docs[0].url, docFile);
                    long t2 = System.DateTime.Now.Ticks;
                    diffTicks += (t2 - t1);

                    System.IO.FileInfo fi = new System.IO.FileInfo(docFile);
                    if (fi.Length < fileSize)
                    {
                        throw new InvalidOperationException("download failed");
                    }

                    if ((i + 1) % 20 == 0)
                    {
                        Logger.instance().log("read: " + (i + 1) + "/" + nbOfDocs);
                    }

                    System.IO.File.Delete(docFile);
                }

                // Log time values
                logTimeValues("read", diffTicks, nbOfDocs);

                // 3. Delete root folder logically (implicitly deletes the 100 included Sords)
                Logger.instance().log("delete logically...");
                DateTime startTime = System.DateTime.Now;
                ix.Ix.deleteSord(null, e1.guid, LockC.NO, null);
                DateTime endTime = System.DateTime.Now;
                logTimeValues("delete logically", startTime, endTime, nbOfDocs);

                // 4. Delete root folder finally (implicitly deletes the 100 included Sords)
                Logger.instance().log("delete finally...");
                startTime = System.DateTime.Now;
                DeleteOptions delOpts = new DeleteOptions();
                delOpts.deleteFinally = true;
                ix.Ix.deleteSord(null, e1.guid, LockC.NO, delOpts);
                endTime = System.DateTime.Now;
                logTimeValues("delete finally", startTime, endTime, nbOfDocs);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 30
0
        public void run()
        {
            IXConnFactory connFact = null;
            IXConnection  ix       = null;

            try
            {
                IXProperties connProps = IXConnFactory.CreateConnProperties(url);
                IXProperties sessOpts  = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
                connFact = new IXConnFactory(connProps, sessOpts);
                Logger.instance().log("create IXConnFactory OK");

                // Prepare ClientInfo object with language and country
                // ClientInfo ci = new ClientInfo();
                // ci.language = "de";
                // ci.country = "DE";

                // LOGIN
                Logger.instance().log("login...");
                ix = connFact.Create(userName, userPwd, "myComputer", null);
                // ci = ix.Login.ci
                Logger.instance().log("login OK");

                // get constants
                Logger.instance().log("get const...");
                IXServicePortC CONST = ix.CONST;
                Logger.instance().log("get const OK");

                // lock key data
                // This is optional since checkinKeys and
                // deleteKeys check the lock too.
                Logger.instance().log("lock key data...");
                ix.Ix.checkoutKeys(null, LockC.YES);
                Logger.instance().log("lock key data OK");

                // create key
                // - be aware to set KeyInfo.id = -1 to create a new key!
                Logger.instance().log("create key...");
                KeyInfo ki = new KeyInfo();
                ki.id   = -1;
                ki.name = "C# Example Key";
                ki.id   = ix.Ix.checkinKeys(new KeyInfo[] { ki }, LockC.NO)[0];
                Logger.instance().log("create key OK, name=" + ki.name + ", id=" + ki.id);

                // delete key and unlock
                Logger.instance().log("delete key...");
                ix.Ix.deleteKeys(new String[] { ki.name }, LockC.YES);
                Logger.instance().log("delete key OK");
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Logout
                // --
                if (ix != null)
                {
                    Logger.instance().log("IX logout...");
                    ix.Logout();
                    Logger.instance().log("IX logout OK");
                }
            }
        }
Ejemplo n.º 31
0
        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)));
                }
            }
        }