예제 #1
0
        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>");
        }