Exemplo n.º 1
0
        static void Main(string[] args)
        {
            ttsoapcgi mySoap = new ttsoapcgi();

            //Test
            mySoap.Url = "http://localhost/Scripts/ttsoapcgi.exe";
            CProject[] aproject = mySoap.getProjectList("administrator", "");

            long LSession = mySoap.ProjectLogon(aproject[0], "administrator", "");
        }
Exemplo n.º 2
0
        /// <summary>
        /// The connect to project.
        /// </summary>
        /// <param name="ttSOAPURL">
        /// The tt soapurl.
        /// </param>
        /// <param name="ttProject">
        /// The tt project.
        /// </param>
        /// <param name="ttUserName">
        /// The tt user name.
        /// </param>
        /// <param name="ttUserPass">
        /// The tt user pass.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        /// <exception cref="Exception">
        /// </exception>
        public bool ConnectToProject(string ttSOAPURL, string ttProject, string ttUserName, string ttUserPass)
        {
            if (ttProject == string.Empty)
            {
                throw new Exception("You need to select a project to connect to");
            }

            try
            {
                if (this.ttSOAP == null)
                {
                    this.ttSOAP = new ttsoapcgi(ttSOAPURL);
                }

                if (this.ttCookie > 0)
                {
                    this.ttSOAP.DatabaseLogoff(this.ttCookie);
                    this.ttCookie = 0;
                }

                if (string.IsNullOrEmpty(ttUserName))
                {
                    this.ttCookie = this.ttSOAP.DatabaseLogon(ttProject, "viewer", "viewer");
                }
                else
                {
                    this.ttCookie = this.ttSOAP.DatabaseLogon(ttProject, ttUserName, ttUserPass);
                }


                if (this.ttCookie == 0)
                {
                    throw new Exception("Unknown error.");
                }
            }
            catch (Exception fcc)
            {
                throw new Exception("Unable to connect to Soap Server or Project.\n" + fcc.Message, fcc);
            }

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// The get project list.
        /// </summary>
        /// <param name="ttSOAPURL">
        /// The tt soapurl.
        /// </param>
        /// <returns>
        /// The <see cref="List"/>.
        /// </returns>
        public List <string> GetProjectList(string ttSOAPURL)
        {
            var result = new List <string>();

            if (this.ttSOAP == null)
            {
                this.ttSOAP = new ttsoapcgi(ttSOAPURL);
            }

            CDatabase[] dbList = this.ttSOAP.getDatabaseList();
            if (dbList != null)
            {
                foreach (CDatabase db in dbList)
                {
                    result.Add(db.name);
                }
            }

            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        ///     The close.
        /// </summary>
        public void Close()
        {
            if (this.ttCookie > 0)
            {
                try
                {
                    if (this.ttSOAP != null)
                    {
                        this.ttSOAP.DatabaseLogoff(this.ttCookie);
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("Error during logging off from TT: " + ex);
                }
                finally
                {
                    this.ttSOAP = null;
                }

                this.ttCookie = 0;
            }
        }