Example #1
0
        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);
            oCSMConfig = new CSMConfig(intProfile, dsn);
            oRequest   = new Requests(intProfile, dsn);
            if (Request.QueryString["aid"] != null && Request.QueryString["aid"] != "")
            {
                intAnswer = Int32.Parse(Request.QueryString["aid"]);
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intConfig = Int32.Parse(Request.QueryString["id"]);
            }
            int intServer = 0;
            int intDR     = 0;

            if (intAnswer > 0)
            {
                DataSet ds = oForecast.GetAnswer(intAnswer);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    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 (!IsPostBack)
                    {
                        panView.Visible = true;
                        ds = oCSMConfig.Get(intConfig);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            txtName.Text    = ds.Tables[0].Rows[0]["name"].ToString();
                            txtServers.Text = ds.Tables[0].Rows[0]["servers"].ToString();
                            txtDR.Text      = ds.Tables[0].Rows[0]["dr"].ToString();
                        }
                    }
                }
            }
            btnClose.Attributes.Add("onclick", "return window.close();");
            btnDenied.Attributes.Add("onclick", "return window.close();");
            btnSave.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a custom name for this cluster')" +
                                   " && ValidateNumber0('" + txtServers.ClientID + "','Please enter a valid number for the number of servers')" +
                                   " && ValidateNumberLess('" + txtServers.ClientID + "'," + intServer + ",'You cannot add any more than " + intServer + " servers')" +
                                   " && ValidateNumber('" + txtDR.ClientID + "','Please enter a valid number for the number of DR servers')" +
                                   " && ValidateNumberLess('" + txtDR.ClientID + "'," + intDR + ",'You cannot add any more than " + intDR + " DR servers')" +
                                   ";");
        }
Example #2
0
        private void LoadClusters()
        {
            DataSet ds = oCSMConfig.Gets(intRequest);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                int     intConfig = Int32.Parse(dr["id"].ToString());
                DataSet dsConfig  = oCSMConfig.Get(intConfig);
                if (dsConfig.Tables[0].Rows.Count > 0)
                {
                    if (dsConfig.Tables[0].Rows[0]["local_nodes"].ToString() != "1")
                    {
                        strAttributes += "alert('You have not configured the LOCAL NODES for Config \"" + dsConfig.Tables[0].Rows[0]["name"].ToString() + "\"\\n\\nPlease click \"Edit\" from the configuration list to modify this configuration');return false;";
                    }
                }
            }
            rptCSM.DataSource = oCSMConfig.Gets(intRequest);
            rptCSM.DataBind();
            foreach (RepeaterItem ri in rptCSM.Items)
            {
                ((LinkButton)ri.FindControl("btnDelete")).Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
            }
            lblNone.Visible = (rptCSM.Items.Count == 0);
        }