protected int LoadPlatform(int _platformid, int _typeid, int _classid, int _environmentid, int _addressid) { int intCount = 0; ddlTypes.DataTextField = "name"; ddlTypes.DataValueField = "id"; ddlTypes.DataSource = oType.Gets(_platformid, 1); ddlTypes.DataBind(); ddlTypes.Items.Insert(0, new ListItem("-- SELECT --", "0")); if (_typeid > 0) { ddlTypes.SelectedValue = _typeid.ToString(); panModels.Visible = true; ddlModels.DataTextField = "name"; ddlModels.DataValueField = "id"; DataSet ds = oModelsProperties.GetTypes(1, _typeid, 1); if (ds.Tables[0].Rows.Count > 0) { // ddlModels.DataSource = ds; ddlModels.DataSource = oModel.GetLocation(_classid, _environmentid, _addressid, _typeid); } else { ddlModels.DataSource = oModel.Gets(_typeid, 1); } ddlModels.DataBind(); ddlModels.Items.Insert(0, new ListItem("-- SELECT --", "0")); ddlRam.DataTextField = "name"; ddlRam.DataValueField = "id"; ddlRam.DataSource = oVirtualRam.GetVMwares(1); ddlRam.DataBind(); ddlRam.Items.Insert(0, new ListItem("-- SELECT --", "0")); ddlOS.DataTextField = "name"; ddlOS.DataValueField = "id"; ddlOS.DataSource = oOperatingSystems.Gets(1, 1); ddlOS.DataBind(); ddlOS.Items.Insert(0, new ListItem("-- SELECT --", "0")); ddlCPU.DataTextField = "name"; ddlCPU.DataValueField = "id"; ddlCPU.DataSource = oVirtualCPU.GetVMwares(1); ddlCPU.DataBind(); ddlCPU.Items.Insert(0, new ListItem("-- SELECT --", "0")); ddlHardDrive.DataTextField = "name"; ddlHardDrive.DataValueField = "id"; ddlHardDrive.DataSource = oVirtualHDD.GetVMwares(1); ddlHardDrive.DataBind(); ddlHardDrive.Items.Insert(0, new ListItem("-- SELECT --", "0")); intCount = ddlModels.Items.Count; } return(intCount); }
protected void ChangeOS() { int intOS = Int32.Parse(ddlOS.SelectedItem.Value); ddlRam.Items.Clear(); ddlCPU.Items.Clear(); ddlHardDrive.Items.Clear(); if (intOS > 0) { bool boolXP = (oOperatingSystems.Get(intOS, "code") == "XP"); bool boolWin7 = (oOperatingSystems.Get(intOS, "code") == "7"); ddlRam.Enabled = true; ddlRam.DataTextField = "name"; ddlRam.DataValueField = "id"; ddlRam.DataSource = oVirtualRam.GetVMwares((boolXP ? 1 : 0), (boolWin7 ? 1 : 0), 1); ddlRam.DataBind(); ddlRam.Items.Insert(0, new ListItem("-- SELECT --", "0")); ddlCPU.Enabled = true; ddlCPU.DataTextField = "name"; ddlCPU.DataValueField = "id"; ddlCPU.DataSource = oVirtualCPU.GetVMwares((boolXP ? 1 : 0), (boolWin7 ? 1 : 0), 1); ddlCPU.DataBind(); ddlCPU.Items.Insert(0, new ListItem("-- SELECT --", "0")); ddlHardDrive.Enabled = true; ddlHardDrive.DataTextField = "name"; ddlHardDrive.DataValueField = "id"; ddlHardDrive.DataSource = oVirtualHDD.GetVMwares((boolXP ? 1 : 0), (boolWin7 ? 1 : 0), 1); ddlHardDrive.DataBind(); ddlHardDrive.Items.Insert(0, new ListItem("-- SELECT --", "0")); } else { ddlRam.Enabled = false; ddlRam.Items.Insert(0, new ListItem("-- Select an Operating System --", "0")); ddlCPU.Enabled = false; ddlCPU.Items.Insert(0, new ListItem("-- Select an Operating System --", "0")); ddlHardDrive.Enabled = false; ddlHardDrive.Items.Insert(0, new ListItem("-- Select an Operating System --", "0")); } }
private void LoadOS(int _osid) { ddlRam.Items.Clear(); ddlCPU.Items.Clear(); ddlHardDrive.Items.Clear(); if (_osid > 0) { bool boolXP = (oOperatingSystems.Get(_osid, "code") == "XP"); bool boolWin7 = (oOperatingSystems.Get(_osid, "code") == "7"); DataSet dsRam = oVirtualRam.GetVMwares((boolXP ? 1 : 0), (boolWin7 ? 1 : 0), 1); ddlRam.Enabled = true; ddlRam.DataTextField = "name"; ddlRam.DataValueField = "id"; ddlRam.DataSource = dsRam; ddlRam.DataBind(); ddlRam.Items.Insert(0, new ListItem("-- SELECT --", "0")); foreach (DataRow drRam in dsRam.Tables[0].Rows) { if (drRam["default"].ToString() == "1") { foreach (ListItem li in ddlRam.Items) { if (li.Value == drRam["id"].ToString()) { li.Selected = true; break; } } break; } } DataSet dsCPU = oVirtualCPU.GetVMwares((boolXP ? 1 : 0), (boolWin7 ? 1 : 0), 1); ddlCPU.Enabled = true; ddlCPU.DataTextField = "name"; ddlCPU.DataValueField = "id"; ddlCPU.DataSource = dsCPU; ddlCPU.DataBind(); ddlCPU.Items.Insert(0, new ListItem("-- SELECT --", "0")); foreach (DataRow drCPU in dsCPU.Tables[0].Rows) { if (drCPU["default"].ToString() == "1") { foreach (ListItem li in ddlCPU.Items) { if (li.Value == drCPU["id"].ToString()) { li.Selected = true; break; } } break; } } DataSet dsHardDrive = oVirtualHDD.GetVMwares((boolXP ? 1 : 0), (boolWin7 ? 1 : 0), 1); ddlHardDrive.Enabled = true; ddlHardDrive.DataTextField = "name"; ddlHardDrive.DataValueField = "id"; ddlHardDrive.DataSource = dsHardDrive; ddlHardDrive.DataBind(); ddlHardDrive.Items.Insert(0, new ListItem("-- SELECT --", "0")); foreach (DataRow drHardDrive in dsHardDrive.Tables[0].Rows) { if (drHardDrive["default"].ToString() == "1") { foreach (ListItem li in ddlHardDrive.Items) { if (li.Value == drHardDrive["id"].ToString()) { li.Selected = true; break; } } break; } } } else { ddlRam.Enabled = false; ddlRam.Items.Insert(0, new ListItem("-- Select an Operating System --", "0")); ddlCPU.Enabled = false; ddlCPU.Items.Insert(0, new ListItem("-- Select an Operating System --", "0")); ddlHardDrive.Enabled = false; ddlHardDrive.Items.Insert(0, new ListItem("-- Select an Operating System --", "0")); } }