PageRenderTime 31ms CodeModel.GetById 24ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/MyVMPortal/GetOperationStatus.aspx.cs

https://github.com/mwasham/wasvcmgmntapi
C# | 40 lines | 34 code | 6 blank | 0 comment | 4 complexity | 2eab5cf2a02ad48a5ea311be9ee910d9 MD5 | raw file
 1using SMLibrary;
 2using System;
 3using System.Collections.Generic;
 4using System.Configuration;
 5using System.Linq;
 6using System.Web;
 7using System.Web.UI;
 8using System.Web.UI.WebControls;
 9using System.Xml.Linq;
10
11namespace MyVMPortal
12{
13    public partial class GetOperationStatus : System.Web.UI.Page
14    {
15        async protected void Page_Load(object sender, EventArgs e)
16        {
17
18            if (Request.QueryString["requestid"] != null)
19            {
20                VMManager vmm = GetVMM();
21                String requestID = Request.QueryString["requestid"];
22                XElement status = await vmm.GetOperationStatus(requestID);
23                String strStatus = status.Element(vmm.ns + "Status").Value;
24                String strMessage = String.Empty;
25                if (status.Descendants(vmm.ns + "Message").FirstOrDefault() != null)
26                    strMessage = status.Descendants(vmm.ns + "Message").FirstOrDefault().Value;
27
28                String osStatus = String.Format("Status: {0}, Message: {1}",strStatus, strMessage );
29                lblStatus.Text = osStatus;
30            }
31        }
32
33
34        private VMManager GetVMM()
35        {
36            return new VMManager(ConfigurationManager.AppSettings["SubcriptionID"], ConfigurationManager.AppSettings["CertificateThumbprint"]);
37        }
38
39    }
40}