Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BIM360WebServiceAPI apiObj = new BIM360WebServiceAPI(Request);

            // Is this a new login request?
            if ((txt_login_name.Text != "") && (txt_password.Text != ""))
            {
                apiObj.doLogin(Response, txt_login_name.Text, txt_password.Text);
            }

            // Now, setup the UI properly
            if (apiObj.userLoggedIn)
            {
                Label mpLabel = (Label)Master.FindControl("lab_login_name");
                if (mpLabel != null)
                {
                    mpLabel.Text = apiObj.userInfo.login_name;
                }

                Page.Master.FindControl("logoutHeader").Visible = true;
                panelAuth.Visible   = true;
                panelUnAuth.Visible = false;

                // Build project list...
                string buildHTML = "";
                buildHTML += apiObj.getProjectList();

                // More UI elements
                buildHTML += "<br/><h1>Various API Functions</h1>";
                buildHTML += "The links below exercise various functionality of the API and helps explain some of this Sample Web App.";
                buildHTML += "<div style=\"margin: 12px 0 0 40px;\">";
                string tID   = "1";
                string tLink = "Show BIM 360 Glue SDK Developer Account Information";
                buildHTML += "<a id=\"id_link_" + tID + "\" class=\"id_link_" + tID + "\" href=\"javascript:void();\" onClick=\"getDeveloperInfo(" + tID + ");\">" + tLink + "</a>";

                buildHTML += "<br/><br/>";

                tID        = "2";
                tLink      = "Show User Account Information";
                buildHTML += "<a id=\"id_link_" + tID + "\" class=\"id_link_" + tID + "\" href=\"javascript:void();\" onClick=\"getUserInfo(" + tID + ");\">" + tLink + "</a>";

                buildHTML += "</div>";
                this.page_contents.InnerHtml = buildHTML;
            }
            else
            {
                if ((txt_login_name.Text != "") && (txt_password.Text != ""))
                {
                    this.login_error.InnerHtml = "<b>Login Failed...Try Again</b>";
                }
                Page.Master.FindControl("logoutHeader").Visible = false;
                panelAuth.Visible   = false;
                panelUnAuth.Visible = true;
            }
        }
Example #2
0
        public static string ajax_GetUserInfo()
        {
            string              buildHTML = "";
            HttpRequest         aRequest  = HttpContext.Current.Request;
            BIM360WebServiceAPI apiObj    = new BIM360WebServiceAPI(aRequest);

            if (apiObj.userLoggedIn)
            {
                buildHTML += apiObj.getUserInformation();
            }
            else
            {
                buildHTML += "<b>Unauthorized: Please login to continue</b>";
            }
            return(buildHTML);
        }
Example #3
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;
        }
Example #4
0
        static public string ajax_GetProjectTree()
        {
            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("[]");
            }

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

            HttpContext.Current.Response.ContentType = "application/json; charset=UTF-8;";

            // Build project list...
            buildHTML += apiObj.getProjectTreeView(projectID);
            return(buildHTML);
        }
Example #5
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);
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BIM360WebServiceAPI apiObj = new BIM360WebServiceAPI(Request);

            apiObj.doLogout(Response);
        }
Example #7
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);
        }
Example #8
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);
        }