protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oOnDemand = new OnDemand(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oWorkstation = new Workstations(intProfile, dsn); oStorage = new Storage(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oOperatingSystem = new OperatingSystems(intProfile, dsn); if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "") { intAnswer = Int32.Parse(Request.QueryString["aid"]); } if (Request.QueryString["num"] != null && Request.QueryString["num"] != "") { intNumber = Int32.Parse(Request.QueryString["num"]); } int intWorkstation = 0; if (intAnswer > 0) { DataSet ds = oForecast.GetAnswer(intAnswer); if (ds.Tables[0].Rows.Count > 0) { int intModel = oForecast.GetModel(intAnswer); intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid")); int _classid = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()); intQuantity = Int32.Parse(ds.Tables[0].Rows[0]["quantity"].ToString()); int _environmentid = Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString()); intOS = Int32.Parse(oForecast.GetWorkstation(intAnswer, "osid")); intRequest = oForecast.GetRequestID(intAnswer, true); if (!IsPostBack) { LoadLists(_classid, _environmentid); chkApply.Visible = (intQuantity > 1 && intNumber == 1); ds = oWorkstation.GetVirtual(intAnswer, intNumber); if (ds.Tables[0].Rows.Count > 0) { intWorkstation = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()); lblId.Text = intWorkstation.ToString(); intOS = Int32.Parse(ds.Tables[0].Rows[0]["osid"].ToString()); } if (intOS > 0) { ddlOS.SelectedValue = intOS.ToString(); ddlServicePack.Enabled = true; ddlServicePack.DataValueField = "id"; ddlServicePack.DataTextField = "name"; ddlServicePack.DataSource = oOperatingSystem.GetServicePack(intOS); ddlServicePack.DataBind(); ddlServicePack.Items.Insert(0, new ListItem("-- SELECT --", "0")); chkComponents.DataValueField = "id"; chkComponents.DataTextField = "name"; chkComponents.DataSource = oWorkstation.GetComponentPermissionsOS(intOS); chkComponents.DataBind(); DataSet dsComponents = oWorkstation.GetComponentsSelected(intWorkstation); foreach (DataRow drComponent in dsComponents.Tables[0].Rows) { foreach (ListItem oItem in chkComponents.Items) { if (drComponent["componentid"].ToString() == oItem.Value) { oItem.Selected = true; break; } } } } if (ds.Tables[0].Rows.Count > 0) { ddlServicePack.SelectedValue = ds.Tables[0].Rows[0]["spid"].ToString(); hdnServicePack.Value = ds.Tables[0].Rows[0]["spid"].ToString(); ddlDomain.SelectedValue = ds.Tables[0].Rows[0]["domainid"].ToString(); } } btnClose.Attributes.Add("onclick", "return window.close();"); btnSaveConfig.Attributes.Add("onclick", "return ValidateDropDown('" + ddlServicePack.ClientID + "','Please select a service pack')" + " && ValidateDropDown('" + ddlDomain.ClientID + "','Please select a domain')" + ";"); ddlOS.Attributes.Add("onchange", "PopulateServicePacks('" + ddlOS.ClientID + "','" + ddlServicePack.ClientID + "');"); ddlServicePack.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlServicePack.ClientID + "','" + hdnServicePack.ClientID + "');"); } } }