//=================================================================
        // Get User Information
        //=================================================================
        public project_info_response_v1 getProjectInfo(string projectID)
        {
            string timestamp = getUNIXEpochTimestamp().ToString();
            string callArgs  = "";

            callArgs += "&company_id=" + HttpUtility.UrlEncode(BIM360SDKDeveloperConfig.BIM360GLUESDK_COMPANY_ID);
            callArgs += "&api_key=" + HttpUtility.UrlEncode(BIM360SDKDeveloperConfig.BIM360GLUESDK_API_KEY);
            callArgs += "&auth_token=" + HttpUtility.UrlEncode(auth_token);
            callArgs += "&timestamp=" + HttpUtility.UrlEncode(timestamp);
            callArgs += "&sig=" + HttpUtility.UrlEncode(generateAPISignature(timestamp));
            callArgs += "&project_id=" + projectID;
            callArgs += "&pretty=1";

            makeHTTPCall("project/v1/info", callArgs, "GET", "");
            project_info_response_v1 tJSON = null;

            if (this.statusCode == HttpStatusCode.OK)
            {
                if (this.responseBody != "")
                {
                    JavaScriptSerializer jSer = new JavaScriptSerializer();
                    tJSON = jSer.Deserialize <project_info_response_v1>(this.responseBody);
                }
            }

            return(tJSON);
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BIM360WebServiceAPI apiObj = new BIM360WebServiceAPI(Request);

            // If no logged on, just redirect to the home page
            if (!apiObj.userLoggedIn)
            {
                string redirURL = BIM360WebServiceAPI.GetBaseURL() + "/default.aspx";
                Response.Redirect(redirURL);
            }

            // Get the Project ID from the URL.. if not valid, just display message
            string projectID = Request.Params["id"];

            if (projectID == "")
            {
                this.page_header.InnerHtml = "<h1>Invalid Project ID</b>: [" + projectID + "]</h1>";
                return;
            }

            project_info_response_v1 tProj = apiObj.getProjectInfo(projectID);

            if (tProj != null)
            {
                string tHead = "<h1>Project: " + HttpUtility.UrlDecode(tProj.project_name) + " [ID=" + projectID + "]</h1>";
                this.page_header.InnerHtml = tHead;

                string tHead2 = "<b>Project Created: </b>" + tProj.created_date + " <b>Roster Count: </b>" + tProj.project_roster.Count();
                tHead2 += " <a class=\"roster_link\" id=\"roster_link\" href=\"javascript:void();\" onClick=\"viewProjectRoster('" + projectID + "');\">(View Roster)</a>";
                this.page_sub_header.InnerHtml = tHead2;
            }
            else
            {
                this.page_header.InnerHtml = "<h1>Project: [ID=" + projectID + "]</h1>";
            }

            string tJS = "";

            tJS += "<script>";
            tJS += "loadProjectTree(\"" + projectID + "\");";
            tJS += "</script>";
            this.page_contents.InnerHtml = tJS;
        }
        public string getProjectTreeView(string projectID)
        {
            project_info_response_v1 tProj = getProjectInfo(projectID);

            if (tProj == null)
            {
                return("[]");
            }

            tree_node[] newTree = processTreeNode(tProj.folder_tree);
            if (newTree == null)
            {
                return("[]");
            }
            else
            {
                return(serializeToJSON(newTree));
            }
        }
Esempio n. 4
0
        static public string ajax_GetProjectRoster()
        {
            string              buildHTML = "";
            HttpRequest         aRequest  = HttpContext.Current.Request;
            BIM360WebServiceAPI apiObj    = new BIM360WebServiceAPI(aRequest);

            // If no logged on, just redirect to the home page
            if (!apiObj.userLoggedIn)
            {
                return("<b>Unauthorized: Please login to continue</b>");
            }

            // Get the ID
            string projectID = aRequest.Params["id"];

            // Get the model info...
            project_info_response_v1 tProj = apiObj.getProjectInfo(projectID);

            if ((tProj == null) || (tProj.project_roster == null))
            {
                return("<b>Roster Not Found</b>");
            }

            buildHTML += "<center>";
            buildHTML += "<table width=500 style=\"border: 1px solid #CCCCCC;\">";
            buildHTML += "<tr bgcolor=\"#CCCCCC\">";
            buildHTML += "<td><b>Login Name</b></td>";
            buildHTML += "<td><b>Date Added</b></td>";
            buildHTML += "</tr>";

            foreach (user_info_response_v1 tUser in tProj.project_roster)
            {
                buildHTML += addRow(tUser.login_name, tUser.created_date);
            }

            buildHTML += "</table>";

            return(buildHTML);
        }