Esempio n. 1
0
        public void searchbyid(string id)
        {
            //User.ADBK adbk;
            IRISObject adbk;

            try
            {
                //adbk = User.ADBK.OpenId(adbksrc.conn, id);
                adbk = (IRISObject)iris.ClassMethodObject("User.ADBK", "%OpenId", id);


                if (adbk == null)
                {
                    MessageBox.Show("インスタンスオープンエラー idが存在しません");
                    return;
                }

                newflag = false;
                updatedatamodel(adbk);
                //adbk.Close();
                adbk.Dispose();
            }
            catch (Exception err)
            {
                MessageBox.Show("インスタンスオープンエラー " + err.Message);
            }
        }
 public cacheDirectWapper(string constr)
 {
     try
     {
         conn.ConnectionString = constr;
         conn.Open();
         IRIS iris = IRIS.CreateIRIS(conn);
         cd = (IRISObject)iris.ClassMethodObject("CacheDirect.Emulator", "%New");
     }
     finally
     {
     }
 }
        public cacheDirectWapper(IRISConnection irisconn)
        {
            try
            {

                conn = irisconn;
                iris = IRIS.CreateIRIS(conn);
                cd = (IRISObject)iris.ClassMethodObject("CacheDirect.Emulator", "%New");

            }
            finally
            {
            }
        }
        private void btnUpload_Click(object sender, EventArgs e)
        {
            string filename   = System.IO.Path.GetFileName(txtFilename.Text);
            string serverpath = Path.Combine(txtServerDir.Text, filename);

            txtLog.AppendText("\r\n");
            txtLog.AppendText("Uploading '" + txtFilename.Text + "' to Server as '" + serverpath + "'");

            ///Get Server FileStream: Reverse Proxy Object
            ///https://docs.intersystems.com/irislatest/csp/docbook/Doc.View.cls?KEY=BNETNAT_gateway
            IRISObject fileStr = (IRISObject)irisNativeCn.ClassMethodObject("%Stream.FileBinary", "%New");

            fileStr.InvokeIRISStatusCode("LinkToFile", serverpath);

            ///Open Local Stream
            FileStream fs = File.OpenRead(txtFilename.Text);

            byte[] buf = new byte[1024];
            int    c;

            while ((c = fs.Read(buf, 0, buf.Length)) > 0)
            {
                if (c == buf.Length)
                {
                    fileStr.InvokeIRISStatusCode("Write", buf);
                }
                else
                {
                    byte[] endbuf = new byte[c];
                    Array.Copy(buf, endbuf, c);
                    fileStr.InvokeIRISStatusCode("Write", endbuf);
                }
                //Console.WriteLine(Encoding.UTF8.GetString(buf, 0, c));
            }
            fileStr.InvokeIRISStatusCode("%Save");
            fileStr.InvokeIRISStatusCode("%Close");
            txtLog.AppendText("\r\nFinished uploading " + fs.Length + " bytes to " + fileStr.Get("Size"));
        }
Esempio n. 5
0
        public override object OnProcessInput(object messageInput)
        {
            bool atEnd = false;

            while (atEnd is false)
            {
                ConsumeResult <Ignore, string> message = consumer.Consume(1000);
                if (message is null)
                {
                    atEnd = true;
                }
                else
                {
                    string text = message.Message.Value;
                    foreach (string target in targets)
                    {
                        IRISObject request = (IRISObject)iris.ClassMethodObject("Ens.StringContainer", "%New", text);
                        SendRequestAsync(target, request);
                    }
                }
            }
            return(null);
        }
Esempio n. 6
0
    public static void Main(String[] args)
    {
        try
        {
            // open connection to InterSystems IRIS instance using connection string
            IRISConnection conn = new IRISConnection();

            // edit this ConnectionString to match your environment
            conn.ConnectionString = "Server=localhost; Port=1972; Namespace=User; Password=SYS; User ID=_system; SharedMemory=false; logfile=./dbnative.log";
            conn.Open();


            // create IRIS Native object
            IRIS iris = IRIS.CreateIRIS(conn);

            Console.WriteLine("[1. Setting and getting a global]");

            // setting and getting a global
            // ObjectScript equivalent: set ^testglobal("1") = 8888
            iris.Set(8888, "^testglobal", "1");

            // ObjectScript equivalent: set globalValue = $get(^testglobal("1"))
            Int16?globalValue = iris.GetInt16("^testglobal", "1");

            Console.WriteLine("The value of ^testglobal(1) is " + globalValue);
            Console.WriteLine();


            Console.WriteLine("[2. Iterating over a global]");

            // modify global to iterate over
            // ObjectScript equivalent: set ^testglobal("1") = 8888
            // ObjectScript equivalent: set ^testglobal("2") = 9999
            iris.Set(8888, "^testglobal", "1");
            iris.Set(9999, "^testglobal", "2");

            // iterate over all nodes forwards
            Console.WriteLine("walk forwards");
            IRISIterator subscriptIter = iris.GetIRISIterator("^testglobal");
            foreach (var node in subscriptIter)
            {
                Console.WriteLine("subscript=" + subscriptIter.CurrentSubscript + ", value=" + node);
            }
            Console.WriteLine();


            Console.WriteLine("[3. Calling a class method]");

            // calling a class method
            // ObjectScript equivalent: set returnValue = ##class(%Library.Utility).Date(5)
            String returnValue = iris.ClassMethodString("%Library.Utility", "Date", 5);
            Console.WriteLine(returnValue);

            Console.WriteLine();

            IRISReference freeMB = new IRISReference(0);                // set inital value to 0
            String        dir    = "C:/InterSystems/IRIS/mgr/iristemp"; // directory to be tested
            Object        status = null;

            Console.Write("\n\nCalling %SYS.DatabaseQuery.GetDatabaseFreeSpace()... ");
            status = iris.ClassMethodObject("%SYS.DatabaseQuery", "GetDatabaseFreeSpace", dir, freeMB);
            Console.WriteLine("\nFree space in " + dir + " = " + freeMB.value + "MB");

            // close IRIS object and connection
            iris.Close();
            conn.Close();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }