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/>&api_key=" + BIM360SDKDeveloperConfig.BIM360GLUESDK_API_KEY; tURL += "<br/>&auth_token=" + apiObj.auth_token; tURL += "<br/>&timestamp=" + timestamp; tURL += "<br/>&sig=" + BIM360WebServiceAPI.generateAPISignature(timestamp); tURL += "<br/>&action_id=" + tModel.action_id; tURL += "<br/>&gui="; buildHTML += addRow("View URL", tURL); buildHTML += "</table>"; return(buildHTML); }
static public string ajax_GetModelViews() { 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>"); } if (tModel.view_tree == null) { return("<div class=\"message notice\" style=\"margin: 0px 16px 6px 16px;\"><b>This model does not contain any Views.</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>"; foreach (model_view_node tView in tModel.view_tree) { if (tView.type != "VIEW") { continue; } 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 += "×tamp=" + timestamp; tURL += "&sig=" + BIM360WebServiceAPI.generateAPISignature(timestamp); tURL += "&action_id=" + tView.action_id; tURL += "&gui="; buildHTML += "<a href=\"javascript:void(0);\" onClick=\"loadModel('" + tURL + "');\">"; buildHTML += HttpUtility.UrlDecode(tView.name); buildHTML += "</a>"; buildHTML += "</td>"; buildHTML += "<td style=\"border-right: 1px solid #CCCCCC\">"; buildHTML += tView.created_date; buildHTML += "</td>"; buildHTML += "<td>"; buildHTML += tView.created_by; buildHTML += "</td>"; buildHTML += "</tr>"; } buildHTML += "</table>"; return(buildHTML); }