protected void btnSaveConfig_Click(Object Sender, EventArgs e) { int intConfigured = ((ddlOS.SelectedIndex > 0 && Int32.Parse(Request.Form[hdnServicePack.UniqueID]) > 0 && ddlDomain.SelectedIndex > 0) ? 1 : 0); int intWorkstation = 0; if (lblId.Text != "") { intWorkstation = Int32.Parse(lblId.Text); oWorkstation.UpdateVirtual(intWorkstation, Int32.Parse(ddlOS.SelectedItem.Value), Int32.Parse(Request.Form[hdnServicePack.UniqueID]), Int32.Parse(ddlDomain.SelectedItem.Value), intConfigured); } else { intWorkstation = oWorkstation.AddVirtual(intRequest, intAnswer, intNumber, 1, intModelVMware, Int32.Parse(ddlOS.SelectedItem.Value), Int32.Parse(Request.Form[hdnServicePack.UniqueID]), Int32.Parse(ddlDomain.SelectedItem.Value), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "ramid")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "recovery")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "internal")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "hddid")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "cpuid")), intConfigured, 0); } oWorkstation.DeleteComponents(intWorkstation); foreach (ListItem oItem in chkComponents.Items) { if (oItem.Selected == true) { oWorkstation.AddComponents(intWorkstation, Int32.Parse(oItem.Value)); } } if (chkApply.Visible && chkApply.Checked) { for (int ii = 2; ii <= intQuantity; ii++) { DataSet ds = oWorkstation.GetVirtual(intAnswer, ii); int intCopy = 0; if (ds.Tables[0].Rows.Count > 0) { intCopy = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()); oWorkstation.UpdateVirtual(intCopy, Int32.Parse(ddlOS.SelectedItem.Value), Int32.Parse(Request.Form[hdnServicePack.UniqueID]), Int32.Parse(ddlDomain.SelectedItem.Value), intConfigured); } else { intCopy = oWorkstation.AddVirtual(intRequest, intAnswer, ii, 1, intModelVMware, Int32.Parse(ddlOS.SelectedItem.Value), Int32.Parse(Request.Form[hdnServicePack.UniqueID]), Int32.Parse(ddlDomain.SelectedItem.Value), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "ramid")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "recovery")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "internal")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "hddid")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "cpuid")), intConfigured, 0); } oWorkstation.DeleteComponents(intCopy); foreach (ListItem oItem in chkComponents.Items) { if (oItem.Selected == true) { oWorkstation.AddComponents(intCopy, Int32.Parse(oItem.Value)); } } } } Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "save", "<script type=\"text/javascript\">RefreshOpeningWindow();window.close();<" + "/" + "script>"); }
protected void btnSaveConfig_Click(Object Sender, EventArgs e) { int intConfigured = ((ddlOS.SelectedIndex > 0 && Int32.Parse(Request.Form[hdnServicePack.UniqueID]) > 0 && ddlDomain.SelectedIndex > 0) ? 1 : 0); int intWorkstation = 0; if (lblId.Text != "") { intWorkstation = Int32.Parse(lblId.Text); oWorkstation.UpdateVirtual(intWorkstation, Int32.Parse(ddlOS.SelectedItem.Value), Int32.Parse(Request.Form[hdnServicePack.UniqueID]), Int32.Parse(ddlDomain.SelectedItem.Value), intConfigured); } else { intWorkstation = oWorkstation.AddVirtual(intRequest, intAnswer, intNumber, 0, intModelVirtual, Int32.Parse(ddlOS.SelectedItem.Value), Int32.Parse(Request.Form[hdnServicePack.UniqueID]), Int32.Parse(ddlDomain.SelectedItem.Value), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "ramid")), 0, 0, Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "hddid")), Int32.Parse(oForecast.GetAnswerWorkstation(intAnswer, "cpuid")), intConfigured, -1); } oWorkstation.DeleteComponents(intWorkstation); foreach (ListItem oItem in chkComponents.Items) { if (oItem.Selected == true) { oWorkstation.AddComponents(intWorkstation, Int32.Parse(oItem.Value)); } } Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "save", "<script type=\"text/javascript\">RefreshOpeningWindow();window.close();<" + "/" + "script>"); }
protected void btnNext_Click(Object Sender, EventArgs e) { int intRequest = Int32.Parse(Request.QueryString["rid"]); int intItem = Int32.Parse(lblItem.Text); int intNumber = Int32.Parse(lblNumber.Text); DataSet dsToday = oForecast.GetAnswersDay(intWorkstationPlatform, intProfile, 1); int intQuantity = 0; foreach (DataRow drToday in dsToday.Tables[0].Rows) { intQuantity += Int32.Parse(drToday["quantity"].ToString()); } int intTotal = Int32.Parse(txtQuantity.Text) + intQuantity; if (intTotal <= intMaxWorkstationsPerDay) { if (intWorkstation == 0) { // Add Answer if (intAnswer == 0) { intAnswer = oForecast.AddAnswer(0, intWorkstationPlatform, 0, intProfile); oForecast.UpdateAnswerStep(intAnswer, 1, 1); } oForecast.UpdateAnswerService(intAnswer, intRequest); int intClass = Int32.Parse(ddlClass.SelectedItem.Value); oForecast.UpdateAnswer(intAnswer, 0, 0, "", 0, Request.ServerVariables["REMOTE_HOST"], "", txtName.Text, Int32.Parse(ddlLocation.SelectedItem.Value), intClass, 0, intCore, 0, 0, 0, Int32.Parse(txtQuantity.Text), 0); // Add Model oForecast.UpdateAnswerModel(intAnswer, intModelVMware); oForecast.DeleteWorkstation(intAnswer); oForecast.AddWorkstation(intAnswer, Int32.Parse(ddlRam.SelectedItem.Value), Int32.Parse(ddlOS.SelectedItem.Value), (chkDR.Checked ? 1 : 0), Int32.Parse(radEmployee.SelectedItem.Value), Int32.Parse(ddlHardDrive.SelectedItem.Value), Int32.Parse(ddlCPU.SelectedItem.Value)); oForecast.UpdateAnswerStep(intAnswer, 1, 1); // Add Commitment Date oForecast.UpdateAnswer(intAnswer, DateTime.Today, intConfidence, intProfile); oForecast.UpdateAnswerStep(intAnswer, 1, 1); // Manager and Cost Center int intCostCenter = 0; Int32.TryParse(Request.Form[hdnCostCenter.UniqueID], out intCostCenter); oForecast.UpdateAnswer(intAnswer, "", "", 0, intCostCenter, 0, Int32.Parse(Request.Form[hdnManager.UniqueID]), 0, 0, 0, 0, 0, 0); // Create Workstation Record int intOS = Int32.Parse(ddlOS.SelectedItem.Value); int intSP = 0; Int32.TryParse(oOperatingSystems.Get(intOS, "default_sp"), out intSP); DataSet dsDomains = oDomain.GetClassEnvironment(intClass, intCore); int intDomain = 0; if (dsDomains.Tables[0].Rows.Count > 0) { intDomain = Int32.Parse(dsDomains.Tables[0].Rows[0]["id"].ToString()); } intWorkstation = oWorkstation.AddVirtual(intRequest, intAnswer, intNumber, 1, intModelVMware, intOS, intSP, intDomain, Int32.Parse(ddlRam.SelectedItem.Value), (chkDR.Checked ? 1 : 0), Int32.Parse(radEmployee.SelectedItem.Value), Int32.Parse(ddlHardDrive.SelectedItem.Value), Int32.Parse(ddlCPU.SelectedItem.Value), 1, 1); Redirect("&id=" + intWorkstation.ToString() + "&menu_tab=2"); } else { Update(); if (rptAccounts.Items.Count > 0) { oRequestItem.UpdateForm(intRequest, true); Redirect(""); } else { Redirect("&menu_tab=2&accts=0"); } } } else { Redirect("&qty=" + intQuantity.ToString()); } }