Beispiel #1
0
        static public string ajax_GetModelInfo()
        {
            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 modelID = aRequest.Params["id"];

            // Get the model info...
            model_info_response_v1 tModel = apiObj.getModelInfo(modelID);

            if (tModel == null)
            {
                return("<b>Model Not Found</b>");
            }

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

            buildHTML += addRow("company_id", tModel.company_id);
            buildHTML += addRow("project_id", tModel.project_id);
            buildHTML += addRow("model_name", tModel.model_name);
            buildHTML += addRow("model_id", tModel.model_id);
            buildHTML += addRow("model_version", tModel.model_version.ToString());
            buildHTML += addRow("model_version_id", tModel.model_version_id);
            buildHTML += addRow("is_merged_model", tModel.is_merged_model.ToString());
            buildHTML += addRow("action_id", tModel.action_id);
            buildHTML += addRow("created_by", tModel.created_by);
            buildHTML += addRow("created_date", tModel.created_date);
            buildHTML += addRow("modified_by", tModel.modified_by);
            buildHTML += addRow("modified_date", tModel.modified_date);
            buildHTML += addRow("parent_folder_id", tModel.parent_folder_id);
            buildHTML += addRow("file_parsed_status", tModel.file_parsed_status.ToString());

            // Build the URL to view the model
            string timestamp = BIM360WebServiceAPI.getUNIXEpochTimestamp().ToString();
            string tURL      = "";

            tURL += BIM360SDKDeveloperConfig.GLUE_VIEWER_BASE_URL;

            // Add question mark if needed
            if (tURL.Substring(tURL.Length - 1) != "?")
            {
                tURL += "?";
            }

            tURL      += "<br/>company_id=" + BIM360SDKDeveloperConfig.BIM360GLUESDK_COMPANY_ID;
            tURL      += "<br/>&amp;api_key=" + BIM360SDKDeveloperConfig.BIM360GLUESDK_API_KEY;
            tURL      += "<br/>&amp;auth_token=" + apiObj.auth_token;
            tURL      += "<br/>&amp;timestamp=" + timestamp;
            tURL      += "<br/>&amp;sig=" + BIM360WebServiceAPI.generateAPISignature(timestamp);
            tURL      += "<br/>&amp;action_id=" + tModel.action_id;
            tURL      += "<br/>&amp;gui=";
            buildHTML += addRow("View URL", tURL);

            buildHTML += "</table>";
            return(buildHTML);
        }
Beispiel #2
0
        static public string ajax_GetModelMarkups()
        {
            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 modelID = aRequest.Params["id"];

            // Get the model info...
            model_markup[] tMarkups = apiObj.getAllModelMarkups(modelID);
            if (tMarkups == null)
            {
                return("<div class=\"message notice\" style=\"margin: 0px 16px 6px 16px;\"><b>This model does not contain any Markups.</b></div>");
            }

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

            // Show the markups
            foreach (model_markup aMarkup in tMarkups)
            {
                buildHTML += "<tr style=\"border-bottom: 1px solid #CCCCCC\">";

                buildHTML += "<td style=\"border-right: 1px solid #CCCCCC\">";

                // Build the URL to view the model
                string timestamp = BIM360WebServiceAPI.getUNIXEpochTimestamp().ToString();
                string tURL      = "";
                tURL += BIM360SDKDeveloperConfig.GLUE_VIEWER_BASE_URL;

                // Add question mark if needed
                if (tURL.Substring(tURL.Length - 1) != "?")
                {
                    tURL += "?";
                }

                tURL += "company_id=" + BIM360SDKDeveloperConfig.BIM360GLUESDK_COMPANY_ID;
                tURL += "&api_key=" + BIM360SDKDeveloperConfig.BIM360GLUESDK_API_KEY;
                tURL += "&auth_token=" + apiObj.auth_token;
                tURL += "&timestamp=" + timestamp;
                tURL += "&sig=" + BIM360WebServiceAPI.generateAPISignature(timestamp);
                tURL += "&action_id=" + aMarkup.action_id;
                tURL += "&gui=";

                buildHTML += "<a href=\"javascript:void(0);\" onClick=\"loadModel('" + tURL + "');\">";
                buildHTML += HttpUtility.UrlDecode(aMarkup.name);
                buildHTML += "</a>";

                buildHTML += "</td>";

                buildHTML += "<td style=\"border-right: 1px solid #CCCCCC\">";
                buildHTML += aMarkup.created_date;
                buildHTML += "</td>";

                buildHTML += "<td>";
                buildHTML += aMarkup.created_by;
                buildHTML += "</td>";
                buildHTML += "</tr>";
            }

            buildHTML += "</table>";
            return(buildHTML);
        }