protected void CS_ddl_Region_SelectChange(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); string region = CS_ddl_Region.SelectedItem.ToString(); string cslistserverid = CS_ddl_ListServers.SelectedValue.ToString(); try { CS_m_ClearGrid(); var serverdetails = Servers.CS_m_ListServerInfo(region); bindListServersNoIndexInDDL(serverdetails, "Name", "Id"); var firstserver = serverdetails.First(); CS_m_GetCloudServerDetails(firstserver.Id, region); TimeClock.Stop(); CS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } catch (Exception ex) { CS_m_MsgCatchException(ex.ToString()); } }
protected void CS_btn_DetachVolume_OnClick(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); string region = CS_ddl_Region.SelectedItem.ToString(); string cslistserverid = CS_ddl_ListServers.SelectedValue; string cslistavailablevolumeid = CS_ddl_CBSAvailableVolume.SelectedValue; var serverdetails = Servers.CS_m_ListServerInfo(region); var firstserver = serverdetails.First(); try { CS_m_ClearSessions(); CS_ddl_CBSAttachedVolume.Items.Clear(); Servers.CS_m_DetachVolume(cslistserverid, cslistavailablevolumeid, region); CS_m_GetCloudServerDetails(firstserver.Id, region); TimeClock.Stop(); CS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } catch (Exception ex) { CS_m_MsgCatchException(ex.ToString()); } }
protected void CS_btn_CreateServer_OnClick(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); string region = CS_ddl_Region.SelectedItem.ToString(); string cslistserverid = CS_ddl_ListServers.SelectedValue; string servername = CS_txt_Name.Text; string howmany = CS_txt_HowMany.Text.ToString(); string listimages = CS_ddl_AvailableImage.SelectedValue; string listflavors = CS_ddl_AvailableFlavors.SelectedValue; try { var createserver = Servers.CS_m_CreateServer(servername, listimages, listflavors, howmany, region); Servers.CS_m_ListServerInfo(region); CS_m_GetCloudServerDetails(cslistserverid, region); CS_lbl_Info.Text = createserver.ToString(); TimeClock.Stop(); CS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } catch (Exception ex) { CS_m_MsgCatchException(ex.ToString()); } }
protected void CS_ddl_ListServers_SelectChange(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); string region = CS_ddl_Region.SelectedItem.ToString(); string cslistserverid = CS_ddl_ListServers.SelectedValue; string cslistserverregion = (string)(Session["CSListServersRegion"]); string cslistserveridsession = (string)(Session["PostBackListServerIdDDL"]); string cslistservernamesession = (string)(Session["CSListServersName"]); string postbackname = (string)(Session["PostBackListServerNameDDL"]); string postbackid = (string)(Session["PostBackListServerIdDDL"]); try { if (string.IsNullOrEmpty((string)(Session["CSListServersID"]))) { var serverdetails = Servers.CS_m_ListServerInfo(region); var firstserver = serverdetails.First(); bindListServersNoIndexInDDL(serverdetails, "Name", "Id"); CS_m_GetCloudServerDetails(firstserver.Id, region); TimeClock.Stop(); CS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } else { var serverdetails = Servers.CS_m_ListServerInfo(region); bindListServersDDL(serverdetails, "Name", "Id", postbackname); CS_m_GetCloudServerDetails(postbackid, region); TimeClock.Stop(); CS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } } catch (Exception ex) { CS_m_MsgCatchException(ex.ToString()); } }
protected void CS_btn_DeleteServer_OnClick(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); string region = CS_ddl_Region.SelectedItem.ToString(); string cslistserverid = CS_ddl_ListServers.SelectedValue; try { CS_m_ClearSessions(); Servers.CS_m_DeleteServer(cslistserverid, region); Servers.CS_m_ListServerInfo(region); CS_m_MsgDeleteServerSuccess(); TimeClock.Stop(); CS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } catch (Exception ex) { CS_m_MsgCatchException(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { Stopwatch TimeClock = new Stopwatch(); TimeClock.Start(); HttpContext.Current.Session["CSListServersName"] = HttpUtility.HtmlEncode(CS_ddl_ListServers.SelectedItem); HttpContext.Current.Session["CSListServersID"] = HttpUtility.HtmlEncode(CS_ddl_ListServers.SelectedValue); HttpContext.Current.Session["CSListServersRegion"] = CS_ddl_Region.Text; string region = CS_ddl_Region.SelectedItem.ToString(); string cslistserverid = CS_ddl_ListServers.SelectedValue.ToString(); string cslistserveridsession = (string)(HttpContext.Current.Session["CSListServersID"]); string cslistservernamesession = (string)(HttpContext.Current.Session["CSListServersName"]); string CloudIdentityUserName = (string)(HttpContext.Current.Session["CloudIdentityUserName"]); string CloudIdentityApiKey = (string)(HttpContext.Current.Session["CloudIdentityApiKey"]); var identity = new RackspaceImpersonationIdentity() { Username = CloudIdentityUserName, APIKey = CloudIdentityApiKey }; CloudIdentityProvider identityProvider = new net.openstack.Providers.Rackspace.CloudIdentityProvider(identity); CloudServersProvider CloudServersProvider = new net.openstack.Providers.Rackspace.CloudServersProvider(); Page.GetPostBackEventReference(CS_btn_RebootCloudServer); try { if (IsPostBack) { HttpContext.Current.Session["PostBackListServerIdDDL"] = HttpUtility.HtmlEncode(CS_ddl_ListServers.SelectedValue); HttpContext.Current.Session["PostBackListServerNameDDL"] = HttpUtility.HtmlEncode(CS_ddl_ListServers.SelectedItem); } else { if (string.IsNullOrEmpty((string)(Session["CloudIdentityUserName"])) & string.IsNullOrEmpty((string)(Session["CloudIdentityApiKey"]))) { CS_lbl_Error.Text = "Before continuing please login and enter Cloud Username and API Key."; } else if (string.IsNullOrEmpty((string)(Session["CloudIdentityUserName"]))) { CS_lbl_Error.Text = "Before continuing please login and please enter Cloud Username."; } else if (string.IsNullOrEmpty((string)(Session["CloudIdentityApiKey"]))) { CS_lbl_Error.Text = "Before continuing please login and please enter API Key."; } else { var listimages = Servers.CS_m_ListImages(); bindListImagesNoIndexInDDL(listimages, "Name", "Id"); var listflavors = Servers.CS_m_ListFlavors(); bindListFlavorsNoIndexInDDL(listflavors, "Name", "Id"); var serverdetails = Servers.CS_m_ListServerInfo(region); var firstserver = serverdetails.First(); bindListServersNoIndexInDDL(serverdetails, "Name", "Id"); CS_m_GetCloudServerDetails(firstserver.Id, region); TimeClock.Stop(); CS_lbl_TimeClock.Text = TimeClock.Elapsed.ToString(); } } } catch (Exception ex) { CS_m_MsgCatchException(ex.ToString()); } }