protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oCluster = new Cluster(intProfile, dsn); oStorage = new Storage(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oClass = new Classes(intProfile, dsn); oServer = new Servers(intProfile, dsn); oOperatingSystem = new OperatingSystems(intProfile, dsn); oServerName = new ServerName(intProfile, dsn); if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "") { intAnswer = Int32.Parse(Request.QueryString["aid"]); } if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intCluster = Int32.Parse(Request.QueryString["id"]); } if (Request.QueryString["save"] != null) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">RefreshOpeningWindow();alert('Cluster Quorum Configuration Saved');window.close();<" + "/" + "script>"); } if (intCluster > 0) { StringBuilder sbSQL = new StringBuilder(strSQL); StringBuilder sbHidden = new StringBuilder(strHidden); DataSet ds = oForecast.GetAnswer(intAnswer); if (ds.Tables[0].Rows.Count > 0) { int intClass = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()); ds = oCluster.Get(intCluster); if (ds.Tables[0].Rows.Count > 0) { if (!IsPostBack) { bool boolProd = false; bool boolQA = false; bool boolTest = false; bool boolUnder = false; if (oClass.IsProd(intClass)) { boolProd = true; if (oForecast.GetAnswer(intAnswer, "test") == "1") { boolTest = true; } if (oForecast.GetAnswerPlatform(intAnswer, intUnder48Q, intUnder48A) == true) { boolUnder = true; } } else if (oClass.IsQA(intClass)) { boolQA = true; } else { boolTest = true; } int intRequest = oForecast.GetRequestID(intAnswer, true); // Check if SQL is on any of the instances bool boolSQL = false; ds = oCluster.GetInstances(intCluster); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["sql"].ToString() == "1") { boolSQL = true; break; } } bool boolWin2008 = false; bool boolSQL2008 = false; DataSet dsServers = oServer.GetAnswer(intAnswer); foreach (DataRow drServer in dsServers.Tables[0].Rows) { int intServer = Int32.Parse(drServer["id"].ToString()); if (boolWin2008 == false && oOperatingSystem.IsWindows2008(Int32.Parse(drServer["osid"].ToString())) == true) { boolWin2008 = true; } DataSet dsComponents = oServerName.GetComponentDetailSelected(intServer, 1); foreach (DataRow drComponent in dsComponents.Tables[0].Rows) { if (drComponent["sql"].ToString() == "1" || drComponent["dbase"].ToString() == "1") { if (drComponent["name"].ToString().Contains("2008") == true) { boolSQL2008 = true; } } } } // Load Table int intModel = oForecast.GetModel(intAnswer); bool boolHADisabled = (oModelsProperties.IsHighAvailability(intModel) == false); panView.Visible = true; ds = oStorage.GetLuns(intAnswer, 0, intCluster, 0, 0); bool boolOther = false; int intNumber = 0; bool boolCreateCLU = true; bool boolCreateDTC = boolSQL; if (boolSQL == true && boolWin2008 == true && boolSQL2008 == true) { // For SQL Server 2008 on a Windows 2008 cluster, no "P" MSDTC drive is needed. // 12/2/2011 - Per Moskal, 2008 now needs the MSDTC drive. //boolCreateDTC = false; } foreach (DataRow dr in ds.Tables[0].Rows) { if ((dr["driveid"].ToString() == "-1") || ((dr["driveid"].ToString() == "-10") && boolSQL == true)) { // -1 is hard coded to be Q: (CLU) drive // -10 is hard coded to be P: (DTC) drive intNumber++; boolOther = !boolOther; sbSQL.Append("<tr"); sbSQL.Append(boolOther ? " bgcolor=\"F6F6F6\"" : ""); sbSQL.Append(">"); sbSQL.Append("<td valign=\"top\">"); sbSQL.Append(intNumber); sbSQL.Append("</td>"); if (dr["driveid"].ToString() == "-1") { sbSQL.Append("<td valign=\"top\">Q:</td>"); boolCreateCLU = false; } if (dr["driveid"].ToString() == "-10" && boolSQL == true) { sbSQL.Append("<td valign=\"top\">P:</td>"); boolCreateDTC = false; } sbSQL.Append("<td valign=\"top\">"); sbSQL.Append("<select class=\"default\" onchange=\"UpdateDDL(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_PERFORMANCE');\" style=\"width:100px;\">"); sbSQL.Append("<option value=\"High\""); sbSQL.Append(dr["performance"].ToString() == "High" ? " selected" : ""); sbSQL.Append(">High</option>"); sbSQL.Append("<option value=\"Standard\""); sbSQL.Append(dr["performance"].ToString() == "Standard" ? " selected" : ""); sbSQL.Append(">Standard</option>"); sbSQL.Append("<option value=\"Low\""); sbSQL.Append(dr["performance"].ToString() == "Low" ? " selected" : ""); sbSQL.Append(">Low</option>"); sbSQL.Append("</select>"); sbSQL.Append("</td>"); if (boolProd == true) { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" onblur=\"UpdateText(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_SIZE');\" value=\""); sbSQL.Append(dr["size"].ToString()); sbSQL.Append("\" /> GB</td>"); } else { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" value=\"0\" disabled=\"disabled\" /> GB</td>"); } if (boolQA == true) { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" onblur=\"UpdateText(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_SIZE_QA');\" value=\""); sbSQL.Append(dr["size_qa"].ToString()); sbSQL.Append("\" /> GB</td>"); } else { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" value=\"0\" disabled=\"disabled\" /> GB</td>"); } if (boolTest == true) { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" onblur=\"UpdateText(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_SIZE_TEST');\" value=\""); sbSQL.Append(dr["size_test"].ToString()); sbSQL.Append("\" /> GB</td>"); } else { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" value=\"0\" disabled=\"disabled\" /> GB</td>"); } sbSQL.Append("<td valign=\"top\">"); if (boolProd == true && boolUnder == true) { sbSQL.Append("<select class=\"default\" onchange=\"UpdateDDL(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_REPLICATED');\" style=\"width:75px;\">"); sbSQL.Append("<option value=\"Yes\""); sbSQL.Append(dr["replicated"].ToString() == "1" ? " selected" : ""); sbSQL.Append(">Yes</option>"); sbSQL.Append("<option value=\"No\""); sbSQL.Append(dr["replicated"].ToString() == "0" ? " selected" : ""); sbSQL.Append(">No</option>"); sbSQL.Append("</select>"); } else { sbSQL.Append("<select class=\"default\" disabled=\"disabled\" style=\"width:75px;\">"); sbSQL.Append("<option value=\"No\">No</option>"); sbSQL.Append("</select>"); } sbSQL.Append("</td>"); sbSQL.Append("<td valign=\"top\">"); sbSQL.Append("<select class=\"default\" onchange=\"UpdateDDL(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_HIGH_AVAILABILITY');\" style=\"width:75px;\""); sbSQL.Append(boolHADisabled == true ? " disabled" : ""); sbSQL.Append(">"); sbSQL.Append("<option value=\"No\""); sbSQL.Append(dr["high_availability"].ToString() == "0" ? " selected" : ""); sbSQL.Append(">No</option>"); sbSQL.Append("<option value=\"Yes\""); sbSQL.Append(dr["high_availability"].ToString() == "1" ? " selected" : ""); sbSQL.Append(">Yes</option>"); sbSQL.Append("</select>"); sbSQL.Append("</td>"); sbSQL.Append("</tr>"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_PERFORMANCE\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_PERFORMANCE\" value=\""); sbHidden.Append(dr["performance"].ToString()); sbHidden.Append("\" />"); if (boolProd == true) { sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE\" value=\""); sbHidden.Append(dr["size"].ToString()); sbHidden.Append("\" />"); } else { sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE\" value=\"0\" />"); } if (boolQA == true) { sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_QA\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_QA\" value=\""); sbHidden.Append(dr["size_qa"].ToString()); sbHidden.Append("\" />"); } else { sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_QA\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_QA\" value=\"0\" />"); } if (boolTest == true) { sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_TEST\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_TEST\" value=\""); sbHidden.Append(dr["size_test"].ToString()); sbHidden.Append("\" />"); } else { sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_TEST\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_TEST\" value=\"0\" />"); } if (boolProd == true && boolUnder == true) { sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_REPLICATED\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_REPLICATED\" value=\""); sbHidden.Append(dr["replicated"].ToString() == "1" ? "Yes" : "No"); sbHidden.Append("\" />"); } else { sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_REPLICATED\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_REPLICATED\" value=\"No\" />"); } sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_HIGH_AVAILABILITY\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_HIGH_AVAILABILITY\" value=\""); sbHidden.Append(dr["high_availability"].ToString() == "1" ? "Yes" : "No"); sbHidden.Append("\" />"); } } btnSave.Attributes.Add("onclick", "return EnsureTextbox0();"); if (boolCreateCLU == true) { oStorage.AddLun(intAnswer, 0, intCluster, 0, 0, -1, (boolProd ? 1.00 : 0.00), (boolQA ? 1.00 : 0.00), (boolTest ? 1.00 : 0.00)); } if (boolCreateDTC == true) { oStorage.AddLun(intAnswer, 0, intCluster, 0, 0, -10, (boolProd ? 1.00 : 0.00), (boolQA ? 1.00 : 0.00), (boolTest ? 1.00 : 0.00)); } if (boolCreateCLU == true || boolCreateDTC == true) { Response.Redirect(Request.Path + "?aid=" + intAnswer + "&id=" + intCluster); } } } } strSQL = sbSQL.ToString(); strHidden = sbHidden.ToString(); } btnClose.Attributes.Add("onclick", "return window.close();"); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "loader", "<script type=\"text/javascript\">CatchClose();<" + "/" + "script>"); }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oStorage = new Storage(intProfile, dsn); oServer = new Servers(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oClass = new Classes(intProfile, dsn); if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "") { intAnswer = Int32.Parse(Request.QueryString["aid"]); } if (Request.QueryString["clusterid"] != null && Request.QueryString["clusterid"] != "") { intCluster = Int32.Parse(Request.QueryString["clusterid"]); } if (Request.QueryString["csmid"] != null && Request.QueryString["csmid"] != "") { intConfig = Int32.Parse(Request.QueryString["csmid"]); } if (Request.QueryString["num"] != null && Request.QueryString["num"] != "") { intNumber = Int32.Parse(Request.QueryString["num"]); } if (intAnswer > 0) { StringBuilder sbSQL = new StringBuilder(strSQL); StringBuilder sbHidden = new StringBuilder(strHidden); DataSet ds = oForecast.GetAnswer(intAnswer); if (ds.Tables[0].Rows.Count > 0) { int intClass = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()); int intModel = oForecast.GetModel(intAnswer); bool boolHADisabled = (oModelsProperties.IsHighAvailability(intModel) == false); if (oClass.IsProd(intClass)) { boolProd = true; if (oForecast.GetAnswer(intAnswer, "test") == "1") { boolTest = true; } } else if (oClass.IsQA(intClass)) { boolQA = true; } else { boolTest = true; } intRequest = oForecast.GetRequestID(intAnswer, true); if (!IsPostBack) { ds = oStorage.GetLuns(intAnswer, 0, intCluster, intConfig, intNumber); bool boolOther = false; int intRow = 0; int intFDrive = 0; int intEDrive = 0; if (oClass.Get(intClass, "pnc") == "1") { intFDrive = 1; } else { intEDrive = 1; } foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["driveid"].ToString() == "-100" || dr["driveid"].ToString() == "-1000") { // -100 is hardcoded to be F: drive, -1000 is hardcoded to be E: drive intRow++; boolOther = !boolOther; sbSQL.Append("<tr"); sbSQL.Append(boolOther ? " bgcolor=\"F6F6F6\"" : ""); sbSQL.Append(">"); sbSQL.Append("<td valign=\"top\">"); sbSQL.Append(intRow); sbSQL.Append("</td>"); if (dr["driveid"].ToString() == "-100") { sbSQL.Append("<td valign=\"top\">F:</td>"); intFDrive = -1; } if (dr["driveid"].ToString() == "-1000") { sbSQL.Append("<td valign=\"top\">E:</td>"); intEDrive = -1; } sbSQL.Append("<td valign=\"top\">"); sbSQL.Append("<select class=\"default\" onchange=\"UpdateDDL(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_PERFORMANCE');\" style=\"width:100px;\">"); sbSQL.Append("<option value=\"High\""); sbSQL.Append(dr["performance"].ToString() == "High" ? " selected" : ""); sbSQL.Append(">High</option>"); sbSQL.Append("<option value=\"Standard\""); sbSQL.Append(dr["performance"].ToString() == "Standard" ? " selected" : ""); sbSQL.Append(">Standard</option>"); sbSQL.Append("<option value=\"Low\""); sbSQL.Append(dr["performance"].ToString() == "Low" ? " selected" : ""); sbSQL.Append(">Low</option>"); sbSQL.Append("</select>"); sbSQL.Append("</td>"); if (boolProd == true) { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" onblur=\"UpdateText(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_SIZE');\" value=\""); sbSQL.Append(dr["size"].ToString()); sbSQL.Append("\" /> GB</td>"); } else { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" value=\"0\" disabled=\"disabled\" /> GB</td>"); } if (boolQA == true) { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" onblur=\"UpdateText(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_SIZE_QA');\" value=\""); sbSQL.Append(dr["size_qa"].ToString()); sbSQL.Append("\" /> GB</td>"); } else { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" value=\"0\" disabled=\"disabled\" /> GB</td>"); } if (boolTest == true) { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" onblur=\"UpdateText(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_SIZE_TEST');\" value=\""); sbSQL.Append(dr["size_test"].ToString()); sbSQL.Append("\" /> GB</td>"); } else { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" value=\"0\" disabled=\"disabled\" /> GB</td>"); } sbSQL.Append("<td valign=\"top\">"); sbSQL.Append("<select class=\"default\" onchange=\"UpdateDDL(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_REPLICATED');\" style=\"width:75px;\">"); sbSQL.Append("<option value=\"No\""); sbSQL.Append(dr["replicated"].ToString() == "0" ? " selected" : ""); sbSQL.Append(">No</option>"); sbSQL.Append("<option value=\"Yes\""); sbSQL.Append(dr["replicated"].ToString() == "1" ? " selected" : ""); sbSQL.Append(">Yes</option>"); sbSQL.Append("</select>"); sbSQL.Append("</td>"); sbSQL.Append("<td valign=\"top\">"); sbSQL.Append("<select class=\"default\" onchange=\"UpdateDDL(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_HIGH_AVAILABILITY');\" style=\"width:75px;\""); sbSQL.Append(boolHADisabled == true ? " disabled" : ""); sbSQL.Append(">"); sbSQL.Append("<option value=\"No\""); sbSQL.Append(dr["high_availability"].ToString() == "0" ? " selected" : ""); sbSQL.Append(">No</option>"); sbSQL.Append("<option value=\"Yes\""); sbSQL.Append(dr["high_availability"].ToString() == "1" ? " selected" : ""); sbSQL.Append(">Yes</option>"); sbSQL.Append("</select>"); sbSQL.Append("</td>"); sbSQL.Append("</tr>"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_PERFORMANCE\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_PERFORMANCE\" value=\""); sbHidden.Append(dr["performance"].ToString()); sbHidden.Append("\" />"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE\" value=\""); sbHidden.Append(dr["size"].ToString()); sbHidden.Append("\" />"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_QA\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_QA\" value=\""); sbHidden.Append(dr["size_qa"].ToString()); sbHidden.Append("\" />"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_TEST\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_TEST\" value=\""); sbHidden.Append(dr["size_test"].ToString()); sbHidden.Append("\" />"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_REPLICATED\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_REPLICATED\" value=\""); sbHidden.Append(dr["replicated"].ToString() == "1" ? "Yes" : "No"); sbHidden.Append("\" />"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_HIGH_AVAILABILITY\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_HIGH_AVAILABILITY\" value=\""); sbHidden.Append(dr["high_availability"].ToString() == "1" ? "Yes" : "No"); sbHidden.Append("\" />"); } } if (intFDrive == 1) { oStorage.AddLun(intAnswer, 0, intCluster, intConfig, intNumber, -100, 0.00, 0.00, 0.00); Response.Redirect(Request.Path + "?aid=" + Request.QueryString["aid"] + "&clusterid=" + Request.QueryString["clusterid"] + "&csmid=" + Request.QueryString["csmid"] + "&num=" + Request.QueryString["num"]); } if (intEDrive == 1) { oStorage.AddLun(intAnswer, 0, intCluster, intConfig, intNumber, -1000, 0.00, 0.00, 0.00); Response.Redirect(Request.Path + "?aid=" + Request.QueryString["aid"] + "&clusterid=" + Request.QueryString["clusterid"] + "&csmid=" + Request.QueryString["csmid"] + "&num=" + Request.QueryString["num"]); } } } strSQL = sbSQL.ToString(); strHidden = sbHidden.ToString(); } btnClose.Attributes.Add("onclick", "return window.close();"); }
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); oClass = new Classes(intProfile, dsn); oCSMConfig = new CSMConfig(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oServer = new Servers(intProfile, dsn); oStorage = new Storage(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oVMWare = new VMWare(intProfile, dsn); oConsistencyGroup = new ConsistencyGroups(intProfile, dsn); oServerName = new ServerName(intProfile, dsn); oUser = new Users(intProfile, dsn); oOperatingSystem = new OperatingSystems(intProfile, dsn); if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "") { intAnswer = Int32.Parse(Request.QueryString["aid"]); } if (Request.QueryString["clusterid"] != null && Request.QueryString["clusterid"] != "") { intCluster = Int32.Parse(Request.QueryString["clusterid"]); } if (Request.QueryString["csmid"] != null && Request.QueryString["csmid"] != "") { intConfig = Int32.Parse(Request.QueryString["csmid"]); } if (Request.QueryString["num"] != null && Request.QueryString["num"] != "") { intNumber = Int32.Parse(Request.QueryString["num"]); } int intMenuTab = 0; if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "") { intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]); } if (Request.QueryString["refresh"] != null) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "refresh", "<script type=\"text/javascript\">RefreshOpeningWindow();<" + "/" + "script>"); } if (Request.QueryString["save"] != null) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "save", "<script type=\"text/javascript\">RefreshOpeningWindow();window.close();<" + "/" + "script>"); } else if (Request.QueryString["required"] != null) { if (Request.QueryString["dba"] != null) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "dba", "<script type=\"text/javascript\">RefreshOpeningWindow();alert('Please enter a database administrator');<" + "/" + "script>"); intMenuTab = 1; } } int intServer = 0; int intDR = 0; if (intAnswer > 0) { Page.Title = "ClearView Configure Device | Design # " + intAnswer.ToString(); DataSet ds = oForecast.GetAnswer(intAnswer); if (ds.Tables[0].Rows.Count > 0) { Tab oTab = new Tab("", intMenuTab, "divMenu1", true, false); oTab.AddTab("1.) General Information", ""); oTab.AddTab("2.) Software Components", ""); strMenuTab1 = oTab.GetTabs(); int intModel = oForecast.GetModel(intAnswer); int intType = oModelsProperties.GetType(intModel); int intDRForecast = Int32.Parse(oForecast.TotalDRCount(intAnswer, boolUseCSM).ToString()); int intDRCurrent = Int32.Parse(ds.Tables[0].Rows[0]["recovery_number"].ToString()); int intHAForecast = Int32.Parse(oForecast.TotalHACount(intAnswer, boolUseCSM).ToString()); int intHACurrent = Int32.Parse(ds.Tables[0].Rows[0]["ha"].ToString()); bool boolHADisabled = (oModelsProperties.IsHighAvailability(intModel) == false); bool boolHA = oForecast.IsHARoom(intAnswer); int _classid = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()); if (oClass.Get(_classid, "prod") == "1") { if (oModelsProperties.IsStorageDE_FDriveMustBeOnSAN(intModel) == true) { radDRNo.Checked = false; radDRYes.Checked = true; radDRNo.Enabled = false; radDRYes.Enabled = false; divDR1.Style["display"] = "inline"; divDR2.Style["display"] = "inline"; } if (ds.Tables[0].Rows[0]["test"].ToString() == "1") { panTest.Visible = true; } } if (boolHA == false) { radHANo.Checked = true; radHAYes.Checked = false; radHANo.Enabled = false; radHAYes.Enabled = false; } if (intCluster > 0) { panCluster.Visible = false; radHANo.Checked = true; radHAYes.Checked = false; radHANo.Enabled = false; radHAYes.Enabled = false; radDRNo.Checked = true; radDRYes.Checked = false; radDRNo.Enabled = false; radDRYes.Enabled = false; divDR1.Style["display"] = "none"; divDR2.Style["display"] = "none"; } int _environmentid = Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString()); intServer = Int32.Parse(ds.Tables[0].Rows[0]["quantity"].ToString()) - oForecast.TotalServerCount(intAnswer, boolUseCSM); intDR = Int32.Parse(ds.Tables[0].Rows[0]["recovery_number"].ToString()) - oForecast.TotalDRCount(intAnswer, boolUseCSM); intRequest = oForecast.GetRequestID(intAnswer, true); if (ds.Tables[0].Rows[0]["applicationid"].ToString() == "0") { panInfrastructure.Visible = true; } if (!IsPostBack) { LoadLists(_classid, _environmentid); int intDBA = 0; ds = oServer.Get(intAnswer, intConfig, intCluster, intNumber); if (ds.Tables[0].Rows.Count > 0) { panComponents.Visible = true; frmComponents.Attributes.Add("src", "/frame/ondemand/config_server_components.aspx" + Request.Url.Query); intServer = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()); Page.Title = "ClearView Configure Device | Server # " + intServer.ToString(); if (ds.Tables[0].Rows[0]["step"].ToString() != "0") { btnSaveConfig.Visible = false; } lblId.Text = intServer.ToString(); Int32.TryParse(ds.Tables[0].Rows[0]["osid"].ToString(), out intOS); if (intOS > 0 && ddlOS.SelectedValue == "0") { ddlOS.SelectedValue = intOS.ToString(); } int intSP = 0; Int32.TryParse(ds.Tables[0].Rows[0]["spid"].ToString(), out intSP); ddlServicePack.SelectedValue = intSP.ToString(); ddlMaintenance.SelectedValue = intSP.ToString(); ddlTemplate.SelectedValue = ds.Tables[0].Rows[0]["templateid"].ToString(); ddlDomain.SelectedValue = ds.Tables[0].Rows[0]["domainid"].ToString(); ddlTestDomain.SelectedValue = ds.Tables[0].Rows[0]["test_domainid"].ToString(); intDBA = Int32.Parse(ds.Tables[0].Rows[0]["dba"].ToString()); if (ds.Tables[0].Rows[0]["infrastructure"].ToString() == "1") { radInfrastructureYes.Checked = true; } else { radInfrastructureNo.Checked = true; } if (ds.Tables[0].Rows[0]["ha"].ToString() == "1") { radHAYes.Checked = true; } else { radHANo.Checked = true; } if (ds.Tables[0].Rows[0]["dr"].ToString() == "1") { radDRYes.Checked = true; divDR1.Style["display"] = "inline"; if (ds.Tables[0].Rows[0]["dr_exist"].ToString() == "1") { radExistYes.Checked = true; divExist.Style["display"] = "inline"; txtRecovery.Text = ds.Tables[0].Rows[0]["dr_name"].ToString(); } else { radExistNo.Checked = true; } divDR2.Style["display"] = "inline"; if (ds.Tables[0].Rows[0]["dr_consistency"].ToString() == "1") { radConsistencyYes.Checked = true; divConsistency1.Style["display"] = "inline"; divConsistency2.Style["display"] = "inline"; int intConsistency = Int32.Parse(ds.Tables[0].Rows[0]["dr_consistencyid"].ToString()); hdnConsistencyGroup.Value = intConsistency.ToString(); txtConsistencyGroup.Text = oConsistencyGroup.Get(intConsistency, "name"); } else { radConsistencyNo.Checked = true; } } else { radDRNo.Checked = true; } // Check selected items DataSet dsSelected = oServerName.GetComponentDetailSelected(intServer, 1); foreach (DataRow drSelected in dsSelected.Tables[0].Rows) { if (drSelected["sql"].ToString() == "1" || drSelected["dbase"].ToString() == "1") { divDBA.Style["display"] = "inline"; if (intDBA > 0) { txtUser.Text = oUser.GetFullName(intDBA) + " (" + oUser.GetName(intDBA) + ")"; hdnUser.Value = intDBA.ToString(); } } } } else { panComponentsNo.Visible = true; } } if (intDRCurrent < intDRForecast || (intDRCurrent == intDRForecast && radDRYes.Checked == false)) { radDRNo.Checked = true; radDRYes.Checked = false; radDRNo.Enabled = false; radDRYes.Enabled = false; divDR1.Style["display"] = "none"; divDR2.Style["display"] = "none"; } if (intHACurrent < intHAForecast || (intHACurrent == intHAForecast && radHAYes.Checked == false)) { radHANo.Checked = true; radHAYes.Checked = false; radHANo.Enabled = false; radHAYes.Enabled = false; } btnClose.Attributes.Add("onclick", "return window.close();"); if (oModelsProperties.IsConfigServicePack(intModel) == true || oOperatingSystem.IsWindows(intOS) == true || oOperatingSystem.IsWindows2008(intOS) == true) { panSP.Visible = true; } if (oModelsProperties.IsConfigVMWareTemplate(intModel) == true) { panTemplate.Visible = true; } if (oModelsProperties.IsConfigMaintenanceLevel(intModel) == true) { panMaintenance.Visible = true; } string strInfrastructure = ""; if (panInfrastructure.Visible == true) { strInfrastructure = " && ValidateRadioButtons('" + radInfrastructureYes.ClientID + "','" + radInfrastructureNo.ClientID + "','Please choose if this server is an infrastructure server')"; } string strTemplate = ""; if (panTemplate.Visible == true) { strTemplate = " && ValidateDropDown('" + ddlTemplate.ClientID + "','Please select a template')"; } string strSP = ""; if (panSP.Visible == true) { strSP = " && ValidateDropDown('" + ddlServicePack.ClientID + "','Please select a service pack')"; } if (panMaintenance.Visible == true) { strSP = " && ValidateDropDown('" + ddlMaintenance.ClientID + "','Please select a maintenance level')"; } string strHA = ""; string strDR = ""; if (panCluster.Visible == true) { strHA = " && ValidateRadioButtons('" + radHAYes.ClientID + "','" + radHANo.ClientID + "','Please choose if this server has an HA counterpart')"; strDR = " && EnsureDR('" + radDRYes.ClientID + "','" + radDRNo.ClientID + "','" + radExistYes.ClientID + "','" + radExistNo.ClientID + "','" + txtRecovery.ClientID + "','" + radConsistencyYes.ClientID + "','" + radConsistencyNo.ClientID + "','" + hdnConsistencyGroup.ClientID + "')"; } btnSaveConfig.Attributes.Add("onclick", "return ValidateDropDown('" + ddlDomain.ClientID + "','Please select a domain')" + " && ValidateHiddenDisabled('" + hdnUser.ClientID + "','" + txtUser.ClientID + "','Please enter a username, first name or last name')" + strSP + strTemplate + " && ValidateDropDown('" + ddlTestDomain.ClientID + "','Please select a domain')" + strInfrastructure + strHA + strDR + ";"); } } else { btnSaveConfig.Enabled = false; } radDRYes.Attributes.Add("onclick", "ShowHideDiv('" + divDR1.ClientID + "','inline');ShowHideDiv('" + divDR2.ClientID + "','inline');ShowHideDivCheck('" + divExist.ClientID + "',document.getElementById('" + radExistYes.ClientID + "'));ShowHideDivCheck('" + divConsistency1.ClientID + "',document.getElementById('" + radConsistencyYes.ClientID + "'));ShowHideDivCheck('" + divConsistency2.ClientID + "',document.getElementById('" + radConsistencyYes.ClientID + "'));"); radDRNo.Attributes.Add("onclick", "ShowHideDiv('" + divDR1.ClientID + "','none');ShowHideDiv('" + divDR2.ClientID + "','none');ShowHideDiv('" + divExist.ClientID + "','none');ShowHideDiv('" + divConsistency1.ClientID + "','none');ShowHideDiv('" + divConsistency2.ClientID + "','none');"); radExistYes.Attributes.Add("onclick", "ShowHideDiv('" + divExist.ClientID + "','inline');"); radExistNo.Attributes.Add("onclick", "ShowHideDiv('" + divExist.ClientID + "','none');"); radConsistencyYes.Attributes.Add("onclick", "ShowHideDiv('" + divConsistency1.ClientID + "','inline');ShowHideDiv('" + divConsistency2.ClientID + "','inline');"); radConsistencyNo.Attributes.Add("onclick", "ShowHideDiv('" + divConsistency1.ClientID + "','none');ShowHideDiv('" + divConsistency2.ClientID + "','none');"); btnConsistencyServer.Attributes.Add("onclick", "return ShowConsistency('CONSISTENCY_SERVER','?id=0','" + txtConsistencyGroup.ClientID + "','" + hdnConsistencyGroup.ClientID + "');"); btnConsistencyName.Attributes.Add("onclick", "return ShowConsistency('CONSISTENCY_SELECT','?id=0','" + txtConsistencyGroup.ClientID + "','" + hdnConsistencyGroup.ClientID + "');"); btnConsistencyNew.Attributes.Add("onclick", "return ShowConsistency('CONSISTENCY_NEW','?id=0','" + txtConsistencyGroup.ClientID + "','" + hdnConsistencyGroup.ClientID + "');"); Variables oVariable = new Variables(intEnvironment); txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'250','195','" + divAJAX.ClientID + "','" + lstAJAX.ClientID + "','" + hdnUser.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);"); lstAJAX.Attributes.Add("ondblclick", "AJAXClickRow();"); }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oCluster = new Cluster(intProfile, dsn); oStorage = new Storage(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oClass = new Classes(intProfile, dsn); if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "") { intAnswer = Int32.Parse(Request.QueryString["aid"]); } if (Request.QueryString["cid"] != null && Request.QueryString["cid"] != "") { intCluster = Int32.Parse(Request.QueryString["cid"]); } if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intInstance = Int32.Parse(Request.QueryString["id"]); } if (intInstance > 0) { StringBuilder sbSQL = new StringBuilder(strSQL); StringBuilder sbHidden = new StringBuilder(strHidden); DataSet ds = oCluster.GetInstance(intInstance); if (ds.Tables[0].Rows.Count > 0) { if (!IsPostBack) { int intRequest = oForecast.GetRequestID(intAnswer, true); int intModel = oForecast.GetModel(intAnswer); bool boolHADisabled = (oModelsProperties.IsHighAvailability(intModel) == false); panView.Visible = true; ds = oStorage.GetLuns(intAnswer, intInstance, intCluster, 0, 0); bool boolOverride = (oForecast.GetAnswer(intAnswer, "storage_override") == "1"); int intClass = Int32.Parse(oForecast.GetAnswer(intAnswer, "classid")); if (oClass.IsProd(intClass)) { boolProd = true; if (oForecast.GetAnswer(intAnswer, "test") == "1") { boolTest = true; } } else if (oClass.IsQA(intClass)) { boolQA = true; } else { boolTest = true; } bool boolOther = false; int intNumber = 0; foreach (DataRow dr in ds.Tables[0].Rows) { intNumber++; boolOther = !boolOther; sbSQL.Append("<tr"); sbSQL.Append(boolOther ? " bgcolor=\"F6F6F6\"" : ""); sbSQL.Append(">"); sbSQL.Append("<td valign=\"top\">"); sbSQL.Append(intNumber); sbSQL.Append("</td>"); string strLetter = dr["letter"].ToString(); if (strLetter == "") { if (dr["driveid"].ToString() == "-1000") { strLetter = "E"; } else if (dr["driveid"].ToString() == "-100") { strLetter = "F"; } else if (dr["driveid"].ToString() == "-10") { strLetter = "P"; } else if (dr["driveid"].ToString() == "-1") { strLetter = "Q"; } } if (boolOverride == false) { sbSQL.Append("<td valign=\"top\">"); sbSQL.Append(strLetter); sbSQL.Append(":"); sbSQL.Append(dr["path"].ToString()); sbSQL.Append("</td>"); } else { sbSQL.Append("<td valign=\"top\">"); sbSQL.Append(dr["path"].ToString()); sbSQL.Append("</td>"); } sbSQL.Append("<td valign=\"top\">"); sbSQL.Append("<select class=\"default\" onchange=\"UpdateDDL(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_PERFORMANCE');\" style=\"width:100px;\">"); sbSQL.Append("<option value=\"High\""); sbSQL.Append(dr["performance"].ToString() == "High" ? " selected" : ""); sbSQL.Append(">High</option>"); sbSQL.Append("<option value=\"Standard\""); sbSQL.Append(dr["performance"].ToString() == "Standard" ? " selected" : ""); sbSQL.Append(">Standard</option>"); sbSQL.Append("<option value=\"Low\""); sbSQL.Append(dr["performance"].ToString() == "Low" ? " selected" : ""); sbSQL.Append(">Low</option>"); sbSQL.Append("</select>"); sbSQL.Append("</td>"); if (boolProd == true) { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\""); sbSQL.Append(intNumber == 1 && ds.Tables[0].Rows.Count > 1 ? " disabled" : ""); sbSQL.Append(" onblur=\"UpdateText(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_SIZE');\" value=\""); sbSQL.Append(dr["size"].ToString()); sbSQL.Append("\" /> GB</td>"); } else { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" value=\"0\" disabled=\"disabled\" /> GB</td>"); } if (boolQA == true) { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\""); sbSQL.Append(intNumber == 1 && ds.Tables[0].Rows.Count > 1 ? " disabled" : ""); sbSQL.Append(" onblur=\"UpdateText(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_SIZE_QA');\" value=\""); sbSQL.Append(dr["size_qa"].ToString()); sbSQL.Append("\" /> GB</td>"); } else { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" value=\"0\" disabled=\"disabled\" /> GB</td>"); } if (boolTest == true) { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\""); sbSQL.Append(intNumber == 1 && ds.Tables[0].Rows.Count > 1 ? " disabled" : ""); sbSQL.Append(" onblur=\"UpdateText(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_SIZE_TEST');\" value=\""); sbSQL.Append(dr["size_test"].ToString()); sbSQL.Append("\" /> GB</td>"); } else { sbSQL.Append("<td valign=\"top\"><input type=\"text\" name=\"ValidTextbox0\" class=\"default\" style=\"width:75px\" value=\"0\" disabled=\"disabled\" /> GB</td>"); } sbSQL.Append("<td valign=\"top\">"); sbSQL.Append("<select class=\"default\" onchange=\"UpdateDDL(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_REPLICATED');\" style=\"width:75px;\">"); sbSQL.Append("<option value=\"No\""); sbSQL.Append(dr["replicated"].ToString() == "0" ? " selected" : ""); sbSQL.Append(">No</option>"); sbSQL.Append("<option value=\"Yes\""); sbSQL.Append(dr["replicated"].ToString() == "1" ? " selected" : ""); sbSQL.Append(">Yes</option>"); sbSQL.Append("</select>"); sbSQL.Append("</td>"); sbSQL.Append("<td valign=\"top\">"); sbSQL.Append("<select class=\"default\" onchange=\"UpdateDDL(this,'HDN_"); sbSQL.Append(dr["id"].ToString()); sbSQL.Append("_HIGH_AVAILABILITY');\" style=\"width:75px;\""); sbSQL.Append(boolHADisabled == true ? " disabled" : ""); sbSQL.Append(">"); sbSQL.Append("<option value=\"No\""); sbSQL.Append(dr["high_availability"].ToString() == "0" ? " selected" : ""); sbSQL.Append(">No</option>"); sbSQL.Append("<option value=\"Yes\""); sbSQL.Append(dr["high_availability"].ToString() == "1" ? " selected" : ""); sbSQL.Append(">Yes</option>"); sbSQL.Append("</select>"); sbSQL.Append("</td>"); sbSQL.Append("</tr>"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_PERFORMANCE\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_PERFORMANCE\" value=\""); sbHidden.Append(dr["performance"].ToString()); sbHidden.Append("\" />"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE\" value=\""); sbHidden.Append(dr["size"].ToString()); sbHidden.Append("\" />"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_QA\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_QA\" value=\""); sbHidden.Append(dr["size_qa"].ToString()); sbHidden.Append("\" />"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_TEST\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_SIZE_TEST\" value=\""); sbHidden.Append(dr["size_test"].ToString()); sbHidden.Append("\" />"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_REPLICATED\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_REPLICATED\" value=\""); sbHidden.Append(dr["replicated"].ToString() == "1" ? "Yes" : "No"); sbHidden.Append("\" />"); sbHidden.Append("<input type=\"hidden\" name=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_HIGH_AVAILABILITY\" id=\"HDN_"); sbHidden.Append(dr["id"].ToString()); sbHidden.Append("_HIGH_AVAILABILITY\" value=\""); sbHidden.Append(dr["high_availability"].ToString() == "1" ? "Yes" : "No"); sbHidden.Append("\" />"); } } } strSQL = sbSQL.ToString(); strHidden = sbHidden.ToString(); } btnClose.Attributes.Add("onclick", "return window.close();"); }
protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oServer = new Servers(intProfile, dsn); oServerName = new ServerName(intProfile, dsn); oCluster = new Cluster(intProfile, dsn); oForecast = new Forecast(intProfile, dsn); oStorage = new Storage(intProfile, dsn); oRequest = new Requests(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oClass = new Classes(intProfile, dsn); if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "") { intAnswer = Int32.Parse(Request.QueryString["aid"]); } if (Request.QueryString["cid"] != null && Request.QueryString["cid"] != "") { intCluster = Int32.Parse(Request.QueryString["cid"]); } if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intInstance = Int32.Parse(Request.QueryString["id"]); } if (Request.QueryString["save"] != null) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "save", "<script type=\"text/javascript\">window.parent.navigate(window.parent.location.href);alert('Storage Configuration Saved');window.close();<" + "/" + "script>"); } if (intAnswer > 0) { DataSet ds = oForecast.GetAnswer(intAnswer); if (ds.Tables[0].Rows.Count > 0) { int intModel = oForecast.GetModel(intAnswer); int intType = oModelsProperties.GetType(intModel); if (oForecast.IsOSMidrange(intAnswer) == true) { boolMidrange = true; } bool boolHADisabled = (oModelsProperties.IsHighAvailability(intModel) == false); int intClass = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()); bool boolPNC = (oClass.Get(intClass, "pnc") == "1"); boolOverride = (ds.Tables[0].Rows[0]["storage_override"].ToString() == "1"); if (oClass.IsProd(intClass)) { boolProd = true; if (oForecast.GetAnswer(intAnswer, "test") == "1") { boolTest = true; } } else if (oClass.IsQA(intClass)) { boolQA = true; } else { boolTest = true; } if (boolTest == false) { txtTest.Text = "0"; txtTest.Enabled = false; txtAmountTest.Text = "0"; txtAmountTest.Enabled = false; txtMountTest.Text = "0"; txtMountTest.Enabled = false; } if (boolQA == false) { txtQA.Text = "0"; txtQA.Enabled = false; txtAmountQA.Text = "0"; txtAmountQA.Enabled = false; txtMountQA.Text = "0"; txtMountQA.Enabled = false; } if (boolProd == false) { txtSize.Text = "0"; txtSize.Enabled = false; txtAmountProd.Text = "0"; txtAmountProd.Enabled = false; txtMountProd.Text = "0"; txtMountProd.Enabled = false; ddlReplicated.SelectedValue = "No"; ddlReplicated.Enabled = false; ddlHigh.SelectedValue = "No"; ddlHigh.Enabled = false; ddlMountReplicated.SelectedValue = "No"; ddlMountReplicated.Enabled = false; ddlMountHigh.SelectedValue = "No"; ddlMountHigh.Enabled = false; } if (intInstance > 0) { ds = oStorage.GetLuns(intAnswer, intInstance, intCluster, 0, 0); foreach (DataRow dr in ds.Tables[0].Rows) { string strPath = dr["path"].ToString(); if (strPath != "") { if (strPaths != "") { strPaths += ","; } while (strPath != "" && strPath.EndsWith("\\") == true) { strPath = strPath.Substring(0, strPath.Length - 1); } strPaths += "\"" + strPath + "\""; } DataSet dsPoints = oStorage.GetMountPoints(Int32.Parse(dr["id"].ToString())); foreach (DataRow drPoint in dsPoints.Tables[0].Rows) { strPath = drPoint["path"].ToString(); if (strPath != "") { if (strPaths != "") { strPaths += ","; } while (strPath != "" && strPath.EndsWith("\\") == true) { strPath = strPath.Substring(0, strPath.Length - 1); } strPaths += "\"" + strPath + "\""; } } } } if (!IsPostBack) { string strFilesystem = ""; if (intInstance == 0) { panName.Visible = true; ds = oServer.Get(intAnswer, 0, intCluster, 0); if (ds.Tables[0].Rows.Count > 0) { bool boolSQL2008 = false; int intServer = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()); ds = oServerName.GetComponentDetailSelected(intServer, 1); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["sql"].ToString() == "1" || dr["dbase"].ToString() == "1") { boolDatabase = true; if (dr["name"].ToString().Contains("2008") == true) { boolSQL2008 = true; } } } lblDatabase.Text = (boolDatabase ? (boolSQL2008 ? "2008" : "1") : "0"); if (boolDatabase == true && boolMidrange == false) { panSQL.Visible = true; if (Request.QueryString["sql"] != null && Request.QueryString["sql"] == "yes") { txtName.Text = Request.QueryString["name"]; radYes.Checked = true; if (boolPNC == false) { panDatabase.Visible = true; radNonYes.Attributes.Add("onclick", "ShowHideDiv('" + divNon.ClientID + "','inline');"); radNonNo.Attributes.Add("onclick", "ShowHideDiv('" + divNon.ClientID + "','none');"); btnGenerate.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a nickname')" + " && ValidateNumber('" + txtSize.ClientID + "','Please enter a valid size')" + " && ValidateNumber('" + txtQA.ClientID + "','Please enter a valid size')" + " && ValidateNumber('" + txtTest.ClientID + "','Please enter a valid size')" + " && ValidateRadioButtons('" + radNonYes.ClientID + "','" + radNonNo.ClientID + "','Please select whether or not you want to store non-database data on the same instance')" + " && (document.getElementById('" + radNonYes.ClientID + "').checked == false || (document.getElementById('" + radNonYes.ClientID + "').checked == true && ValidateNumber('" + txtNon.ClientID + "','Please enter a valid size')))" + " && (document.getElementById('" + radNonYes.ClientID + "').checked == false || (document.getElementById('" + radNonYes.ClientID + "').checked == true && ValidateNumber('" + txtNonQA.ClientID + "','Please enter a valid size')))" + " && (document.getElementById('" + radNonYes.ClientID + "').checked == false || (document.getElementById('" + radNonYes.ClientID + "').checked == true && ValidateNumber('" + txtNonTest.ClientID + "','Please enter a valid size')))" + ";"); } else { panDatabasePNC.Visible = true; radNonPNCYes.Attributes.Add("onclick", "ShowHideDiv('" + divNonPNC.ClientID + "','inline');"); radNonPNCNo.Attributes.Add("onclick", "ShowHideDiv('" + divNonPNC.ClientID + "','none');"); btnGeneratePNC.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a nickname')" + " && ValidateNumber('" + txtSizePNC.ClientID + "','Please enter a valid size')" + " && ValidateNumber0('" + txtPercentPNC.ClientID + "', 'Please enter a valid whole number percentage for the total space of the largest Table and/or Index')" + " && ValidateNumber0('" + txtTempPNC.ClientID + "', 'Please enter a valid number for the amount of storage of TempDB')" + " && ValidateRadioButtons('" + radNonPNCYes.ClientID + "','" + radNonPNCNo.ClientID + "','Please select whether or not you want to store non-database data on the same instance')" + " && (document.getElementById('" + radNonPNCYes.ClientID + "').checked == false || (document.getElementById('" + radNonPNCYes.ClientID + "').checked == true && ValidateNumber('" + txtNonPNC.ClientID + "','Please enter a valid size')))" + ";"); } } if (Request.QueryString["sql"] != null && Request.QueryString["sql"] == "no") { txtName.Text = Request.QueryString["name"]; radNo.Checked = true; panDatabaseNo.Visible = true; if (boolMidrange) { panFilesystem.Visible = true; strFilesystem = " && ValidateText('" + txtFilesystem.ClientID + "','Please enter a filesystem') && PathIsOK('" + txtFilesystem.ClientID + "')"; } btnSave.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a nickname')" + " && ValidateDropDown('" + ddlPerformance.ClientID + "','Please select a performance')" + strFilesystem + " && ValidateNumber('" + txtAmountProd.ClientID + "','Please enter a valid size')" + " && ValidateNumber('" + txtAmountTest.ClientID + "','Please enter a valid size')" + " && ValidateDropDown('" + ddlReplicated.ClientID + "','Please select a replicated option')" + " && ValidateDropDown('" + ddlHigh.ClientID + "','Please select a high availability')" + " && ValidateRadioButtons('" + radMountYes.ClientID + "','" + radMountNo.ClientID + "','Please select whether or not you want to add mount points')" + ";"); } } else { panDatabaseNo.Visible = true; if (boolMidrange) { panFilesystem.Visible = true; strFilesystem = " && ValidateText('" + txtFilesystem.ClientID + "','Please enter a filesystem') && PathIsOK('" + txtFilesystem.ClientID + "')"; } btnSave.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a nickname')" + " && ValidateDropDown('" + ddlPerformance.ClientID + "','Please select a performance')" + strFilesystem + " && ValidateNumber('" + txtAmountProd.ClientID + "','Please enter a valid size')" + " && ValidateNumber('" + txtAmountTest.ClientID + "','Please enter a valid size')" + " && ValidateDropDown('" + ddlReplicated.ClientID + "','Please select a replicated option')" + " && ValidateDropDown('" + ddlHigh.ClientID + "','Please select a high availability')" + " && ValidateRadioButtons('" + radMountYes.ClientID + "','" + radMountNo.ClientID + "','Please select whether or not you want to add mount points')" + ";"); } } } else { panMount.Visible = true; if (boolMidrange) { panMountFilesystem.Visible = true; strFilesystem = " && ValidateText('" + txtMountFilesystem.ClientID + "','Please enter a filesystem') && PathIsOK('" + txtMountFilesystem.ClientID + "')"; } int intLun = oStorage.GetLun(intAnswer, intInstance, intCluster, 0, 0); int intCount = oStorage.GetMountPoints(intLun).Tables[0].Rows.Count + 1; strMount = intCount.ToString(); btnMount.Attributes.Add("onclick", "return ValidateDropDown('" + ddlMountPerformance.ClientID + "','Please select a performance')" + strFilesystem + " && ValidateNumber('" + txtMountProd.ClientID + "','Please enter a valid size')" + " && ValidateNumber('" + txtMountTest.ClientID + "','Please enter a valid size')" + " && ValidateDropDown('" + ddlMountReplicated.ClientID + "','Please select a replicated option')" + " && ValidateDropDown('" + ddlMountHigh.ClientID + "','Please select a high availability')" + " && ValidateRadioButtons('" + radMoreYes.ClientID + "','" + radMoreNo.ClientID + "','Please select whether or not you want to add additional mount points')" + ";"); } } } } btnClose.Attributes.Add("onclick", "return parent.HidePanel();"); btnClose2.Attributes.Add("onclick", "return parent.HidePanel();"); btnClose3.Attributes.Add("onclick", "return parent.HidePanel();"); btnClosePNC.Attributes.Add("onclick", "return parent.HidePanel();"); }