Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
     oPage             = new Pages(intProfile, dsn);
     oAsset            = new Asset(intProfile, dsnAsset);
     oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
     oOrder            = new Orders(intProfile, dsnAsset);
     oModelsProperties = new ModelsProperties(intProfile, dsn);
     oType             = new Types(intProfile, dsn);
     if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
     {
         intApplication = Int32.Parse(Request.QueryString["applicationid"]);
     }
     if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
     {
         intPage = Int32.Parse(Request.QueryString["pageid"]);
     }
     if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
     {
         intApplication = Int32.Parse(Request.Cookies["application"].Value);
     }
     if (Request.QueryString["add_deploy"] != null)
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "add_deploy", "<script type=\"text/javascript\">alert('The device was successfully deployed');<" + "/" + "script>");
     }
     if (Request.QueryString["add_return"] != null)
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "add_return", "<script type=\"text/javascript\">alert('The device was successfully returned');<" + "/" + "script>");
     }
     if (!IsPostBack)
     {
         int intPlatform = 0;
         if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             intPlatform = Int32.Parse(Request.QueryString["id"]);
         }
         if (intPlatform > 0)
         {
             rptDevices.DataSource = oAsset.Gets(intPlatform, (int)AssetStatus.Arrived);
             rptDevices.DataBind();
             foreach (RepeaterItem ri in rptDevices.Items)
             {
                 Button btnReturn = (Button)ri.FindControl("btnReturn");
                 btnReturn.Attributes.Add("onclick", "return confirm('Are you sure you want to return this device?');");
                 Button btnDeploy = (Button)ri.FindControl("btnDeploy");
                 int    intType   = oModelsProperties.GetType(Int32.Parse(btnDeploy.CommandName));
                 btnDeploy.Attributes.Add("onclick", "return OpenWindow('ASSET_DEPLOY','" + oType.Get(intType, "asset_deploy_path") + "?id=" + btnDeploy.CommandArgument + "');");
             }
             lblNone.Visible = (rptDevices.Items.Count == 0);
         }
     }
 }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            Workstations     oWorkstation      = new Workstations(0, dsn);
            OnDemand         oOnDemand         = new OnDemand(0, dsn);
            Forecast         oForecast         = new Forecast(0, dsn);
            ModelsProperties oModelsProperties = new ModelsProperties(0, dsn);

            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                Functions oFunction      = new Functions(0, dsn, intEnvironment);
                int       intWorkstation = Int32.Parse(oFunction.decryptQueryString(Request.QueryString["id"]));
                int       intType        = oModelsProperties.GetType(intModelVirtual);
                DataSet   dsSteps        = oOnDemand.GetSteps(intType, 1);
                DataSet   ds             = oWorkstation.GetVirtual(intWorkstation);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    int          intAnswer   = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                    int          intRemote   = Int32.Parse(ds.Tables[0].Rows[0]["remoteid"].ToString());
                    int          intCurrent  = Int32.Parse(ds.Tables[0].Rows[0]["step"].ToString());
                    Workstations workstation = new Workstations(0, dsnRemote);
                    DataSet      dsResult    = workstation.GetWorkstationVirtualRemoteStatus(intRemote);
                    if (dsResult.Tables[0].Rows.Count > 0)
                    {
                        int intStep = Int32.Parse(dsResult.Tables[0].Rows[0]["step"].ToString());
                        int intID   = Int32.Parse(dsResult.Tables[0].Rows[0]["id"].ToString());
                        if (intStep == 1)
                        {
                            oWorkstation.AssignHost(intWorkstation, dsnRemote, dsnAsset, intEnvironment, dsnZeus);
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "completed", "<script type=\"text/javascript\">window.onload = new Function(\"redirectWait();\");<" + "/" + "script>");
                        }
                        else if (intCurrent < intStep)
                        {
                            oOnDemand.UpdateStepDoneWorkstation(intWorkstation, intCurrent, oOnDemand.GetStep(intStep, "done"), 0, false, false);
                            oWorkstation.NextVirtualStep(intWorkstation);
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "completed", "<script type=\"text/javascript\">window.onload = new Function(\"redirect();\");<" + "/" + "script>");
                        }
                        else if (intCurrent == dsSteps.Tables[0].Rows.Count)
                        {
                            oWorkstation.NextVirtualStep(intWorkstation);
                            //SqlHelper.ExecuteNonQuery(dsnRemote, CommandType.Text, "UPDATE cv_virtual_workstations SET deleted = 1 WHERE id = " + intID.ToString() + " AND deleted = 0");
                            oForecast.UpdateAnswerCompleted(intAnswer);
                            oWorkstation.UpdateVirtualCompleted(intWorkstation);
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "completed", "<script type=\"text/javascript\">window.onload = new Function(\"redirect();\");<" + "/" + "script>");
                        }
                    }
                }
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "completed", "<script type=\"text/javascript\">window.onload = new Function(\"redirectWait();\");<" + "/" + "script>");
            }
        }
        protected void btnBack_Click(Object Sender, EventArgs e)
        {
            oForecast.UpdateAnswerExecution(intID, "");
            int intModel = oForecast.GetModel(intID);
            ModelsProperties oModelsProperties = new ModelsProperties(0, dsn);
            int      intType    = oModelsProperties.GetType(intModel);
            Types    oType      = new Types(0, dsn);
            string   strExecute = oType.Get(intType, "forecast_execution_path");
            OnDemand oOnDemand  = new OnDemand(0, dsn);
            int      intCount   = 0;
            DataSet  ds         = oOnDemand.GetWizardStepsDoneBack(intID);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                intCount++;
                if (intCount != ds.Tables[0].Rows.Count)
                {
                    oOnDemand.DeleteWizardStepDone(intID, Int32.Parse(dr["step"].ToString()));
                }
            }
            Response.Redirect(strExecute + "?id=" + intID.ToString());
        }
        private void BackToDesign(int _stopper)
        {
            oForecast.UpdateAnswerExecution(intID, "");
            int intModel = oForecast.GetModel(intID);
            ModelsProperties oModelsProperties = new ModelsProperties(0, dsn);
            int      intType    = oModelsProperties.GetType(intModel);
            Types    oType      = new Types(0, dsn);
            string   strExecute = oType.Get(intType, "forecast_execution_path");
            OnDemand oOnDemand  = new OnDemand(0, dsn);
            int      intCount   = 0;
            DataSet  ds         = oOnDemand.GetWizardStepsDoneBack(intID);
            int      intStop    = ds.Tables[0].Rows.Count - _stopper;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                intCount++;
                if (intCount < intStop)
                {
                    oOnDemand.DeleteWizardStepDone(intID, Int32.Parse(dr["step"].ToString()));
                }
            }
            Response.Redirect(strExecute + "?id=" + intID.ToString());
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = "ClearView Cluster Configuration";
            AuthenticateUser();
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oOnDemand         = new OnDemand(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oCluster          = new Cluster(intProfile, dsn);
            oRequest          = new Requests(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["id"] != null && Request.QueryString["id"] != "")
            {
                intCluster = Int32.Parse(Request.QueryString["id"]);
            }
            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "refresh", "<script type=\"text/javascript\">RefreshOpeningWindow();<" + "/" + "script>");
            int intServer = 0;
            int intDR     = 0;
            int intHA     = 0;

            if (intAnswer > 0)
            {
                Page.Title = "ClearView Cluster Configuration | Design # " + intAnswer.ToString();
                DataSet ds       = oForecast.GetAnswer(intAnswer);
                int     intModel = oForecast.GetModel(intAnswer);
                int     intType  = oModelsProperties.GetType(intModel);
                if (oForecast.IsOSMidrange(intAnswer) == true)
                {
                    boolMidrange = true;
                }
                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);
                    intHA     = Int32.Parse(ds.Tables[0].Rows[0]["ha"].ToString()) - oForecast.TotalHACount(intAnswer, boolUseCSM);
                    int intClass = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString());
                    intRequest = oForecast.GetRequestID(intAnswer, true);
                    if (!IsPostBack)
                    {
                        panView.Visible   = true;
                        btnQuorum.Visible = (boolMidrange == false);
                        if (oClass.Get(intClass, "prod") != "1" || oForecast.GetAnswerPlatform(intAnswer, intUnder48Q, intUnder48A) == false)
                        {
                            txtDR.Text    = "0";
                            txtDR.Enabled = false;
                        }
                        if (oClass.Get(intClass, "prod") != "1" || oForecast.IsHARoom(intAnswer) == false)
                        {
                            txtHA.Text    = "0";
                            txtHA.Enabled = false;
                        }
                        ds = oCluster.Get(intCluster);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            Page.Title      = "ClearView Cluster Configuration | Design # " + intAnswer.ToString() + " | Cluster # " + intCluster.ToString();
                            imgSave.Visible = false;
                            txtName.Text    = ds.Tables[0].Rows[0]["nickname"].ToString();
                            txtNodes.Text   = ds.Tables[0].Rows[0]["nodes"].ToString();
                            intServer      += Int32.Parse(txtNodes.Text);
                            txtDR.Text      = ds.Tables[0].Rows[0]["dr"].ToString();
                            intDR          += Int32.Parse(txtDR.Text);
                            txtHA.Text      = ds.Tables[0].Rows[0]["ha"].ToString();
                            intHA          += Int32.Parse(txtHA.Text);
                            if (ds.Tables[0].Rows[0]["local_nodes"].ToString() == "1")
                            {
                                if (ds.Tables[0].Rows[0]["non_shared"].ToString() == "0")
                                {
                                    imgNodes.Visible = true;
                                }
                                btnNodes.Attributes.Add("onclick", "return OpenWindow('ONDEMAND_SERVER','?aid=" + intAnswer + "&clusterid=" + intCluster + "&csmid=0&num=0');");
                            }
                            else
                            {
                                btnNodes.Enabled = false;
                            }
                            if (ds.Tables[0].Rows[0]["non_shared"].ToString() == "1")
                            {
                                if (ds.Tables[0].Rows[0]["add_instance"].ToString() == "0")
                                {
                                    imgStorage.Visible = true;
                                }
                                btnStorage.Attributes.Add("onclick", "return OpenWindow('ONDEMAND_STORAGE','?aid=" + intAnswer + "&clusterid=" + intCluster + "&csmid=0&num=0');");
                            }
                            else
                            {
                                btnStorage.Enabled = false;
                            }
                            if (ds.Tables[0].Rows[0]["add_instance"].ToString() == "1")
                            {
                                if (ds.Tables[0].Rows[0]["quorum"].ToString() == "0")
                                {
                                    imgAdd.Visible = true;
                                }
                                btnAdd.Attributes.Add("onclick", "return NewInstance('" + intAnswer.ToString() + "','" + intCluster.ToString() + "','');");
                            }
                            else
                            {
                                btnAdd.Enabled = false;
                            }
                            if (boolMidrange == false && ds.Tables[0].Rows[0]["quorum"].ToString() == "1")
                            {
                                imgQuorum.Visible = true;
                                btnQuorum.Attributes.Add("onclick", "return OpenWindow('ONDEMAND_CLUSTER_QUORUM','?aid=" + intAnswer + "&id=" + intCluster + "');");
                            }
                            else
                            {
                                btnQuorum.Enabled = false;
                            }

                            rptInstances.DataSource = oCluster.GetInstances(intCluster);
                            rptInstances.DataBind();
                            foreach (RepeaterItem ri in rptInstances.Items)
                            {
                                ((LinkButton)ri.FindControl("btnDelete")).Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
                            }
                            lblNone.Visible = (rptInstances.Items.Count == 0);
                            //btnSave.Enabled = false;
                        }
                        else
                        {
                            imgSave.Visible    = true;
                            btnAdd.Enabled     = false;
                            btnQuorum.Enabled  = false;
                            btnNodes.Enabled   = false;
                            btnStorage.Enabled = false;
                            panNote.Visible    = true;
                            lblNone.Visible    = true;
                        }
                    }
                }
            }
            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('" + txtNodes.ClientID + "','Please enter a valid number for the number of nodes')" +
                                   " && ValidateNumberLess('" + txtNodes.ClientID + "'," + intServer + ",'You cannot add any more than " + intServer + " nodes')" +
                                   " && 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')" +
                                   " && ValidateNumber('" + txtHA.ClientID + "','Please enter a valid number for the number of HA servers')" +
                                   " && ValidateNumberLess('" + txtHA.ClientID + "'," + intHA + ",'You cannot add any more than " + intHA + " HA servers')" +
                                   ";");
        }
Beispiel #6
0
        private void CheckResults(string strQuery)
        {
            DataSet ds = oServer.Get(strQuery, false);

            if (ds.Tables[0].Rows.Count == 1)
            {
                panSearch.Visible = true;
                lblServer.Text    = strQuery.ToUpper();
                int intAnswer  = 0;
                int intProject = 0;
                if (ds.Tables[0].Rows[0]["answerid"].ToString() != "")
                {
                    intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["projectid"].ToString() != "")
                {
                    intProject = Int32.Parse(ds.Tables[0].Rows[0]["projectid"].ToString());
                }
                if (intProject > 0 && intAnswer > 0)
                {
                    ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                    Types            oType             = new Types(intProfile, dsn);
                    int intServer = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    int intModel  = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
                    strResults += "<tr><td nowrap>Server Name Generation:</td><td width=\"100%\">Generated via On-Demand Server Auto-Provisioning</td></tr>";
                    strResults += "<tr><td nowrap>Project ID:</td><td width=\"100%\">" + intProject.ToString() + "</td></tr>";
                    strResults += "<tr><td nowrap>Project Name:</td><td width=\"100%\">" + ds.Tables[0].Rows[0]["name"].ToString() + "</td></tr>";
                    strResults += "<tr><td nowrap>Project Number:</td><td width=\"100%\">" + ds.Tables[0].Rows[0]["number"].ToString() + "</td></tr>";
                    int intLead = 0;
                    if (ds.Tables[0].Rows[0]["lead"].ToString() != "")
                    {
                        intLead = Int32.Parse(ds.Tables[0].Rows[0]["lead"].ToString());
                    }
                    strResults += "<tr><td nowrap>Project Lead:</td><td width=\"100%\">" + oUser.GetFullName(intLead) + " (" + oUser.GetName(intLead) + ")</td></tr>";
                    int intEngineer = 0;
                    if (ds.Tables[0].Rows[0]["engineer"].ToString() != "")
                    {
                        intEngineer = Int32.Parse(ds.Tables[0].Rows[0]["engineer"].ToString());
                    }
                    strResults += "<tr><td nowrap>Integration Engineer:</td><td width=\"100%\">" + oUser.GetFullName(intEngineer) + " (" + oUser.GetName(intEngineer) + ")</td></tr>";
                    strResults += "<tr><td nowrap>Implementor:</td><td width=\"100%\">" + GetImplementor(intProject, intAnswer) + "</td></tr>";
                    int     intBackup = Int32.Parse(oForecast.GetAnswer(intAnswer, "backup"));
                    DataSet dsBackup  = oOnDemandTasks.GetServerBackup(intAnswer);
                    if (dsBackup.Tables[0].Rows.Count > 0)
                    {
                        int     intRequestB = Int32.Parse(dsBackup.Tables[0].Rows[0]["requestid"].ToString());
                        int     intItemB    = Int32.Parse(dsBackup.Tables[0].Rows[0]["itemid"].ToString());
                        int     intNumberB  = Int32.Parse(dsBackup.Tables[0].Rows[0]["number"].ToString());
                        DataSet dsResourceB = oResourceRequest.Get(intRequestB, intItemB, intNumberB);
                        if (dsResourceB.Tables[0].Rows.Count > 0)
                        {
                            strResults += "<tr><td nowrap>Backup:</td>";
                            string strUsersB = "";
                            foreach (DataRow drResourceB in dsResourceB.Tables[0].Rows)
                            {
                                int intUserB = Int32.Parse(drResourceB["userid"].ToString());
                                if (strUsersB != "")
                                {
                                    strUsersB += ", ";
                                }
                                strUsersB += oUser.GetFullName(intUserB) + "&nbsp;&nbsp;&nbsp;(" + (dsBackup.Tables[0].Rows[0]["chk1"].ToString() == "1" ? "Complete" : "Incomplete") + ")";
                            }
                            strResults += "<td width=\"100%\">" + strUsersB + "</td></tr>";
                        }
                        else
                        {
                            strResults += "<tr><td nowrap>Backup:</td><td width=\"100%\">Pending Assignment</td></tr>";
                        }
                    }
                    else
                    {
                        strResults += "<tr><td nowrap>Backup:</td><td width=\"100%\">Not Submitted (" + (intBackup == 1 ? "Client <b>DID</b> Request a Backup" : "Client <b>DID NOT</b> Request a Backup") + ")</td></tr>";
                    }
                    if (oModelsProperties.IsTypeVMware(intModel) == false)
                    {
                        int     intStorage = Int32.Parse(oForecast.GetAnswer(intAnswer, "storage"));
                        DataSet dsStorageT = oOnDemandTasks.GetServerStorage(intAnswer, 0);
                        if (dsStorageT.Tables[0].Rows.Count > 0)
                        {
                            int     intRequestST = Int32.Parse(dsStorageT.Tables[0].Rows[0]["requestid"].ToString());
                            int     intItemST    = Int32.Parse(dsStorageT.Tables[0].Rows[0]["itemid"].ToString());
                            int     intNumberST  = Int32.Parse(dsStorageT.Tables[0].Rows[0]["number"].ToString());
                            DataSet dsResourceST = oResourceRequest.Get(intRequestST, intItemST, intNumberST);
                            if (dsResourceST.Tables[0].Rows.Count > 0)
                            {
                                strResults += "<tr><td nowrap>Storage (TEST):</td>";
                                string strUsersST = "";
                                foreach (DataRow drResourceST in dsResourceST.Tables[0].Rows)
                                {
                                    int intUserST = Int32.Parse(drResourceST["userid"].ToString());
                                    if (strUsersST != "")
                                    {
                                        strUsersST += ", ";
                                    }
                                    strUsersST += oUser.GetFullName(intUserST) + "&nbsp;&nbsp;&nbsp;(" + (dsStorageT.Tables[0].Rows[0]["chk1"].ToString() == "1" ? "Complete" : "Incomplete") + ")";
                                }
                                strResults += "<td width=\"100%\">" + strUsersST + "</td></tr>";
                            }
                            else
                            {
                                strResults += "<tr><td nowrap>Storage (TEST):</td><td width=\"100%\">Pending Assignment</td></tr>";
                            }
                        }
                        else
                        {
                            strResults += "<tr><td nowrap>Storage (TEST):</td><td width=\"100%\">Not Submitted (" + (intStorage == 1 ? "Client <b>DID</b> Request TEST Storage" : "Client <b>DID NOT</b> Request TEST Storage") + ")</td></tr>";
                        }
                        DataSet dsStorageP = oOnDemandTasks.GetServerStorage(intAnswer, 1);
                        if (dsStorageP.Tables[0].Rows.Count > 0)
                        {
                            int     intRequestSP = Int32.Parse(dsStorageP.Tables[0].Rows[0]["requestid"].ToString());
                            int     intItemSP    = Int32.Parse(dsStorageP.Tables[0].Rows[0]["itemid"].ToString());
                            int     intNumberSP  = Int32.Parse(dsStorageP.Tables[0].Rows[0]["number"].ToString());
                            DataSet dsResourceSP = oResourceRequest.Get(intRequestSP, intItemSP, intNumberSP);
                            if (dsResourceSP.Tables[0].Rows.Count > 0)
                            {
                                strResults += "<tr><td nowrap>Storage (PROD):</td>";
                                string strUsersSP = "";
                                foreach (DataRow drResourceSP in dsResourceSP.Tables[0].Rows)
                                {
                                    int intUserSP = Int32.Parse(drResourceSP["userid"].ToString());
                                    if (strUsersSP != "")
                                    {
                                        strUsersSP += ", ";
                                    }
                                    strUsersSP += oUser.GetFullName(intUserSP) + "&nbsp;&nbsp;&nbsp;(" + (dsStorageP.Tables[0].Rows[0]["chk1"].ToString() == "1" ? "Complete" : "Incomplete") + ")";
                                }
                                strResults += "<td width=\"100%\">" + strUsersSP + "</td></tr>";
                            }
                            else
                            {
                                strResults += "<tr><td nowrap>Storage (PROD):</td><td width=\"100%\">Pending Assignment</td></tr>";
                            }
                        }
                        else
                        {
                            strResults += "<tr><td nowrap>Storage (PROD):</td><td width=\"100%\">Not Submitted (" + (intStorage == 1 ? "Client <b>DID</b> Request PROD Storage" : "Client <b>DID NOT</b> Request PROD Storage") + ")</td></tr>";
                        }
                    }
                    else
                    {
                        strResults += "<tr><td nowrap>Storage (TEST):</td><td width=\"100%\">VMware Does Not Require Storage Configuration</td></tr>";
                        strResults += "<tr><td nowrap>Storage (PROD):</td><td width=\"100%\">VMware Does Not Require Storage Configuration</td></tr>";
                    }
                    strResults += "<tr><td nowrap>Model:</td><td width=\"100%\">" + oModelsProperties.Get(intModel, "name") + "</td></tr>";
                    strResults += "<tr><td nowrap>NickName:</td><td width=\"100%\">" + oForecast.GetAnswer(intAnswer, "name") + "</td></tr>";
                    strResults += "<tr><td nowrap>Current State:</td><td width=\"100%\">" + (ds.Tables[0].Rows[0]["step"].ToString() == "0" ? "Awaiting Execution" : (ds.Tables[0].Rows[0]["step"].ToString() == "999" ? "Completed Build" : "Building...")) + "</td></tr>";
                    strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/icons/pdf.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"/frame/ondemand/pdf_tsm.aspx?id=" + intAnswer.ToString() + "\">Click here to view the TSM Registration Form</a></td></tr>";
                    strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/icons/pdf.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"/frame/ondemand/pdf_san.aspx?id=" + intAnswer.ToString() + "\">Click here to view the SAN Registration Form (TEST)</a></td></tr>";
                    strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/icons/pdf.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"/frame/ondemand/pdf_san.aspx?id=" + intAnswer.ToString() + "&prod=true\">Click here to view the SAN Registration Form (PROD)</a></td></tr>";
                    strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/icons/html.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"/frame/ondemand/pdf_sc.aspx?id=" + intServer.ToString() + "\">Click here to view the Service Center Request</a></td></tr>";
                    strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/icons/pdf.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"/frame/ondemand/pdf_birth.aspx?id=" + intAnswer.ToString() + "\">Click here to view the Birth Certificate</a></td></tr>";
                    strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/file.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('FORECAST_EQUIPMENT','?id=" + intAnswer.ToString() + "');\">Click here to view the design</a></td></tr>";
                    strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/file.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"" + oPage.GetFullLink(intDesignBuilder) + "?id=" + oForecast.GetAnswer(intAnswer, "forecastid") + "&highlight=" + intAnswer.ToString() + "\" target=\"_blank\">Click here to view the OVERALL design</a></td></tr>";
                    int    intType    = oModelsProperties.GetType(intModel);
                    string strExecute = oType.Get(intType, "forecast_execution_path");
                    if (strExecute != "")
                    {
                        strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/user.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=2&view=true');\">Click here to view the application configuration</a></td></tr>";
                        if (oForecast.IsOSDistributed(intAnswer) == true)
                        {
                            if (oForecast.IsHACluster(intAnswer) == true)
                            {
                                strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/config.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=3&view=true');\">Click here to view the device configuration</a></td></tr>";
                            }
                            else
                            {
                                strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/config.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=3&view=true');\">Click here to view the device configuration</a></td></tr>";
                            }
                            strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/calendar.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=4&view=true');\">Click here to view the production go live date</a></td></tr>";
                        }
                        else
                        {
                            if (oForecast.IsHACluster(intAnswer) == true)
                            {
                                strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/config.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=3&view=true');\">Click here to view the device configuration</a></td></tr>";
                            }
                            else
                            {
                                strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/config.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=3&view=true');\">Click here to view the device configuration</a></td></tr>";
                            }
                            strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/calendar.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('NEW_WINDOW','" + strExecute + "?id=" + intAnswer.ToString() + "&sid=4&view=true');\">Click here to view the production go live date</a></td></tr>";
                        }
                        strResults += "<tr><td nowrap colspan=\"2\"><img src=\"/images/check.gif\" border=\"0\" align=\"absmiddle\"/> <a href=\"javascript:void(0);\" onclick=\"OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');\">Click here to view the execution</a></td></tr>";
                    }
                    strResults += "<tr><td nowrap colspan=\"2\" class=\"header\"><b>Asset History:</b></td></tr>";
                    string  strAssets = "";
                    DataSet dsAssets  = oServer.GetAssets(intServer);
                    foreach (DataRow drAsset in dsAssets.Tables[0].Rows)
                    {
                        strAssets += "<tr><td>" + drAsset["serial"].ToString() + "</td><td>" + drAsset["asset"].ToString() + "</td><td>" + drAsset["model"].ToString() + "</td><td>" + drAsset["class"].ToString() + "</td><td>" + drAsset["environment"].ToString() + "</td><td>" + drAsset["datestamp"].ToString() + "</td></tr>";
                    }
                    if (strAssets == "")
                    {
                        strAssets += "<tr><td colspan=\"6\"><img src=\"/images/alert.gif\" border=\"0\" align=\"absmiddle\"/> There are no assets</td></tr>";
                    }
                    strAssets   = "<tr class=\"bold\"><td>Serial</td><td>Asset</td><td>Model</td><td>Class</td><td>Environment</td><td>DateStamp</td></tr>" + strAssets;
                    strAssets   = "<table cellpadding=\"3\" cellspacing=\"2\" border=\"0\">" + strAssets + "</table>";
                    strResults += "<tr><td nowrap colspan=\"2\">" + strAssets + "</td></tr>";
                }
                else
                {
                    strResults += "<tr><td nowrap>Server Name Generation:</td><td width=\"100%\">Generated via Custom Functions, Server Names</td></tr>";
                    int intUser = Int32.Parse(ds.Tables[0].Rows[0]["servernameuserid"].ToString());
                    strResults += "<tr><td nowrap>Implementor:</td><td width=\"100%\">" + oUser.GetFullName(intUser) + " (" + oUser.GetName(intUser) + ")</td></tr>";
                    strResults += "<tr><td nowrap>Description:</td><td width=\"100%\">" + ds.Tables[0].Rows[0]["description"].ToString() + "</td></tr>";
                }
            }
            else
            {
                panMultiple.Visible = true;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    strMultiple += "<tr onmouseover=\"CellRowOver(this);\" onmouseout=\"CellRowOut(this);\" onclick=\"window.navigate('" + oPage.GetFullLink(intPage) + "?name=" + oFunctions.encryptQueryString(dr["servername"].ToString()) + "');\">";
                    int intAnswer  = 0;
                    int intProject = 0;
                    if (dr["answerid"].ToString() != "")
                    {
                        intAnswer = Int32.Parse(dr["answerid"].ToString());
                    }
                    if (dr["projectid"].ToString() != "")
                    {
                        intProject = Int32.Parse(dr["projectid"].ToString());
                    }
                    strMultiple += "<td>" + dr["servername"].ToString() + "</td>";
                    if (intAnswer == 0 && intProject == 0)
                    {
                        int intImplementor = Int32.Parse(dr["servernameuserid"].ToString());
                        strMultiple += "<td>" + oUser.GetFullName(intImplementor) + " (" + oUser.GetName(intImplementor) + ")" + "</td>";
                        strMultiple += "<td>Custom Function</td>";
                    }
                    else if (intAnswer > 0 && intProject > 0)
                    {
                        strMultiple += "<td>" + GetImplementor(intProject, intAnswer) + "</td>";
                        strMultiple += "<td>Design Builder Execution</td>";
                    }
                    else
                    {
                        strMultiple += "<td>*** ERROR ***</td>";
                        strMultiple += "<td>???</td>";
                    }
                    strMultiple += "<td>" + dr["name"].ToString() + "</td>";
                    strMultiple += "<td>" + dr["number"].ToString() + "</td>";
                    strMultiple += "</tr>";
                }
            }
        }
        private void LoadServiceProgression()
        {
            DataSet dsServices = oDataPoint.GetServiceRequestSearchResults(
                "",
                "",
                null, null, null, null,
                (intResourceAssigned > 0 ? intResourceAssigned : null),
                (intProjectId > 0 ? intProjectId : null),
                null, null, null, null, null, null,
                hdnOrderBy.Value.ToString(), Int32.Parse(hdnOrder.Value.ToString()), Int32.Parse(hdnPageNo.Value), Int32.Parse(hdnRecsPerPage.Value));


            rptServices.DataSource = dsServices.Tables[0];
            rptServices.DataBind();
            foreach (RepeaterItem ri in rptServices.Items)
            {
                Label lblAutomate = (Label)ri.FindControl("lblAutomate");
                Label lblRRID     = (Label)ri.FindControl("lblRRID");
                Label lblRequest  = (Label)ri.FindControl("lblRequest");
                if (lblAutomate.Text != "1")
                {
                    lblRequest.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(lblRRID.Text) + "', '800', '600');\">" + lblRequest.Text + "</a>";
                }
                else
                {
                    lblRequest.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindowMenu('/datapoint/service/request.aspx?t=" + oFunction.encryptQueryString(lblRequest.ToolTip) + " &q=" + oFunction.encryptQueryString(lblRequest.ToolTip) + " ', '800', '600');\">" + lblRequest.Text + "</a>";
                }
                Label lblService = (Label)ri.FindControl("lblService");
                lblService.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('SERVICES_DETAIL','?sid=" + lblService.ToolTip + "');\">" + lblService.Text + "</a>";
                Label lblRequestedBy = (Label)ri.FindControl("lblRequestedBy");
                lblRequestedBy.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + lblRequestedBy.ToolTip + "');\">" + lblRequestedBy.Text + "</a>";
                Label lblAssignedBy = (Label)ri.FindControl("lblAssignedBy");
                lblAssignedBy.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + lblAssignedBy.ToolTip + "');\">" + lblAssignedBy.Text + "</a>";
                Label lblAssignedTo = (Label)ri.FindControl("lblAssignedTo");
                lblAssignedTo.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + lblAssignedTo.ToolTip + "');\">" + lblAssignedTo.Text + "</a>";
                Label lblProgress = (Label)ri.FindControl("lblProgress");
                //Get the Progress
                if (lblAutomate.Text == "1")
                {
                    lblProgress.Text = oServiceRequest.GetStatusBarIn(100.00, "100", "12", true);
                }
                else
                {
                    if (lblRRID.Text == "")
                    {
                        lblProgress.Text = "<i>Unavailable</i>";
                    }
                    else
                    {
                        int     intRRId      = Int32.Parse(lblRRID.Text);
                        double  dblAllocated = 0.00;
                        double  dblUsed      = 0.00;
                        bool    boolAssigned = false;
                        DataSet dsResource   = oDataPoint.GetServiceRequestResource(intRRId);
                        foreach (DataRow drResource in dsResource.Tables[1].Rows)
                        {
                            if (drResource["deleted"].ToString() == "0")
                            {
                                boolAssigned  = true;
                                dblAllocated += double.Parse(drResource["allocated"].ToString());
                                dblUsed      += double.Parse(drResource["used"].ToString());
                            }
                        }
                        if (boolAssigned == false)
                        {
                            Label lblOnDemand = (Label)ri.FindControl("lblOnDemand");
                            if (lblOnDemand.Text == "" || lblOnDemand.Text == "0")
                            {
                                Label   lblServiceID = (Label)ri.FindControl("lblServiceID");
                                string  strManager   = "<tr><td colspan=\"3\"><img src=\"/images/spacer.gif\" border=\"0\" width=\"15\" height=\"1\"/></td></tr>";
                                DataSet dsManager    = oService.GetUser(Int32.Parse(lblServiceID.Text), 1); // Managers
                                foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                {
                                    int intManager = Int32.Parse(drManager["userid"].ToString());
                                    strManager += "<tr><td><img src=\"/images/spacer.gif\" border=\"0\" width=\"15\" height=\"1\"/></td><td>-</td><td><a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('PROFILE','?userid=" + intManager.ToString() + "');\">" + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]</a></td></tr>";
                                }
                                lblProgress.Text = "Pending Assignment [<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"ShowHideDiv2('divAssign" + intRRId.ToString() + "');\">View Service Managers</a>]<div id=\"divAssign" + intRRId.ToString() + "\" style=\"display:none\"><table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">" + strManager + "</table></div>";
                            }
                            else
                            {
                                Forecast         oForecast         = new Forecast(intProfile, dsn);
                                ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                                Types            oType             = new Types(intProfile, dsn);
                                Label            lblRequestID      = (Label)ri.FindControl("lblRequestID");
                                DataSet          dsService         = oForecast.GetAnswerService(Int32.Parse(lblRequestID.Text));
                                if (dsService.Tables[0].Rows.Count > 0)
                                {
                                    int    intAnswer  = Int32.Parse(dsService.Tables[0].Rows[0]["id"].ToString());
                                    int    intModel   = Int32.Parse(dsService.Tables[0].Rows[0]["modelid"].ToString());
                                    int    intType    = oModelsProperties.GetType(intModel);
                                    string strExecute = oType.Get(intType, "forecast_execution_path");
                                    if (strExecute != "")
                                    {
                                        lblProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" title=\"Click here to execute this service\" onclick=\"OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');\">Execute</a>";
                                    }
                                    else
                                    {
                                        lblProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" title=\"Click here to execute this service\" onclick=\"alert('Execution has not been configured for asset type " + oType.Get(intType, "name") + "');\">Execute</a>";
                                    }
                                }
                            }
                        }
                        else if (dblAllocated > 0.00)
                        {
                            lblProgress.Text = oServiceRequest.GetStatusBarIn((dblUsed / dblAllocated) * 100.00, "100", "12", true);
                        }
                        else
                        {
                            lblProgress.Text = "<i>N / A</i>";
                        }
                    }
                }
            }

            //dlServices.Visible = (dlServices.Items.Count > 0);
            lblServices.Visible = (rptServices.Items.Count == 0);
        }
        protected void dlServices_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView drv = (DataRowView)e.Item.DataItem;

                LinkButton lnkRequestId = (LinkButton)e.Item.FindControl("lnkRequestId");
                lnkRequestId.Text = drv["ReqServiceNumber"].ToString();

                if (drv["automate"].ToString() != "1")
                {
                    lnkRequestId.Attributes.Add("onclick", "return OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(drv["ResourceRequestID"].ToString()) + "', '800', '600');");
                }
                else
                {
                    lnkRequestId.Attributes.Add("onclick", "return OpenNewWindowMenu('/datapoint/service/request.aspx?t=" + oFunction.encryptQueryString(drv["RequestNumber"].ToString()) + " &q=" + oFunction.encryptQueryString(drv["RequestNumber"].ToString()) + " ', '800', '600');");
                }


                LinkButton lnkServiceName = (LinkButton)e.Item.FindControl("lnkServiceName");
                lnkServiceName.Text    = drv["ServiceName"].ToString();
                lnkServiceName.ToolTip = drv["ServiceId"].ToString();
                lnkServiceName.Attributes.Add("onclick", "return OpenWindow('SERVICES_DETAIL','?sid=" + drv["ServiceId"].ToString() + "');");

                LinkButton lnkRequestedBy = (LinkButton)e.Item.FindControl("lnkRequestedBy");
                lnkRequestedBy.Text = drv["RequestorName"].ToString() + (drv["RequestorXID"].ToString() != "" ? "(" + drv["RequestorXID"].ToString() + ")" : "");
                lnkRequestedBy.Attributes.Add("onclick", "return OpenWindow('PROFILE','?userid=" + drv["userid"].ToString() + "');");


                LinkButton lnkAssignedBy = (LinkButton)e.Item.FindControl("lnkAssignedBy");
                lnkAssignedBy.Text = drv["UserAssignedByName"].ToString() + (drv["UserAssignedByXID"].ToString() != "" ? "(" + drv["UserAssignedByXID"].ToString() + ")" : "");
                lnkAssignedBy.Attributes.Add("onclick", "return OpenWindow('PROFILE','?userid=" + drv["AssignedBy"].ToString() + "');");

                LinkButton lnkAssignedTo = (LinkButton)e.Item.FindControl("lnkAssignedTo");
                lnkAssignedTo.Text = drv["UserAssignedToName"].ToString() + (drv["UserAssignedToXID"].ToString() != "" ? "(" + drv["UserAssignedToXID"].ToString() + ")" : "");
                lnkAssignedTo.Attributes.Add("onclick", "return OpenWindow('PROFILE','?userid=" + drv["AssignedTo"].ToString() + "');");


                Label lblServiceSubmitted = (Label)e.Item.FindControl("lblServiceSubmitted");
                lblServiceSubmitted.Text    = (drv["RequestSubmitted"] != DBNull.Value ? DateTime.Parse(drv["RequestSubmitted"].ToString()).ToShortDateString() : "");
                lblServiceSubmitted.ToolTip = drv["RequestSubmitted"].ToString();

                Label lblServiceLastUpdated = (Label)e.Item.FindControl("lblServiceLastUpdated");
                lblServiceLastUpdated.Text    = (drv["RequestModified"] != DBNull.Value ? DateTime.Parse(drv["RequestModified"].ToString()).ToShortDateString() : "");
                lblServiceLastUpdated.ToolTip = drv["RequestModified"].ToString();

                //Get the Progress
                Label lblServiceProgress = (Label)e.Item.FindControl("lblServiceProgress");
                if (drv["Automate"] != DBNull.Value && drv["Automate"].ToString() == "1")
                {
                    lblServiceProgress.Text = oServiceRequest.GetStatusBarIn(100.00, "100", "12", true);
                }
                else
                {
                    if (drv["ResourceRequestID"].ToString() == "")
                    {
                        lblServiceProgress.Text = "<i>Unavailable</i>";
                    }
                    else
                    {
                        int     intRRId      = Int32.Parse(drv["ResourceRequestID"].ToString());
                        double  dblAllocated = 0.00;
                        double  dblUsed      = 0.00;
                        bool    boolAssigned = false;
                        DataSet dsResource   = oDataPoint.GetServiceRequestResource(intRRId);
                        foreach (DataRow drResource in dsResource.Tables[1].Rows)
                        {
                            if (drResource["deleted"].ToString() == "0")
                            {
                                boolAssigned  = true;
                                dblAllocated += double.Parse(drResource["allocated"].ToString());
                                dblUsed      += double.Parse(drResource["used"].ToString());
                            }
                        }
                        if (boolAssigned == false)
                        {
                            if (drv["OnDemand"] == DBNull.Value || drv["OnDemand"].ToString() == "0")
                            {
                                string  strManager = "<tr><td colspan=\"3\"><img src=\"/images/spacer.gif\" border=\"0\" width=\"15\" height=\"1\"/></td></tr>";
                                DataSet dsManager  = oService.GetUser(Int32.Parse(drv["serviceid"].ToString()), 1); // Managers
                                foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                {
                                    int intManager = Int32.Parse(drManager["userid"].ToString());
                                    strManager += "<tr><td><img src=\"/images/spacer.gif\" border=\"0\" width=\"15\" height=\"1\"/></td><td>-</td><td><a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('PROFILE','?userid=" + intManager.ToString() + "');\">" + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]</a></td></tr>";
                                }
                                lblServiceProgress.Text = "Pending Assignment [<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"ShowHideDiv2('divAssign" + intRRId.ToString() + "');\">View Service Managers</a>]<div id=\"divAssign" + intRRId.ToString() + "\" style=\"display:none\"><table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">" + strManager + "</table></div>";
                            }
                            else
                            {
                                Forecast         oForecast         = new Forecast(intProfile, dsn);
                                ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                                Types            oType             = new Types(intProfile, dsn);
                                DataSet          dsService         = oForecast.GetAnswerService(Int32.Parse(drv["requestid"].ToString()));
                                if (dsService.Tables[0].Rows.Count > 0)
                                {
                                    int    intAnswer  = Int32.Parse(dsService.Tables[0].Rows[0]["id"].ToString());
                                    int    intModel   = Int32.Parse(dsService.Tables[0].Rows[0]["modelid"].ToString());
                                    int    intType    = oModelsProperties.GetType(intModel);
                                    string strExecute = oType.Get(intType, "forecast_execution_path");
                                    if (strExecute != "")
                                    {
                                        lblServiceProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" title=\"Click here to execute this service\" onclick=\"OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');\">Execute</a>";
                                    }
                                    else
                                    {
                                        lblServiceProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" title=\"Click here to execute this service\" onclick=\"alert('Execution has not been configured for asset type " + oType.Get(intType, "name") + "');\">Execute</a>";
                                    }
                                }
                            }
                        }
                        else if (dblAllocated > 0.00)
                        {
                            lblServiceProgress.Text = oServiceRequest.GetStatusBarIn((dblUsed / dblAllocated) * 100.00, "100", "12", true);
                        }
                        else
                        {
                            lblServiceProgress.Text = "<i>N / A</i>";
                        }
                    }
                }

                Label lblServiceStatus = (Label)e.Item.FindControl("lblServiceStatus");
                lblServiceStatus.Text = drv["ServiceStatusName"].ToString();

                if (intProjectId == 0 || intProjectId == null) //Showing for project
                {
                    if (drv["projectid"] != DBNull.Value && Int32.Parse(drv["projectid"].ToString()) > 0)
                    {
                        Label lblProjectNumber = (Label)e.Item.FindControl("lblProjectNumber");
                        lblProjectNumber.Text = drv["ProjectNumber"].ToString();

                        LinkButton lnkProjectName = (LinkButton)e.Item.FindControl("lnkProjectName");
                        lnkProjectName.Text = drv["ProjectName"].ToString();

                        lnkProjectName.Attributes.Add("onclick", "return OpenNewWindowMenu('/datapoint/projects/datapoint_projects.aspx?id=" + oFunction.encryptQueryString(drv["projectid"].ToString()) + "', '800', '600');");
                        HtmlTableRow trProject = (HtmlTableRow)e.Item.FindControl("trProject");
                        trProject.Visible = true;
                    }
                }

                //Label lblRequestedBy = (Label)e.Item.FindControl("lblRequestedBy");
                //lblRequestedBy.Text = (drv["TypeName"] != DBNull.Value ? drv["TypeName"].ToString() : "--");
                //lblRequestedBy.ToolTip = "Type Id: " + drv["TypeId"].ToString();
            }
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oForecast         = new Forecast(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oLocation         = new Locations(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);


            //Menus
            int intMenuTab = 0;

            if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
            {
                intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
            }
            Tab oTab = new Tab("", intMenuTab, "divMenu1", true, false);

            //Tab oTab = new Tab(hdnType.ClientID, intMenuTab, "divMenu1", true, false);
            oTab.AddTab("Backup Inclusions", "");
            oTab.AddTab("Backup Exclusions", "");
            oTab.AddTab("Archive Requirements", "");
            oTab.AddTab("Additional Configuration", "");
            strMenuTab1 = oTab.GetTabs();
            //End Menus

            if (Request.QueryString["parent"] != null && Request.QueryString["parent"] != "")
            {
                intForecast = Int32.Parse(Request.QueryString["parent"]);
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intID = Int32.Parse(Request.QueryString["id"]);
            }
            if (Request.QueryString["step"] != null && Request.QueryString["step"] != "")
            {
                panUpdate.Visible = true;
            }
            else
            {
                panNavigation.Visible = true;
            }
            if (!IsPostBack)
            {
                LoadList();
            }
            if (intID > 0)
            {
                DataSet ds = oForecast.GetAnswer(intID);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    int intClass   = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString());
                    int intAddress = Int32.Parse(ds.Tables[0].Rows[0]["addressid"].ToString());

                    bool boolHundred   = false;
                    int  intConfidence = Int32.Parse(ds.Tables[0].Rows[0]["confidenceid"].ToString());
                    if (intConfidence > 0)
                    {
                        Confidence oConfidence   = new Confidence(intProfile, dsn);
                        string     strConfidence = oConfidence.Get(intConfidence, "name");
                        if (strConfidence.Contains("100%") == true)
                        {
                            boolHundred = true;
                        }
                    }
                    if (boolHundred == true)
                    {
                        panUpdate.Visible     = false;
                        panNavigation.Visible = false;
                        btnHundred.Visible    = true;
                    }
                    int intPlatform = Int32.Parse(ds.Tables[0].Rows[0]["platformid"].ToString());
                    int intStep     = Int32.Parse(ds.Tables[0].Rows[0]["step"].ToString());
                    intForecast = Int32.Parse(ds.Tables[0].Rows[0]["forecastid"].ToString());
                    DataSet dsSteps = oForecast.GetSteps(intPlatform, 1);
                    if (dsSteps.Tables[0].Rows.Count == intStep)
                    {
                        btnNext.Text = "Finish";
                    }
                    if (intStep == 0 || intStep == 1)
                    {
                        btnBack.Enabled = false;
                    }
                    int intModel = oForecast.GetModel(intID);
                    if (intModel > 0)
                    {
                        panContinue.Visible = true;
                        Types oType   = new Types(intProfile, dsn);
                        int   intType = oModelsProperties.GetType(intModel);
                        if (oType.GetPlatform(intType) == intSharedPlatform)
                        {
                            panShared.Visible        = true;
                            rptRetention2.DataSource = oForecast.GetBackupRetentions(intID);
                            rptRetention2.DataBind();
                            foreach (RepeaterItem ri in rptRetention2.Items)
                            {
                                ((LinkButton)ri.FindControl("btnDeleteRetention")).Attributes.Add("onclick", "return confirm('Are you sure you want to delete this retention requirement?');");
                            }
                            lblNoneRetention2.Visible = (rptRetention2.Items.Count == 0);
                            btnAddRetention2.Attributes.Add("onclick", "return OpenWindow('BACKUP_RETENTION','?id=" + intID.ToString() + "');");
                        }
                        else
                        {
                            panNonShared.Visible = true;
                            bool boolProduction = oClass.IsProd(Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()));
                            bool boolNone       = (ds.Tables[0].Rows[0]["backup"].ToString() == "-2");
                            if (boolProduction == true)
                            {
                                if (boolNone == true)
                                {
                                    divYes.Style["display"] = "inline";
                                }
                                //if (oLocation.GetAddress(intAddress, "common") == "1")
                                //{
                                //    // Only Data Centers require backups
                                //    radNo.Enabled = false;
                                //    radNo.ToolTip = "All production bound servers in a data center require a backup";
                                //}
                            }
                            if (!IsPostBack)
                            {
                                if (Request.QueryString["child"] != null)
                                {
                                    radYes.Checked          = true;
                                    divYes.Style["display"] = "inline";
                                    if (Request.QueryString["daily"] != null)
                                    {
                                        chkDaily.Checked = true;
                                    }
                                    if (Request.QueryString["weekly"] != null)
                                    {
                                        chkWeekly.Checked          = true;
                                        divWeekly.Style["display"] = "inline";
                                        ddlWeekly.Enabled          = true;
                                        ddlWeekly.SelectedIndex    = Int32.Parse(Request.QueryString["week"]);
                                    }
                                    if (Request.QueryString["monthly"] != null)
                                    {
                                        chkMonthly.Checked = true;
                                    }
                                    ddlTimeHour.Enabled         = true;
                                    ddlTimeHour.SelectedIndex   = Int32.Parse(Request.QueryString["hour"]);
                                    ddlTimeSwitch.Enabled       = true;
                                    ddlTimeSwitch.SelectedIndex = Int32.Parse(Request.QueryString["switch"]);
                                    txtDate.Text = Request.QueryString["date"];
                                    ddlLocation.SelectedIndex = Int32.Parse(Request.QueryString["location"]);
                                }
                                else if (ds.Tables[0].Rows[0]["backup"].ToString() == "1")
                                {
                                    radYes.Checked = true;
                                    ds             = oForecast.GetBackup(intID);
                                    if (ds.Tables[0].Rows.Count > 0)
                                    {
                                        divYes.Style["display"] = "inline";
                                        if (ds.Tables[0].Rows[0]["daily"].ToString() == "1")
                                        {
                                            chkDaily.Checked = true;
                                        }
                                        if (ds.Tables[0].Rows[0]["weekly"].ToString() == "1")
                                        {
                                            chkWeekly.Checked          = true;
                                            divWeekly.Style["display"] = "inline";
                                            if (ds.Tables[0].Rows[0]["weekly_day"].ToString() != "None")
                                            {
                                                ddlWeekly.Enabled       = true;
                                                ddlWeekly.SelectedValue = ds.Tables[0].Rows[0]["weekly_day"].ToString();
                                            }
                                        }
                                        if (ds.Tables[0].Rows[0]["monthly"].ToString() == "1")
                                        {
                                            chkMonthly.Checked = true;
                                            //divMonthly.Style["display"] = "inline";
                                            //if (ds.Tables[0].Rows[0]["monthly_day"].ToString() != "None")
                                            //{
                                            //    ddlMonthlyDay.Enabled = true;
                                            //    ddlMonthlyDays.Enabled = true;
                                            //    ddlMonthlyDay.SelectedValue = ds.Tables[0].Rows[0]["monthly_day"].ToString();
                                            //    ddlMonthlyDays.SelectedValue = ds.Tables[0].Rows[0]["monthly_days"].ToString();
                                            //}
                                        }
                                        if (ds.Tables[0].Rows[0]["time"].ToString() == "1")
                                        {
                                            ddlTimeHour.Enabled         = true;
                                            ddlTimeSwitch.Enabled       = true;
                                            ddlTimeHour.SelectedValue   = ds.Tables[0].Rows[0]["time_hour"].ToString();
                                            ddlTimeSwitch.SelectedValue = ds.Tables[0].Rows[0]["time_switch"].ToString();
                                        }
                                        txtDate.Text = ds.Tables[0].Rows[0]["start_date"].ToString();
                                        ddlLocation.SelectedValue  = ds.Tables[0].Rows[0]["recoveryid"].ToString();
                                        txtCFPercent.Text          = ds.Tables[0].Rows[0]["cf_percent"].ToString();
                                        txtCFCompression.Text      = ds.Tables[0].Rows[0]["cf_compression"].ToString();
                                        ddlCFAverage.SelectedValue = ds.Tables[0].Rows[0]["cf_average"].ToString();
                                        txtCFBackup.Text           = ds.Tables[0].Rows[0]["cf_backup"].ToString();
                                        txtCFArchive.Text          = ds.Tables[0].Rows[0]["cf_archive"].ToString();
                                        txtCFWindow.Text           = ds.Tables[0].Rows[0]["cf_window"].ToString();
                                        txtCFSets.Text             = ds.Tables[0].Rows[0]["cf_sets"].ToString();
                                        ddlCDType.SelectedValue    = ds.Tables[0].Rows[0]["cd_type"].ToString();
                                        txtCDPercent.Text          = ds.Tables[0].Rows[0]["cd_percent"].ToString();
                                        txtCDCompression.Text      = ds.Tables[0].Rows[0]["cd_compression"].ToString();
                                        txtCDVersions.Text         = ds.Tables[0].Rows[0]["cd_versions"].ToString();
                                        txtCDWindow.Text           = ds.Tables[0].Rows[0]["cd_window"].ToString();
                                        txtCDGrowth.Text           = ds.Tables[0].Rows[0]["cd_growth"].ToString();
                                    }
                                }
                                else if (ds.Tables[0].Rows[0]["backup"].ToString() == "-1")
                                {
                                    radLater.Checked = true;
                                }
                                else if (ds.Tables[0].Rows[0]["backup"].ToString() == "0")
                                {
                                    radNo.Checked = true;
                                }
                                else if (boolProduction == true && boolNone == true)
                                {
                                    radYes.Checked = true;
                                }

                                rptExclusions.DataSource = oForecast.GetBackupExclusions(intID);
                                rptExclusions.DataBind();

                                foreach (RepeaterItem ri in rptExclusions.Items)
                                {
                                    ((LinkButton)ri.FindControl("btnDeleteExclusion")).Attributes.Add("onclick", "return confirm('Are you sure you want to delete this exclusion?');");
                                }
                                lblNoneExclusions.Visible = (rptExclusions.Items.Count == 0);

                                // Vijay code - start
                                rptInclusions.DataSource = oForecast.GetBackupInclusions(intID);
                                rptInclusions.DataBind();

                                foreach (RepeaterItem ri in rptInclusions.Items)
                                {
                                    ((LinkButton)ri.FindControl("btnDeleteInclusion")).Attributes.Add("onclick", "return confirm('Are you sure you want to delete this inclusion?');");
                                }
                                lblNoneInclusions.Visible = (rptInclusions.Items.Count == 0);
                                // Vijay code - end

                                rptRetention.DataSource = oForecast.GetBackupRetentions(intID);
                                rptRetention.DataBind();
                                foreach (RepeaterItem ri in rptRetention.Items)
                                {
                                    ((LinkButton)ri.FindControl("btnDeleteRetention")).Attributes.Add("onclick", "return confirm('Are you sure you want to delete this archive requirement?');");
                                }
                                lblNoneRetention.Visible = (rptRetention.Items.Count == 0);
                            }
                            if (boolProduction == true)
                            {
                                radNo.Attributes.Add("onclick", "ShowHideDiv('" + divNo.ClientID + "','inline');ShowHideDiv('" + divYes.ClientID + "','none');");
                            }
                            else
                            {
                                radNo.Attributes.Add("onclick", "ShowHideDiv('" + divYes.ClientID + "','none');");
                            }
                            radLater.Attributes.Add("onclick", "ShowHideDiv('" + divYes.ClientID + "','none');ShowHideDiv('" + divNo.ClientID + "','none');");
                            radYes.Attributes.Add("onclick", "ShowHideDiv('" + divYes.ClientID + "','inline');ShowHideDiv('" + divNo.ClientID + "','none');");

                            // Vijay code - start
                            chkDaily.Attributes.Add("onclick", "ForeBackCheck(this);");
                            chkWeekly.Attributes.Add("onclick", "ForeBackCheck(this);");
                            chkMonthly.Attributes.Add("onclick", "ForeBackCheck(this);");
                            // Vijay code - end

                            btnNext.Attributes.Add("onclick", "return EnsureBackup('" + radYes.ClientID + "','" + chkDaily.ClientID + "','" + chkWeekly.ClientID + "','" + ddlWeekly.ClientID + "','" + chkMonthly.ClientID + "','" + ddlMonthlyDay.ClientID + "','" + ddlMonthlyDays.ClientID + "','" + ddlTimeHour.ClientID + "','" + ddlTimeSwitch.ClientID + "','" + txtDate.ClientID + "','" + ddlLocation.ClientID + "');");
                            btnUpdate.Attributes.Add("onclick", "return EnsureBackup('" + radYes.ClientID + "','" + chkDaily.ClientID + "','" + chkWeekly.ClientID + "','" + ddlWeekly.ClientID + "','" + chkMonthly.ClientID + "','" + ddlMonthlyDay.ClientID + "','" + ddlMonthlyDays.ClientID + "','" + ddlTimeHour.ClientID + "','" + ddlTimeSwitch.ClientID + "','" + txtDate.ClientID + "','" + ddlLocation.ClientID + "');");
                            btnClose.Attributes.Add("onclick", "return window.close();");
                            btnAddExclusion.Attributes.Add("onclick", "return OpenWindow('BACKUP_EXCLUSION','?id=" + intID.ToString() + "');");
                            btnAddInclusion.Attributes.Add("onclick", "return OpenWindow('BACKUP_INCLUSION','?id=" + intID.ToString() + "');");
                            btnAddRetention.Attributes.Add("onclick", "return OpenWindow('BACKUP_RETENTION','?id=" + intID.ToString() + "');");
                            imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');");
                        }
                    }
                    else
                    {
                        panStop.Visible = true;
                    }
                }
            }
        }
        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();");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title        = "ClearView Auto-Provisioning";
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oAsset            = new Asset(intProfile, dsnAsset);
            oForecast         = new Forecast(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oServerName       = new ServerName(intProfile, dsn);
            oServiceRequest   = new ServiceRequests(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oRequest          = new Requests(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oOnDemandTasks    = new OnDemandTasks(intProfile, dsn);
            oResourceRequest  = new ResourceRequest(intProfile, dsn);
            oProject          = new Projects(intProfile, dsn);
            oSetting          = new Settings(intProfile, dsn);

            //Menu
            int intMenuTab = 0;

            if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
            {
                intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
            }
            Tab oTab = new Tab("", intMenuTab, "divMenu1", true, true);

            //End Menu

            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                intID      = Int32.Parse(Request.QueryString["id"]);
                intRequest = oForecast.GetRequestID(intID, true);
                DataSet dsRequest = oServiceRequest.Get(intRequest);
                if (dsRequest.Tables[0].Rows.Count > 0)
                {
                    Response.Redirect(Request.Path + "?rid=" + intRequest);
                }
            }
            if (Request.QueryString["rid"] != null && Request.QueryString["rid"] != "")
            {
                intRequest = Int32.Parse(Request.QueryString["rid"]);
            }
            if (Request.QueryString["notify"] != null)
            {
                string strRedirect = Request.Url.PathAndQuery;
                strRedirect = strRedirect.Substring(0, strRedirect.IndexOf("&notify"));
                if (Request.QueryString["notify"] == "none")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else if (Request.QueryString["notify"] == "true")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('Your design implementor has been successfully notified!');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else if (Request.QueryString["notify"] == "false")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('Your design implementor has ALREADY been notified!');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "close", "<script type=\"text/javascript\">alert('There was a problem notifying your design implementor\\n\\nPlease contact your ClearView administrator\\n\\nRequestID: " + intRequest.ToString() + "');window.navigate('" + strRedirect + "');<" + "/" + "script>");
                }
            }
            if (intID > 0)
            {
                Page.Title = "ClearView Auto-Provisioning | Design # " + intID.ToString();
                btnPrint.Attributes.Add("onclick", "return OpenWindow('DESIGN_PRINT', '?id=" + intID.ToString() + "');");
                bool    boolApproveNeeded = false;
                bool    boolApproved      = false;
                bool    boolPending       = false;
                bool    boolDenied        = false;
                Tab     oTabServer        = new Tab("", 0, "divMenuApprove", true, false);
                DataSet dsServers         = oServer.GetAnswer(intID);
                int     intServerCount    = 0;
                foreach (DataRow drServer in dsServers.Tables[0].Rows)
                {
                    int intServer = Int32.Parse(drServer["id"].ToString());
                    intServerCount++;
                    DataSet dsApprove = oServerName.GetComponentDetailUserApprovalsByServer(intServer);
                    if (dsApprove.Tables[0].Rows.Count > 0)
                    {
                        boolApproveNeeded = true;
                        oTabServer.AddTab("Device # " + intServerCount.ToString(), "");
                        string strApproveItem = "";
                        bool   boolOther      = true;
                        foreach (DataRow drApprove in dsApprove.Tables[0].Rows)
                        {
                            boolOther = (boolOther == false);
                            int      intDetail           = Int32.Parse(drApprove["detailid"].ToString());
                            int      intApprover         = 0;
                            string   strApproverComments = "";
                            int      intApproverApproved = -1;
                            DateTime datApproved         = DateTime.Now;
                            DataSet  dsApprovals         = oServerName.GetComponentDetailUserApprovals(intServer, intDetail);
                            if (dsApprovals.Tables[0].Rows.Count == 0)
                            {
                                boolPending = true;
                            }
                            else
                            {
                                intApprover         = Int32.Parse(dsApprovals.Tables[0].Rows[0]["userid"].ToString());
                                strApproverComments = dsApprovals.Tables[0].Rows[0]["comments"].ToString();
                                intApproverApproved = Int32.Parse(dsApprovals.Tables[0].Rows[0]["approved"].ToString());
                                datApproved         = DateTime.Parse(dsApprovals.Tables[0].Rows[0]["modified"].ToString());
                                if (intApproverApproved == 0)
                                {
                                    boolDenied = true;
                                }
                            }
                            string  strApprovers = "";
                            DataSet dsApprovers  = oServerName.GetComponentDetailUsers(intDetail, 1);
                            foreach (DataRow drApprover in dsApprovers.Tables[0].Rows)
                            {
                                int intUser = Int32.Parse(drApprover["userid"].ToString());
                                strApprovers += "<tr><td><a href=\"javascript:void(0);\" onclick=\"OpenWindow('PROFILE','?userid=" + intUser.ToString() + "');\"><img src=\"/images/" + (intApprover == 0 ? "pending" : (intUser == intApprover ? (intApproverApproved == 1 ? "check" : "cancel") : "user")) + ".gif\" border=\"0\" align=\"absmiddle\"/> " + oUser.GetFullName(intUser) + " (" + oUser.GetName(intUser) + ")</a></td></tr>";
                            }
                            strApprovers    = "<table>" + strApprovers + "</table>";
                            strApproveItem += "<tr" + (boolOther ? " bgcolor=\"#F6F6F6\"" : "") + ">";
                            string strLabel = drApprove["name"].ToString();
                            if (intApproverApproved > -1)
                            {
                                strLabel = "<a href=\"javascript:void(0);\" onclick=\"ShowHideDiv2('trApproval" + intServerCount.ToString() + "_" + intDetail.ToString() + "');\">" + strLabel + "</a>";
                            }
                            strApproveItem += "<td valign=\"top\" width=\"45%\" class=\"biggerbold\">" + strLabel + "</td>";
                            strApproveItem += "<td valign=\"top\" width=\"10%\">" + (intApproverApproved == -1 ? "Pending" : (intApproverApproved == 0 ? "Denied" : "Approved")) + "</td>";
                            strApproveItem += "<td valign=\"top\" width=\"45%\" align=\"right\">" + strApprovers + "</td>";
                            strApproveItem += "</tr>";
                            if (intApproverApproved > -1)
                            {
                                string strApproveTable = "<tr><td colspan=\"2\"><span style=\"width:100%;border-bottom:1 dotted #CCCCCC;\"/></td></tr>";
                                strApproveTable += "<tr>";
                                strApproveTable += "<td nowrap valign=\"top\"><img src=\"/images/" + (intApproverApproved == 0 ? "cancel" : "check") + ".gif\" border=\"0\" align=\"absmiddle\"/></td>";
                                strApproveTable += "<td width=\"100%\" valign=\"top\">" + oUser.GetFullName(intApprover) + " " + (intApproverApproved == 0 ? "DENIED" : "APPROVED") + " this request on " + datApproved.ToString() + "</td>";
                                strApproveTable += "</tr>";
                                if (strApproverComments != "")
                                {
                                    strApproveTable += "<tr>";
                                    strApproveTable += "<td colspan=\"2\">The following comments were added...</td>";
                                    strApproveTable += "</tr>";
                                    strApproveTable += "<tr>";
                                    strApproveTable += "<td nowrap valign=\"top\"><img src=\"/images/comment.gif\" border=\"0\" align=\"absmiddle\"/></td>";
                                    strApproveTable += "<td width=\"100%\" valign=\"top\" class=\"comment\">" + strApproverComments + "</td>";
                                    strApproveTable += "</tr>";
                                }
                                strApproveTable = "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"3\" border=\"0\">" + strApproveTable + "</table>";
                                strApproveItem += "<tr id=\"trApproval" + intServerCount.ToString() + "_" + intDetail.ToString() + "\" style=\"display:none\"" + (boolOther ? " bgcolor=\"#F6F6F6\"" : "") + "><td colspan=\"3\">" + strApproveTable + "</td></tr>";
                            }
                        }
                        strApproveItem = "<tr bgcolor=\"#EEEEEE\"><td class=\"header\">Component</td><td class=\"header\">Status</td><td class=\"header\" align=\"right\">Approver(s)</td></tr>" + strApproveItem;
                        strApproveItem = "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\" style=\"border:solid 1px #CCCCCC\">" + strApproveItem + "</table>";
                        strApprove    += "<div id=\"divTab" + intServerCount.ToString() + "\" style=\"display:none\">" + strApproveItem + "</div>";
                    }
                }
                if (boolApproveNeeded == true)
                {
                    trApprove.Visible = true;
                    if (boolDenied == true)
                    {
                        btnSoftwareBack.Visible = true;
                        imgApproved.ImageUrl    = "/images/ico_error.gif";
                        lblApprovedHeader.Text  = "Software Component(s) Denied";
                        lblApproved.Text        = "One or more of the software components you requested have been denied. You cannot continue until all components have been approved.<br/>You will need to make changes to this design - please click <b>Make Changes</b> to change your software component requirements.<br/>All questions and status inquiries should be sent to the approver(s) listed below.";
                    }
                    else if (boolPending == true)
                    {
                        imgApproved.ImageUrl   = "/images/ico_hourglass.gif";
                        lblApprovedHeader.Text = "Software Component(s) Pending";
                        lblApproved.Text       = "One or more of the software components you requested are awaiting approval. You cannot continue until all components have been approved.<br/>All questions and status inquiries should be sent to the approver(s) listed below.";
                    }
                    else
                    {
                        boolApproved           = true;
                        lblApprovedHeader.Text = "Software Component(s) Approved";
                        lblApproved.Text       = "All of the software components you requested have been approved!";
                    }
                    btnApproved.Attributes.Add("onclick", "ShowHideDiv2('" + trApprove.ClientID + "');return false;");
                    strMenuTabApprove = oTabServer.GetTabs();
                }
                else
                {
                    boolApproved           = true;
                    lblApprovedHeader.Text = "No Approval Required";
                    lblApproved.Text       = "There are no approvals required for your software components";
                    btnApproved.Enabled    = false;
                }

                string strSchedule = oForecast.GetAnswer(intID, "execution");
                if (strSchedule != "")
                {
                    DateTime datSchedule = DateTime.Parse(strSchedule);
                    txtScheduleDate.Text = datSchedule.ToShortDateString();
                    txtScheduleTime.Text = datSchedule.ToShortTimeString();
                    btnSchedule.Text     = "Update the Build";
                }
                panBegin.Visible = true;
                bool boolAssigned = false;

                int intModel = oForecast.GetModelAsset(intID);
                if (intModel == 0)
                {
                    intModel = oForecast.GetModel(intID);
                }

                string strChange = "true";
                string strFreeze = "";
                // Check Freeze Dates
                bool boolFreeze = false;
                strFreezeStart = oSetting.Get("freeze_start");
                strFreezeEnd   = oSetting.Get("freeze_end");
                if (strFreezeStart != "" && strFreezeEnd != "" && DateTime.Parse(strFreezeStart) <= DateTime.Now && DateTime.Parse(strFreezeEnd) > DateTime.Now)
                {
                    boolFreeze = true;
                    divChange.Style["display"] = "inline";
                    if (!IsPostBack)
                    {
                        txtChange.Text = oForecast.GetAnswer(intID, "change");
                    }
                    strChange = "ValidateTextLength('" + txtChange.ClientID + "', 'Please enter a valid change control number\\n\\n - Must start with \"CHG\" or \"PTM\"\\n - Must be exactly 10 characters in length', 10, 'CHG', 'PTM')";
                }
                int intClass = Int32.Parse(oForecast.GetAnswer(intID, "classid"));

                int intForecast = 0;
                Int32.TryParse(oForecast.GetAnswer(intID, "forecastid"), out intForecast);
                int intRequestID = 0;
                Int32.TryParse(oForecast.Get(intForecast, "requestid"), out intRequestID);
                int intProject = 0;
                if (intRequestID > 0)
                {
                    intProject = oRequest.GetProjectNumber(intRequestID);
                }
                int intProjectStatus = 0;
                if (intProject > 0)
                {
                    Int32.TryParse(oProject.Get(intProject, "status"), out intProjectStatus);
                }

                if (oForecast.CanAutoProvision(intID) == true)
                {
                    boolAssigned = true;
                }
                else
                {
                    if (oOnDemandTasks.GetPending(intID).Tables[0].Rows.Count > 0)
                    {
                        boolAssigned = true;
                    }
                    else
                    {
                        // Add Resource Request
                        int     intImplementor = 0;
                        string  strType        = "Distributed";
                        DataSet dsResource     = oResourceRequest.GetProjectItem(intProject, intImplementorDistributed);
                        if (oForecast.GetPlatformDistributed(intID, intWorkstationPlatform) == false)
                        {
                            dsResource = oResourceRequest.GetProjectItem(intProject, intImplementorMidrange);
                            strType    = "Midrange";
                        }
                        if (dsResource.Tables[0].Rows.Count > 0)
                        {
                            intImplementor = (dsResource.Tables[0].Rows[0]["userid"].ToString() == "" ? 0 : Int32.Parse(dsResource.Tables[0].Rows[0]["userid"].ToString()));
                        }
                        if (intImplementor > 0)
                        {
                            int intNextNumber       = oResourceRequest.GetNumber(intRequestID);
                            int intResourceParent   = oResourceRequest.Add(intRequestID, -1, -1, intNextNumber, "Provisioning Task (" + strType + ")", 0, 6.00, 2, 1, 1, 1);
                            int intResourceWorkflow = oResourceRequest.AddWorkflow(intResourceParent, 0, "Provisioning Task (" + strType + ")", intImplementor, 0, 6.00, 2, 0);
                            oOnDemandTasks.AddPending(intID, intResourceWorkflow);
                            oResourceRequest.UpdateAssignedBy(intResourceParent, -999);
                        }
                    }
                }

                lblNotify.Visible = boolBurnIn;

                bool boolOKtoExecute = false;
                if (intProject == -100)
                {
                    // Pending project approval
                    btnStart.Attributes.Add("onclick", "alert('This design cannot be executed because the associated project is currently pending approval.\\n\\nMost likely, this is because you just entered a new project into the system\\n\\nPlease contact your ClearView administrator or check back later.');return false;");
                    btnSchedule.Attributes.Add("onclick", "alert('This design cannot be scheduled because the associated project is currently pending approval.\\n\\nMost likely, this is because you just entered a new project into the system\\n\\nPlease contact your ClearView administrator or check back later.');return false;");
                }
                else
                {
                    if (oForecast.CanAutoProvision(intID) == true)
                    {
                        btnSchedule.Enabled = true;
                        boolOKtoExecute     = true;
                    }
                    else
                    {
                        if (boolAssigned == false)
                        {
                            btnStart.Attributes.Add("onclick", "alert('You cannot execute a design until a design implementor has been assigned.');return false;");
                            btnSchedule.Attributes.Add("onclick", "alert('You cannot schedule the execution of a design until a design implementor has been assigned.');return false;");
                        }
                        else
                        {
                            boolOKtoExecute = true;
                        }
                    }
                }

                imgScheduleDate.Attributes.Add("onclick", "return ShowCalendar('" + txtScheduleDate.ClientID + "');");
                if (boolOKtoExecute == true)
                {
                    btnStart.Attributes.Add("onclick", "return " + strChange + " && confirm('NOTE: Billing will begin: " + DateTime.Today.ToShortDateString() + "\\n\\nAre you sure you want to continue?');");
                    btnSchedule.Attributes.Add("onclick", "return ValidateDate('" + txtScheduleDate.ClientID + "','Please enter a valid schedule date')" +
                                               " && ValidateDateToday('" + txtScheduleDate.ClientID + "','The scheduled date must occur after today')" +
                                               " && ValidateFreeze('" + txtScheduleDate.ClientID + "','" + divChange.ClientID + "','" + txtChange.ClientID + "'," + (boolFreeze ? "true" : "false") + ")" +
                                               " && ValidateTime('" + txtScheduleTime.ClientID + "','Please enter a valid start time')" +
                                               " && confirm('NOTE: Billing will begin: ' + document.getElementById('" + txtScheduleDate.ClientID + "').value + '\\n\\nAre you sure you want to continue?')" +
                                               " && ProcessButton(this)" +
                                               ";");
                }

                if (oModelsProperties.IsInventory(intModel) == true)
                {
                    panInventoryYes.Visible = true;
                    if (boolApproved == false)
                    {
                        divSoftware.Style["display"] = "inline";
                        divDefault.Style["display"]  = "none";
                        radStart.Enabled             = false;
                        btnStart.Enabled             = false;
                        radSchedule.Enabled          = false;
                        btnSchedule.Enabled          = false;
                        radApproval.Enabled          = false;
                        btnApprovals.Enabled         = false;
                    }
                }
                else
                {
                    lblInventory.Text            = oModelsProperties.Get(intModel, "name");
                    panInventoryNo.Visible       = true;
                    divSoftware.Style["display"] = "none";
                    divDefault.Style["display"]  = "none";
                    radStart.Enabled             = false;
                    btnStart.Enabled             = false;
                    radSchedule.Enabled          = false;
                    btnSchedule.Enabled          = false;
                    radApproval.Enabled          = false;
                    btnApprovals.Enabled         = false;
                }
            }
            else if (intRequest > 0)
            {
                intRequest = Int32.Parse(Request.QueryString["rid"]);
                DateTime datSchedule = DateTime.Now;
                DataSet  ds          = oServer.GetRequests(intRequest, 1);
                bool     boolPending = false;
                int      intAnswer   = 0;
                int      intModel    = 0;
                if (ds.Tables[0].Rows.Count > 0)
                {
                    intAnswer = Int32.Parse(ds.Tables[0].Rows[0]["answerid"].ToString());
                    intModel  = oForecast.GetModelAsset(intAnswer);
                    if (intModel == 0)
                    {
                        intModel = oForecast.GetModel(intAnswer);
                    }
                    string strSchedule = oForecast.GetAnswer(intAnswer, "execution");
                    if (strSchedule != "")
                    {
                        datSchedule          = DateTime.Parse(strSchedule);
                        lblScheduleDate.Text = datSchedule.ToShortDateString();
                        lblScheduleTime.Text = datSchedule.ToShortTimeString();
                        if (DateTime.Now < datSchedule)
                        {
                            boolPending = true;
                        }
                    }
                }
                Page.Title = "ClearView Auto-Provisioning | Design # " + intAnswer.ToString();
                if (oForecast.CanAutoProvision(intAnswer) == false)
                {
                    panNotExecutable.Visible = true;
                    lblInitiated.Text        = oForecast.GetAnswer(intAnswer, "executed");
                    lblCompleted.Text        = oForecast.GetAnswer(intAnswer, "completed");
                    int     intImplementorUser = 0;
                    DataSet dsImplementor      = oOnDemandTasks.GetPending(intAnswer);
                    if (dsImplementor.Tables[0].Rows.Count > 0)
                    {
                        intImplementorUser = Int32.Parse(dsImplementor.Tables[0].Rows[0]["resourceid"].ToString());
                        intImplementorUser = Int32.Parse(oResourceRequest.GetWorkflow(intImplementorUser, "userid"));
                    }
                    strManualImage        = "<img src=\"/frame/picture.aspx?xid=" + oUser.GetName(intImplementorUser) + "\" border=\"0\" align=\"absmiddle\" style=\"height:90px;width:90px;border-width:0px;border:solid 1px #999999;\" />";
                    lblImplementor.Text   = oUser.GetFullName(intImplementorUser) + " (" + oUser.GetName(intImplementorUser) + ")";
                    strManualReason       = oForecast.CanAutoProvisionReason(intAnswer);
                    btnManual.NavigateUrl = "/datapoint/service/design.aspx?t=design&q=" + oFunction.encryptQueryString(intAnswer.ToString());
                    rptServers.DataSource = oServer.GetManual(intAnswer, false);
                    rptServers.DataBind();
                    foreach (RepeaterItem ri in rptServers.Items)
                    {
                        Label lblName = (Label)ri.FindControl("lblName");
                        if (lblName.Text != "--- Pending ---")
                        {
                            lblName.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/datapoint/asset/datapoint_asset_search.aspx?t=name&q=" + oFunction.encryptQueryString(lblName.Text) + "&id=" + oFunction.encryptQueryString(lblName.ToolTip) + "',800,600);\">" + lblName.Text + "</a>";
                        }
                        else
                        {
                            lblName.Text = "<i>" + lblName.Text + "</i>";
                        }
                        Label lblAsset = (Label)ri.FindControl("lblAsset");
                        if (lblAsset.Text != "--- Pending ---")
                        {
                            lblAsset.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/datapoint/asset/datapoint_asset_search.aspx?t=serial&q=" + oFunction.encryptQueryString(lblAsset.Text) + "',800,600);\">" + lblAsset.Text + "</a>";
                        }
                        else
                        {
                            lblAsset.Text = "<i>" + lblAsset.Text + "</i>";
                        }
                        Label lblAssetDR = (Label)ri.FindControl("lblAssetDR");
                        if (lblAssetDR.Text != "--- None ---")
                        {
                            if (lblAssetDR.Text != "--- Pending ---")
                            {
                                if (lblAssetDR.Text != "Missing!!!")
                                {
                                    lblAssetDR.Text = "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/datapoint/asset/datapoint_asset_search.aspx?t=serial&q=" + oFunction.encryptQueryString(lblAssetDR.Text) + "',800,600);\">" + lblAssetDR.Text + "</a>";
                                }
                                else
                                {
                                    lblAssetDR.Text = "<span class=\"highlight\">" + lblAssetDR.Text + "</span>";
                                }
                            }
                            else
                            {
                                lblAssetDR.Text = "<i>" + lblAssetDR.Text + "</i>";
                            }
                        }
                        else
                        {
                            lblAssetDR.Text = "<i>Not Required</i>";
                        }
                        Label lblIP1 = (Label)ri.FindControl("lblIP1");
                        if (lblIP1.Text == "--- Pending ---")
                        {
                            lblIP1.Text = "<i>" + lblIP1.Text + "</i>";
                        }
                        Label lblIP2 = (Label)ri.FindControl("lblIP2");
                        if (lblIP2.Text == "--- Pending ---")
                        {
                            lblIP2.Text = "<i>" + lblIP2.Text + "</i>";
                        }
                        Label lblIP3 = (Label)ri.FindControl("lblIP3");
                        if (lblIP3.Text == "--- Pending ---")
                        {
                            lblIP3.Text = "<i>" + lblIP3.Text + "</i>";
                        }
                    }
                }
                else
                {
                    if (boolPending == true)
                    {
                        panPending.Visible = true;
                        TimeSpan oSpan = datSchedule.Subtract(DateTime.Now);
                        if (oSpan.Seconds > 0)
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "cdown", "<script type=\"text/javascript\">StartClockCountdown('" + lblCountdown.ClientID + "'," + oSpan.TotalMilliseconds.ToString() + ");<" + "/" + "script>");
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "cdown", "<script type=\"text/javascript\">StartClockCountdown('" + lblCountdown.ClientID + "',0);<" + "/" + "script>");
                        }
                    }
                    else
                    {
                        panStart.Visible = true;
                        int   intCount = 0;
                        Types oType    = new Types(intProfile, dsn);

                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            intCount++;
                            int intServer = Int32.Parse(dr["id"].ToString());
                            int intAsset  = 0;
                            if (dr["assetid"].ToString() != "")
                            {
                                intAsset = Int32.Parse(dr["assetid"].ToString());
                            }
                            int intType = 0;
                            intModel = 0;
                            if (dr["modelid"].ToString() != "")
                            {
                                intModel = Int32.Parse(dr["modelid"].ToString());
                            }
                            if (intModel > 0)
                            {
                                intType = oModelsProperties.GetType(intModel);
                            }
                            string strName = "Device " + intCount.ToString();
                            if (intAsset > 0)
                            {
                                string strTempName = oAsset.Get(intAsset, "name");
                                if (strTempName != "")
                                {
                                    strName = strTempName;
                                }
                            }
                            if (intCount == 1)
                            {
                                //strTab += "<td><img src=\"/images/TabOnLeftCap.gif\"></td><td nowrap background=\"/images/TabOnBackground.gif\"><a href=\"javascript:void(0);\" onclick=\"ChangeTab(this,'divTab" + intCount.ToString() + "',null,null,true);\" class=\"tabheader\">" + strName + "</a></td><td><img src=\"/images/TabOnRightCap.gif\"></td>";
                                oTab.AddTab(strName, "");
                                strDivs += "<div id=\"divTab" + intCount.ToString() + "\" style=\"display:inline\"><iframe width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\" src=\"" + oType.Get(intType, "ondemand_steps_path") + "?id=" + oFunction.encryptQueryString(intServer.ToString()) + "&c=" + intCount.ToString() + "\"></iframe></div>";
                            }
                            else
                            {
                                // strTab += "<td><img src=\"/images/TabOffLeftCap.gif\"></td><td nowrap background=\"/images/TabOffBackground.gif\"><a href=\"javascript:void(0);\" onclick=\"ChangeTab(this,'divTab" + intCount.ToString() + "',null,null,true);\" class=\"tabheader\">" + strName + "</a></td><td><img src=\"/images/TabOffRightCap.gif\"></td>";
                                oTab.AddTab(strName, "");
                                strDivs += "<div id=\"divTab" + intCount.ToString() + "\" style=\"display:none\"><iframe width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\" src=\"" + oType.Get(intType, "ondemand_steps_path") + "?id=" + oFunction.encryptQueryString(intServer.ToString()) + "&c=" + intCount.ToString() + "\"></iframe></div>";
                            }
                        }

                        strMenuTab1 = oTab.GetTabs();
                        //if (strTab != "")
                        //    strMenuTab1 += "<tr>" + strTab + "<td width=\"100%\" background=\"/images/TabEmptyBackground.gif\">&nbsp;</td></tr>";
                        //strMenuTab1 = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" + strMenuTab1 + "</table>";
                    }
                }
            }
            radStart.Attributes.Add("onclick", "ShowBuildDivs('" + divStart.ClientID + "','" + divDefault.ClientID + "','" + divSchedule.ClientID + "','" + divApproval.ClientID + "');");
            radSchedule.Attributes.Add("onclick", "ShowBuildDivs('" + divSchedule.ClientID + "','" + divDefault.ClientID + "','" + divStart.ClientID + "','" + divApproval.ClientID + "');");
            radApproval.Attributes.Add("onclick", "ShowBuildDivs('" + divApproval.ClientID + "','" + divDefault.ClientID + "','" + divStart.ClientID + "','" + divSchedule.ClientID + "');");
            btnApprovals.Attributes.Add("onclick", "return OpenWindow('DESIGN_APPROVERS','?id=" + intID.ToString() + "');");
        }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            RequestFields   oRequestField   = new RequestFields(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            Services        oService        = new Services(intProfile, dsn);
            Log             oLog            = new Log(intProfile, dsn);
            Users           oUser           = new Users(intProfile, dsn);
            Functions       oFunction       = new Functions(intProfile, dsn, intEnvironment);
            Pages           oPage           = new Pages(intProfile, dsn);
            Requests        oRequest        = new Requests(intProfile, dsn);
            Variables       oVariable       = new Variables(intEnvironment);
            int             intRequest      = Int32.Parse(Request.QueryString["rid"]);
            string          strStatus       = oServiceRequest.Get(intRequest, "checkout");
            DataSet         dsItems         = oRequestItem.GetForms(intRequest);
            int             intItem         = 0;
            int             intService      = 0;
            int             intNumber       = 0;

            if (dsItems.Tables[0].Rows.Count > 0)
            {
                bool boolBreak = false;
                foreach (DataRow drItem in dsItems.Tables[0].Rows)
                {
                    if (boolBreak == true)
                    {
                        break;
                    }
                    if (drItem["done"].ToString() == "0")
                    {
                        intItem    = Int32.Parse(drItem["itemid"].ToString());
                        intService = Int32.Parse(drItem["serviceid"].ToString());
                        intNumber  = Int32.Parse(drItem["number"].ToString());
                        boolBreak  = true;
                    }
                    if (intItem > 0 && (strStatus == "1" || strStatus == "2"))
                    {
                        string strResult = oService.GetName(intService) + " Completed";
                        string strError  = oService.GetName(intService) + " Error";
                        // ********* BEGIN PROCESSING **************
                        string           strCVT            = "CVT" + intRequest.ToString() + "-" + intService.ToString() + "-" + intNumber.ToString();
                        Forecast         oForecast         = new Forecast(intProfile, dsn);
                        ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                        Types            oType             = new Types(intProfile, dsn);
                        DataSet          dsService         = oForecast.GetAnswerService(intRequest);
                        if (dsService.Tables[0].Rows.Count > 0)
                        {
                            int     intAnswer  = Int32.Parse(dsService.Tables[0].Rows[0]["id"].ToString());
                            int     intModel   = Int32.Parse(dsService.Tables[0].Rows[0]["modelid"].ToString());
                            int     intType    = oModelsProperties.GetType(intModel);
                            string  strExecute = oType.Get(intType, "forecast_execution_path");
                            DataSet dsSelected = oService.GetSelected(intRequest, intService, intNumber);

                            if (oServiceRequest.NotifyApproval(intRequest, intService, intNumber, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                            {
                                oLog.AddEvent(intRequest.ToString(), strCVT, "Service request has been fully approved", LoggingType.Debug);
                                Workstations oWorkstation = new Workstations(intProfile, dsn);
                                oWorkstation.ExecuteVMware(intRequest);
                                oLog.AddEvent(intRequest.ToString(), strCVT, "Service request ExecuteVMware has completed.", LoggingType.Debug);
                            }
                            else
                            {
                                oLog.AddEvent(intRequest.ToString(), strCVT, "Service request has been sent for approval", LoggingType.Debug);
                            }
                            //if (strExecute != "")
                            //    btnStart.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');");
                            //else
                            //    btnStart.Attributes.Add("onclick", "alert('Execution has not been configured for asset type " + oType.Get(intType, "name") + "');return false;");
                            strDone += "<table border=\"0\"><tr><td><img src=\"/images/bigCheck.gif\" border=\"0\" align=\"absmiddle\"/></td><td class=\"biggerbold\">" + oService.GetName(intService) + " Submitted</td></tr></table>";
                        }
                        // ******** END PROCESSING **************
                        oRequestItem.UpdateFormDone(intRequest, intItem, intNumber, 1);
                    }
                }
            }
        }
Beispiel #13
0
        protected void btnGo_Click(Object Sender, EventArgs e)
        {
            Design   oDesign   = new Design(0, dsn);
            Log      oLog      = new Log(0, dsn);
            Forecast oForecast = new Forecast(0, dsn);
            Users    oUser     = new Users(0, dsn);
            int      intID     = Int32.Parse(txtID.Text);
            DataSet  dsDesign  = oDesign.Get(intID);

            if (dsDesign.Tables[0].Rows.Count > 0)
            {
                Int32.TryParse(dsDesign.Tables[0].Rows[0]["answerid"].ToString(), out intID);
            }
            if (oForecast.GetAnswer(intID).Tables[0].Rows.Count > 0)
            {
                ResourceRequest  oResourceRequest  = new ResourceRequest(0, dsn);
                int              intForecast       = Int32.Parse(oForecast.GetAnswer(intID, "forecastid"));
                int              intRequestExecute = oForecast.GetRequestID(intID, true);
                int              intRequest        = Int32.Parse(oForecast.Get(intForecast, "requestid"));
                Requests         oRequest          = new Requests(0, dsn);
                ServiceRequests  oServiceRequest   = new ServiceRequests(0, dsn);
                int              intProject        = oRequest.GetProjectNumber(intRequest);
                Variables        oVariable         = new Variables(intEnvironment);
                Functions        oFunction         = new Functions(0, dsn, intEnvironment);
                Projects         oProject          = new Projects(0, dsn);
                Pages            oPage             = new Pages(0, dsn);
                Servers          oServer           = new Servers(0, dsn);
                Cluster          oCluster          = new Cluster(0, dsn);
                ServerName       oServerName       = new ServerName(0, dsn);
                Asset            oAsset            = new Asset(0, dsnAsset);
                IPAddresses      oIPAddresses      = new IPAddresses(intProfile, dsnIP, dsn);
                OnDemand         oOnDemand         = new OnDemand(0, dsn);
                ModelsProperties oModelsProperties = new ModelsProperties(0, dsn);
                Types            oType             = new Types(0, dsn);
                Storage          oStorage          = new Storage(0, dsn);
                OnDemandTasks    oOnDemandTasks    = new OnDemandTasks(0, dsn);
                VMWare           oVMWare           = new VMWare(0, dsn);
                PNCTasks         oPNCTasks         = new PNCTasks(0, dsn);
                Zeus             oZeus             = new Zeus(intProfile, dsnZeus);

                DataSet dsServers = oServer.GetRequests(intRequestExecute, 0);

                if (chkTimes.Checked == true && (chkExitAP.Checked == true || chkConfig.Checked == true || chkUnlock.Checked == true))
                {
                    strError = "You can not and should not reset times and alter the design at the same time.  RESET PROVISIONING TIMES can not be selected with any other selections.";
                }
                else
                {
                    oLog.AddEvent(intID, "", "", "Design " + intID.ToString() + " reset by " + oUser.GetFullNameWithLanID(intProfile), LoggingType.Information);
                    oForecast.AddReset(intID, -999);
                    if (chkTimes.Checked == true)
                    {
                        DateTime datTimes = DateTime.Today;
                        if (DateTime.TryParse(txtTimes.Text, out datTimes) == true)
                        {
                            // Update Design Dates
                            int intExecutedBy = 0;
                            Int32.TryParse(oForecast.GetAnswer(intID, "executed_by"), out intExecutedBy);
                            if (intExecutedBy > 0)
                            {
                                if (chkTimesForecastExecuted.Checked == true)
                                {
                                    oForecast.UpdateAnswerExecuted(intID, datTimes.ToString(), intExecutedBy);
                                }
                                if (chkTimesForecastCompleted.Checked == true)
                                {
                                    oForecast.UpdateAnswerCompleted(intID, datTimes.ToString());
                                }
                                if (chkTimesTasksStart.Checked == true)
                                {
                                    // Reset all pre-production online tasks (including storage, backup, etc...)
                                    DataSet dsTasks = oPNCTasks.GetStepsDesign(intID, 0, 0);
                                    foreach (DataRow drTask in dsTasks.Tables[0].Rows)
                                    {
                                        int intRRID = 0;
                                        if (Int32.TryParse(drTask["id"].ToString(), out intRRID) == true)
                                        {
                                            // Reset the started and completed (if not null)
                                            oOnDemandTasks.UpdateTime(intRRID, datTimes, chkTimesTasksCompleted.Checked);
                                        }
                                    }
                                }
                                DataSet dsAnswer = oServer.GetAnswer(intID);
                                foreach (DataRow drServer in dsAnswer.Tables[0].Rows)
                                {
                                    int     intServer = Int32.Parse(drServer["id"].ToString());
                                    int     intModel  = Int32.Parse(drServer["modelid"].ToString());
                                    int     intType   = oModelsProperties.GetType(intModel);
                                    DataSet dsSteps   = oOnDemand.GetSteps(intType, 1);
                                    // Update Server Dates
                                    if (oServer.Get(intServer, "build_started") != "")
                                    {
                                        if (chkTimesServerStart.Checked == true)
                                        {
                                            oServer.UpdateBuildStarted(intServer, datTimes.ToString(), true);
                                        }
                                        if (chkTimesServerSteps.Checked == true)
                                        {
                                            int intStep = 0;
                                            foreach (DataRow drStep in dsSteps.Tables[0].Rows)
                                            {
                                                intStep++;
                                                oOnDemand.UpdateStepDoneServer(intServer, intStep, datTimes);
                                            }
                                        }
                                    }

                                    if (chkTimesServerComplete.Checked == true)
                                    {
                                        oServer.UpdateBuildCompleted(intServer, datTimes.ToString());
                                    }

                                    if (chkTimesServerReady.Checked == true)
                                    {
                                        oServer.UpdateBuildReady(intServer, datTimes.ToString(), true);
                                    }
                                }
                            }
                            else
                            {
                                strError = "The design has not been executed";
                            }
                        }
                        else
                        {
                            strError = "Invalid DateTime";
                        }
                    }
                    if (chkExitAP.Checked == true)
                    {
                        // Delete the Manual Build Task
                        DataSet dsManual = oOnDemandTasks.GetGenericII(intID);
                        if (dsManual.Tables[0].Rows.Count > 0)
                        {
                            int intRequestID = Int32.Parse(dsManual.Tables[0].Rows[0]["requestid"].ToString());
                            int intItem      = Int32.Parse(dsManual.Tables[0].Rows[0]["itemid"].ToString());
                            int intNumber    = Int32.Parse(dsManual.Tables[0].Rows[0]["number"].ToString());
                            oOnDemandTasks.DeleteGenericII(intID);
                            DataSet dsParent = oResourceRequest.Get(intRequestID, intItem, intNumber);
                            if (dsParent.Tables[0].Rows.Count > 0)
                            {
                                int intRRID = Int32.Parse(dsParent.Tables[0].Rows[0]["parent"].ToString());
                                oResourceRequest.Delete(intRRID);
                                int intRRWID = Int32.Parse(dsParent.Tables[0].Rows[0]["id"].ToString());
                                oResourceRequest.DeleteWorkflow(intRRWID);
                            }
                        }
                        // Reset automated servers
                        foreach (DataRow drServer in dsServers.Tables[0].Rows)
                        {
                            int intServer = Int32.Parse(drServer["id"].ToString());
                            int intAsset  = 0;
                            Int32.TryParse(drServer["assetid"].ToString(), out intAsset);

                            // Clear MDT / Altiris
                            oServer.ClearMDT(intServer, dsnAsset, dsnZeus, intEnvironment);
                            // Clear ZEUS
                            if (intAsset > 0)
                            {
                                oZeus.DeleteBuild(oAsset.Get(intAsset, "serial"));
                            }
                            // Clear Steps
                            oServer.UpdateStep(intServer, 0);
                            oOnDemand.DeleteStepDoneServers(intServer, 1);
                            // Clear Dates
                            oServer.UpdateBuildStarted(intServer, "", true);
                            oServer.UpdateBuildCompleted(intServer, "");
                            oServer.UpdateBuildReady(intServer, "", true);
                            // Clear Errors
                            DataSet dsError = oServer.GetErrors(intServer);
                            foreach (DataRow drError in dsError.Tables[0].Rows)
                            {
                                if (drError["fixed"].ToString() == "")
                                {
                                    oServer.UpdateError(intServer, Int32.Parse(drError["step"].ToString()), 0, 0, true, dsnAsset);
                                }
                            }
                            // Clear VMware
                            oVMWare.DeleteGuest(oServer.GetName(intServer, true));
                            oServiceRequest.Delete(intRequestExecute);

                            if (chkExitAP_Name.Checked == true && drServer["nameid"].ToString() != "")
                            {
                                int intName = Int32.Parse(drServer["nameid"].ToString());
                                oServer.UpdateServerNamed(intServer, 0);
                                oServerName.UpdateFactory(intName, 1);
                            }
                            if (chkExitAP_IP.Checked == true)
                            {
                                oServer.DeleteIP(intServer, 0, 0, 0, 0, dsnIP);
                            }
                            if (chkExitAP_Asset.Checked == true && intAsset > 0)
                            {
                                oServer.DeleteAsset(intServer);
                                oAsset.AddStatus(intAsset, "", (int)AssetStatus.Available, -100, DateTime.Now);
                            }
                        }
                        // Clear the execution and completion dates
                        oForecast.UpdateAnswerExecution(intID, "");
                        oForecast.UpdateAnswerExecuted(intID, "", 0);
                        oForecast.UpdateAnswerCompleted(intID, "");

                        // Clear the new design builder.
                        if (dsDesign.Tables[0].Rows.Count > 0)
                        {
                            int intDesign = Int32.Parse(dsDesign.Tables[0].Rows[0]["id"].ToString());
                            oForecast.DeleteAnswer(intID);
                            foreach (DataRow drServer in dsServers.Tables[0].Rows)
                            {
                                int intServer = Int32.Parse(drServer["id"].ToString());
                                oServer.Delete(intServer);
                            }
                            oDesign.UpdateAnswerId(intDesign, 0);
                            if (chkExitAP_Approvals.Checked == true)
                            {
                                oDesign.DeleteApproverFieldWorkflow(intDesign);
                                oDesign.DeleteApproverGroupWorkflow(intDesign, 0);
                                oDesign.DeleteApproverGroupWorkflow(intDesign, 1);
                                oDesign.DeleteSoftwareComponents(intDesign, true);
                                if (chkExitAP_Submissions.Checked == false)
                                {
                                    // Reset back to original requestor.
                                    oDesign.Approve(intDesign, 0, (oDesign.Get(intDesign, "is_exception") == "1"), intEnvironment, intImplementorDistributedService, intWorkstationPlatform, intImplementorMidrangeService, dsnAsset, dsnIP, dsnServiceEditor, intAssignPage, intResourceRequestApprove, intViewPage);
                                }
                            }
                            if (chkExitAP_Submissions.Checked == true)
                            {
                                oDesign.DeleteSubmitted(intDesign);
                            }
                        }
                    }
                    if (chkConfig.Checked == true)
                    {
                        int     intModel   = oForecast.GetModel(intID);
                        int     intType    = oModelsProperties.GetType(intModel);
                        string  strExecute = oType.Get(intType, "forecast_execution_path");
                        int     intCount   = 0;
                        DataSet dsWizard   = oOnDemand.GetWizardStepsDoneBack(intID);
                        foreach (DataRow drWizard in dsWizard.Tables[0].Rows)
                        {
                            intCount++;
                            if (intCount != dsWizard.Tables[0].Rows.Count)
                            {
                                oOnDemand.DeleteWizardStepDone(intID, Int32.Parse(drWizard["step"].ToString()));
                            }
                        }
                        if (chkConfig_Reset.Checked == true)
                        {
                            oForecast.UpdateAnswer(intID, "", "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                        }
                        if (chkConfig_Device.Checked == true)
                        {
                            foreach (DataRow drServer in dsServers.Tables[0].Rows)
                            {
                                int intServer  = Int32.Parse(drServer["id"].ToString());
                                int intCluster = Int32.Parse(drServer["clusterid"].ToString());
                                oCluster.Delete(intCluster, intID);
                                oServer.Delete(intServer);
                            }
                        }
                        if (chkConfig_Storage.Checked == true)
                        {
                            oStorage.DeleteLuns(intID);
                        }
                    }
                    if (chkUnlock.Checked == true)
                    {
                        if (chkUnlock_80.Checked == true)
                        {
                            if (oForecast.GetAnswer(intID, "override") == "-1")
                            {
                                // Send Email to iARB stating that they do not have to approve the design
                                string[] strEmail;
                                char[]   strSplit = { ';' };
                                strEmail = strIARB.Split(strSplit);
                                for (int ii = 0; ii < strEmail.Length; ii++)
                                {
                                    if (strEmail[ii].Trim() != "")
                                    {
                                        string strAddress     = strEmail[ii];
                                        string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_DESIGN_BUILDER");
                                        oFunction.SendEmail("Review Board Approval UNLOCKED", strAddress, "", strEMailIdsBCC, "Review Board Approval UNLOCKED", "<p><b>An overridden design has been unlocked and no longer requires your approval.</b><p><p>" + oForecast.GetAnswerBody(intID, intEnvironment, dsnAsset, dsnIP) + "</p>", true, false);
                                    }
                                }
                            }
                            oForecast.AddAnswerUnlock(intID, 0, "Reset by administrator at client's request");
                            oForecast.UpdateAnswerConfidence(intID, intConfidenceUnlock);
                        }
                        oForecast.DeleteReset(intID);
                        oForecast.AddReset(intID, intRequestExecute);
                        oForecast.UpdateAnswer(intID, 0);
                        DataSet dsPending = oOnDemandTasks.GetPending(intID);
                        if (dsPending.Tables[0].Rows.Count > 0)
                        {
                            int intResourceWorkflow = Int32.Parse(dsPending.Tables[0].Rows[0]["resourceid"].ToString());
                            int intResourceParent   = oResourceRequest.GetWorkflowParent(intResourceWorkflow);
                            int intImplementor      = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid"));
                            oResourceRequest.UpdateItemAndService(intResourceParent, -1, -1);
                            oResourceRequest.UpdateWorkflowName(intResourceWorkflow, "Auto-Provisioning Task [Reset]", 0);
                            oOnDemandTasks.DeleteAll(intID);
                            if (intImplementor > 0)
                            {
                                string strDefault     = oUser.GetApplicationUrl(intImplementor, intViewPage);
                                string strSpacerRow   = "<tr><td colspan=\"3\"><img src=\"" + oVariable.ImageURL() + "/images/spacer.gif\" border=\"0\" width=\"1\" height=\"7\" /></td></tr>";
                                string strEMailIdsBCC = oFunction.GetGetEmailAlertsEmailIds("EMAILGRP_DESIGN_BUILDER");
                                if (strDefault == "")
                                {
                                    oFunction.SendEmail("RESET: ClearView Auto-Provisioning Reset", oUser.GetName(intImplementor), "", strEMailIdsBCC, "RESET: ClearView Auto-Provisioning Reset", "<p><b>An auto-provisioning request has been reset. This request no longer requires immediate attention.</b><p><p>" + oForecast.GetAnswerBody(intID, intEnvironment, dsnAsset, dsnIP) + "</p>", true, false);
                                }
                                else
                                {
                                    oFunction.SendEmail("RESET: ClearView Auto-Provisioning Reset", oUser.GetName(intImplementor), "", strEMailIdsBCC, "RESET: ClearView Auto-Provisioning Reset", "<p><b>An auto-provisioning request has been reset. This request no longer requires immediate attention.</b><p><p>" + oForecast.GetAnswerBody(intID, intEnvironment, dsnAsset, dsnIP) + "</p><p><a href=\"" + oVariable.URL() + "/redirect.aspx?referrer=/" + strDefault + oPage.GetFullLink(intViewPage) + "?pid=" + intProject.ToString() + "\" target=\"_blank\">Click here to review this project.</a></p>", true, false);
                                }
                            }
                        }
                    }
                }

                if (strError == "")
                {
                    lblDone.Text = "<img src='/images/bigcheck.gif' border='0' align='absmiddle'/> <b>Finished!</b> ClearView reset the design";
                }
                else
                {
                    lblDone.Text = "<img src='/images/bigerror.gif' border='0' align='absmiddle'/> <b>Error!</b> " + strError;
                }
            }
            else if (dsDesign.Tables[0].Rows.Count > 0)
            {
                int intDesign = Int32.Parse(dsDesign.Tables[0].Rows[0]["id"].ToString());
                oLog.AddEvent(intDesign, "", "", "Design " + intDesign.ToString() + " reset by " + oUser.GetFullNameWithLanID(intProfile), LoggingType.Information);
                oDesign.UpdateAnswerId(intDesign, 0);
                if (chkExitAP_Approvals.Checked == true)
                {
                    oDesign.DeleteApproverFieldWorkflow(intDesign);
                    oDesign.DeleteApproverGroupWorkflow(intDesign, 0);
                    oDesign.DeleteApproverGroupWorkflow(intDesign, 1);
                    oDesign.DeleteSoftwareComponents(intDesign, true);
                    if (chkExitAP_Submissions.Checked == false)
                    {
                        // Reset back to original requestor.
                        oDesign.Approve(intDesign, 0, (oDesign.Get(intDesign, "is_exception") == "1"), intEnvironment, intImplementorDistributedService, intWorkstationPlatform, intImplementorMidrangeService, dsnAsset, dsnIP, dsnServiceEditor, intAssignPage, intResourceRequestApprove, intViewPage);
                    }
                }
                if (chkExitAP_Submissions.Checked == true)
                {
                    oDesign.DeleteSubmitted(intDesign);
                }
                lblDone.Text = "<img src='/images/bigAlert.gif' border='0' align='absmiddle'/> <b>Done!</b> ClearView reset the new design builder";
            }
            else
            {
                lblDone.Text = "<img src='/images/bigerror.gif' border='0' align='absmiddle'/> <b>Error!</b> ClearView could not find the design";
            }
        }
Beispiel #14
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);
            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();");
        }
Beispiel #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oForecast         = new Forecast(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            Pages oPage = new Pages(intProfile, dsn);

            if (Request.QueryString["done"] != null && Request.QueryString["done"] != "")
            {
                oForecast.UpdateAnswerSetComplete(Int32.Parse(Request.QueryString["done"]));
                Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Design Marked Completed Successfully\\n\\nPlease wait while the page reloads....');window.navigate('" + Request.Path + "?model=" + Request.QueryString["model"] + "&filters=" + Request.QueryString["filters"] + "');<" + "/" + "script>");
            }
            else if (Request.QueryString["model"] != null && Request.QueryString["model"] != "" && Request.QueryString["filters"] != null)
            {
                string strFilter = oFunction.decryptQueryString(Request.QueryString["filters"]);
                intModel = Int32.Parse(Request.QueryString["model"]);
                int   intType     = oModelsProperties.GetType(intModel);
                Types oType       = new Types(intProfile, dsn);
                int   intPlatform = oType.GetPlatform(intType);
                lblModel.Text = oModelsProperties.Get(intModel, "name");
                bool            boolOther        = false;
                DataSet         dsDemand         = oForecast.GetAnswersModel(intPlatform);
                DataTable       dtDemand         = dsDemand.Tables[0];
                DataRow[]       drModels         = dtDemand.Select("model = " + intModel.ToString() + strFilter);
                ResourceRequest oResourceRequest = new ResourceRequest(0, dsn);
                Users           oUser            = new Users(0, dsn);
                StringBuilder   sb             = new StringBuilder(strResults);
                OnDemandTasks   oOnDemandTasks = new OnDemandTasks(0, dsn);

                foreach (DataRow dr in drModels)
                {
                    int     intProject     = Int32.Parse(dr["projectid"].ToString());
                    int     intAnswer      = Int32.Parse(dr["id"].ToString());
                    int     intImplementor = 0;
                    DataSet dsTasks        = oOnDemandTasks.GetPending(intAnswer);
                    if (dsTasks.Tables[0].Rows.Count > 0)
                    {
                        intImplementor = Int32.Parse(dsTasks.Tables[0].Rows[0]["resourceid"].ToString());
                        intImplementor = Int32.Parse(oResourceRequest.GetWorkflow(intImplementor, "userid"));
                    }
                    else
                    {
                        intImplementor = -999;
                    }
                    string strXID = "";
                    if (intImplementor > 0 || intImplementor == -999)
                    {
                        strXID = oUser.GetFullName(intImplementor);
                    }

                    boolOther = !boolOther;
                    sb.Append("<tr");
                    sb.Append(boolOther ? " bgcolor=\"F6F6F6\"" : "");
                    sb.Append("><td><a onclick=\"return confirm('Are you sure you want to mark this design as being completed?');\" title=\"Mark as Complete\" href=\"");
                    sb.Append(Request.Path);
                    sb.Append("?model=");
                    sb.Append(intModel.ToString());
                    sb.Append("&filters=");
                    sb.Append(Request.QueryString["filters"]);
                    sb.Append("&done=");
                    sb.Append(dr["id"].ToString());
                    sb.Append("\"><img src=\"/images/check.gif\" border=\"0\" align=\"absmiddle\"/></a></td><td>");
                    sb.Append(dr["id"].ToString());
                    sb.Append("</td><td><a href=\"");
                    sb.Append(oPage.GetFullLink(intDesignBuilder));
                    sb.Append("?id=");
                    sb.Append(dr["forecastid"].ToString());
                    sb.Append("&highlight=");
                    sb.Append(dr["id"].ToString());
                    sb.Append("\" target=\"_blank\">");
                    sb.Append(dr["project_name"].ToString());
                    sb.Append("</a></td><td>");
                    sb.Append(dr["project_number"].ToString());
                    sb.Append("</td><td>");
                    sb.Append(dr["confidence"].ToString());
                    sb.Append("</td><td>");
                    sb.Append(dr["implementation"].ToString());
                    sb.Append("</td><td>");
                    sb.Append(dr["class"].ToString());
                    sb.Append("</td><td>");
                    sb.Append(dr["environment"].ToString());
                    sb.Append("</td><td>");
                    sb.Append(dr["location"].ToString());
                    sb.Append("</td><td>");
                    sb.Append(strXID);
                    sb.Append("</td><td align=\"right\">");
                    sb.Append(dr["quantity"].ToString());
                    sb.Append("</td><td align=\"right\">");
                    sb.Append(dr["recovery_number"].ToString());
                    sb.Append("</td></tr>");
                }

                strResults = sb.ToString();
            }
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage             = new Pages(intProfile, dsn);
            oFunction         = new Functions(intProfile, dsn, intEnvironment);
            oVariable         = new Variables(intEnvironment);
            oWorkstation      = new Workstations(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oRequest          = new Requests(intProfile, dsn);
            oServiceRequest   = new ServiceRequests(intProfile, dsn);
            oLocation         = new Locations(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oOperatingSystems = new OperatingSystems(intProfile, dsn);
            oVirtualHDD       = new VirtualHDD(intProfile, dsn);
            oVirtualRam       = new VirtualRam(intProfile, dsn);
            oVirtualCPU       = new VirtualCPU(intProfile, dsn);
            oClass            = new Classes(intProfile, dsn);
            oAD = new AD(intProfile, dsn, intEnvironment);

            //Menus
            int intMenuTab = 0;

            if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
            {
                intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
            }
            Tab oTab = new Tab("", intMenuTab, "divMenu1", true, false);

            oTab.AddTab("Pool Configurtion", "");
            oTab.AddTab("Workstation History", "");
            oTab.AddTab("Workstations Currently Available", "");
            oTab.AddTab("Subscribed Users", "");
            strMenuTab1 = oTab.GetTabs();

            //End Menus

            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            lblTitle.Text = oPage.Get(intPage, "title");
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                panPool.Visible = true;
                int intID = Int32.Parse(Request.QueryString["id"]);
                if (Request.QueryString["save"] != null)
                {
                    panSave.Visible = true;
                }
                DataSet ds = oWorkstation.GetPool(intID);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string strName = ds.Tables[0].Rows[0]["name"].ToString();
                    txtName.Text          = strName;
                    rptHistory.DataSource = oWorkstation.GetPoolWorkstationsStatus(strName);
                    rptHistory.DataBind();
                    lblHistory.Visible      = (rptHistory.Items.Count == 0);
                    rptAvailable.DataSource = oWorkstation.GetPoolWorkstations(strName);
                    rptAvailable.DataBind();
                    lblAvailable.Visible = (rptAvailable.Items.Count == 0);
                    DirectoryEntry oEntry = oAD.GroupSearch("GSGwra_" + strName);
                    if (oEntry != null)
                    {
                        if (oEntry.Properties.Contains("member") == true)
                        {
                            foreach (string strUser in oEntry.Properties["member"])
                            {
                                DirectoryEntry oEntry2 = new DirectoryEntry("LDAP://" + oVariable.primaryDCName(dsn) + "/" + strUser, oVariable.Domain() + "\\" + oVariable.ADUser(), oVariable.ADPassword());
                                strSubscribers += "<tr><td>" + oEntry2.Properties["displayname"].Value.ToString() + " (" + oEntry2.Properties["name"].Value.ToString() + ")</td></tr>";
                            }
                        }
                        else
                        {
                            strSubscribers += "<tr><td><img src=\"/images/bigAlert.gif\" border=\"0\" align=\"absmiddle\"/> There are no subscribers</td></tr>";
                        }
                    }
                    else
                    {
                        strSubscribers += "<tr><td><img src=\"/images/bigError.gif\" border=\"0\" align=\"absmiddle\"/> Could not find Active Directory Group <b>" + "GSGwra_" + strName + "</b></td></tr>";
                    }
                    txtDescription.Text = ds.Tables[0].Rows[0]["description"].ToString();
                    int intContact1 = 0;
                    int intContact2 = 0;
                    if (ds.Tables[0].Rows[0]["contact1"].ToString() != "")
                    {
                        intContact1 = Int32.Parse(ds.Tables[0].Rows[0]["contact1"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["contact2"].ToString() != "")
                    {
                        intContact2 = Int32.Parse(ds.Tables[0].Rows[0]["contact2"].ToString());
                    }
                    if (intContact1 > 0)
                    {
                        txtContact1.Text  = oUser.GetFullName(intContact1) + " (" + oUser.GetName(intContact1) + ")";
                        hdnContact1.Value = intContact1.ToString();
                    }
                    if (intContact2 > 0)
                    {
                        txtContact2.Text  = oUser.GetFullName(intContact2) + " (" + oUser.GetName(intContact2) + ")";
                        hdnContact2.Value = intContact2.ToString();
                    }
                    chkEnabled.Checked        = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                    lstCurrent.DataValueField = "id";
                    lstCurrent.DataTextField  = "name";
                    lstCurrent.DataSource     = oWorkstation.GetPoolWorkstations(intID);
                    lstCurrent.DataBind();
                    lstAvailable.DataValueField = "id";
                    lstAvailable.DataTextField  = "name";
                    lstAvailable.DataSource     = oWorkstation.GetPoolWorkstations(intProfile, intID);
                    lstAvailable.DataBind();
                    string strWorkstations = "";
                    int    intCount        = 0;
                    foreach (ListItem oItem in lstCurrent.Items)
                    {
                        strWorkstations = strWorkstations + oItem.Value + "_" + intCount.ToString() + "&";
                        intCount++;
                    }
                    hdnWorkstations.Value = strWorkstations;
                    txtContact1.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'250','195','" + divContact1.ClientID + "','" + lstContact1.ClientID + "','" + hdnContact1.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
                    lstContact1.Attributes.Add("ondblclick", "AJAXClickRow();");
                    txtContact2.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'250','195','" + divContact2.ClientID + "','" + lstContact2.ClientID + "','" + hdnContact2.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
                    lstContact2.Attributes.Add("ondblclick", "AJAXClickRow();");
                    btnAdd.Attributes.Add("onclick", "return MoveList('" + lstAvailable.ClientID + "','" + lstCurrent.ClientID + "','" + hdnWorkstations.ClientID + "','" + lstCurrent.ClientID + "');");
                    lstAvailable.Attributes.Add("ondblclick", "return MoveList('" + lstAvailable.ClientID + "','" + lstCurrent.ClientID + "','" + hdnWorkstations.ClientID + "','" + lstCurrent.ClientID + "');");
                    btnRemove.Attributes.Add("onclick", "return MoveList('" + lstCurrent.ClientID + "','" + lstAvailable.ClientID + "','" + hdnWorkstations.ClientID + "','" + lstCurrent.ClientID + "');");
                    lstCurrent.Attributes.Add("ondblclick", "return MoveList('" + lstCurrent.ClientID + "','" + lstAvailable.ClientID + "','" + hdnWorkstations.ClientID + "','" + lstCurrent.ClientID + "');");
                    btnUpdate.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a name')" +
                                             " && ValidateText('" + txtDescription.ClientID + "','Please enter a description')" +
                                             " && ValidateHidden0('" + hdnContact1.ClientID + "','" + txtContact1.ClientID + "','Please enter a primary contact')" +
                                             " && ValidateHidden0('" + hdnContact2.ClientID + "','" + txtContact2.ClientID + "','Please enter a secondary contact')" +
                                             ";");
                }
            }
            else if (Request.QueryString["create"] != null)
            {
                panCreate.Visible = true;
                LoadLists();
                if (Request.QueryString["qty"] != null && Request.QueryString["qty"] != "")
                {
                    if (Request.QueryString["qty"] == intMaxWorkstationsPerDay.ToString())
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nCurrently, you have requested " + Request.QueryString["qty"] + " virtual workstations and cannot be allocated additional hardware until tomorrow.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>");
                    }
                    else if (Request.QueryString["qty"] == "0")
                    {
                        int intDiff = intMaxWorkstationsPerDay - Int32.Parse(Request.QueryString["qty"]);
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nCurrently, you have requested " + Request.QueryString["qty"] + " virtual workstations. Please enter a quantity of " + intDiff.ToString() + " or less to continue.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>");
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "qty", "<script type=\"text/javascript\">alert('NOTE: You can request up to " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day.\\n\\nPlease enter a quantity of " + intMaxWorkstationsPerDay.ToString() + " or less to continue.\\n\\nIf your initiative requires more than " + intMaxWorkstationsPerDay.ToString() + " virtual workstations per day, you must use design builder.\\nPlease contact your technical lead or ClearView administrator for additional information.');<" + "/" + "script>");
                    }
                }
                int intAddress = intLocation;
                if (intAddress > 0)
                {
                    txtParent.Text = oLocation.GetFull(intAddress);
                }
                hdnParent.Value = intAddress.ToString();
                btnContinue.Attributes.Add("onclick", "return ValidateNumber0('" + txtQuantity.ClientID + "','Please enter a valid quantity')" +
                                           " && ValidateDropDown('" + ddlRam.ClientID + "','Please select a RAM')" +
                                           " && ValidateDropDown('" + ddlOS.ClientID + "','Please select an operating system')" +
                                           " && ValidateDropDown('" + ddlCPU.ClientID + "','Please select a CPU')" +
                                           " && ValidateDropDown('" + ddlHardDrive.ClientID + "','Please select a hard drive')" +
                                           ";");
            }
            else if (Request.QueryString["rid"] != null)
            {
                int intRequest = Int32.Parse(Request.QueryString["rid"]);
                panExecute.Visible = true;
                DataSet dsService = oForecast.GetAnswerService(intRequest);
                if (dsService.Tables[0].Rows.Count > 0)
                {
                    int    intAnswer  = Int32.Parse(dsService.Tables[0].Rows[0]["id"].ToString());
                    int    intType    = oModelsProperties.GetType(intModelVirtual);
                    string strExecute = oType.Get(intType, "forecast_execution_path");
                    if (strExecute != "")
                    {
                        btnExecute.Attributes.Add("onclick", "return OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');");
                    }
                    else
                    {
                        btnExecute.Attributes.Add("onclick", "alert('Execution has not been configured for asset type " + oType.Get(intType, "name") + "');return false;");
                    }
                }
                else
                {
                    btnExecute.Attributes.Add("onclick", "alert('There was a problem executing this request...please contact your ClearView administrator');return false;");
                }
            }
            else
            {
                DataSet ds = oWorkstation.GetPools(0);
                panPools.Visible    = true;
                rptPools.DataSource = ds;
                rptPools.DataBind();
                foreach (RepeaterItem ri in rptPools.Items)
                {
                    Label lblWorkstations = (Label)ri.FindControl("lblWorkstations");
                    lblWorkstations.Text = oWorkstation.GetPoolWorkstations(Int32.Parse(lblWorkstations.Text)).Tables[0].Rows.Count.ToString();
                }
                lblPools.Visible = (rptPools.Items.Count == 0);
            }
        }
Beispiel #17
0
        private void LoadRepeater(Repeater rptControl, string strViewRequest)
        {
            foreach (RepeaterItem ri in rptControl.Items)
            {
                Button btnCancel = (Button)ri.FindControl("btnCancel");
                if (btnCancel != null)
                {
                    btnCancel.Attributes.Add("onclick", "return confirm('NOTE: When you cancel a service in ClearView, the following actions will be taken...\\n\\n - Incomplete work will be stopped immediately\\n - Assigned technicians will be notified\\n\\nAre you sure you want to cancel this service?');");
                }
                LinkButton btnNumber = (LinkButton)ri.FindControl("btnNumber");
                int        intNumber = 0;
                if (btnNumber != null)
                {
                    if (btnNumber.Text != "")
                    {
                        intNumber = Int32.Parse(btnNumber.Text);
                    }
                }
                int    intService = 0;
                Button btnView    = (Button)ri.FindControl("btnView");
                intService = Int32.Parse(btnView.CommandArgument);

                Label lblDetails       = (Label)ri.FindControl("lblDetails");
                Label lblProgress      = (Label)ri.FindControl("lblProgress");
                Label lblRequestStatus = (Label)ri.FindControl("lblRequestStatus");
                if (lblRequestStatus.Text == "Submitted")
                {
                    if (btnNumber != null)
                    {
                        if (strViewRequest != "" && oService.Get(intService, "disable_customization") == "0")
                        {
                            if (intNumber > 0)
                            {
                                btnNumber.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewRequest.ToString() + "&rid=" + intRequest.ToString() + "&formid=" + intService.ToString() + "&num=" + intNumber.ToString() + "&view=true', '800', '600');");
                            }
                            else
                            {
                                btnNumber.Enabled = false;
                            }
                        }
                        else
                        {
                            btnNumber.Enabled = false;
                        }
                    }

                    if (lblProgress.Text == "")
                    {
                        lblProgress.Text = "<i>Unavailable</i>";
                        if (btnNumber != null)
                        {
                            btnNumber.Enabled = false;
                        }
                    }
                    else
                    {
                        int     intResource  = Int32.Parse(lblProgress.Text);
                        double  dblAllocated = 0.00;
                        double  dblUsed      = 0.00;
                        bool    boolAssigned = false;
                        DataSet dsResource   = oDataPoint.GetServiceRequestResource(intResource);
                        foreach (DataRow drResource in dsResource.Tables[1].Rows)
                        {
                            if (drResource["deleted"].ToString() == "0")
                            {
                                boolAssigned  = true;
                                dblAllocated += double.Parse(drResource["allocated"].ToString());
                                dblUsed      += double.Parse(drResource["used"].ToString());
                            }
                        }
                        if (boolAssigned == false)
                        {
                            Label lblOnDemand = (Label)ri.FindControl("lblOnDemand");
                            if (lblOnDemand == null || lblOnDemand.Text == "0")
                            {
                                Label lblAutomate = (Label)ri.FindControl("lblAutomate");
                                if (lblAutomate == null || lblAutomate.Text == "0")
                                {
                                    string  strManager = "<tr><td colspan=\"3\"><img src=\"/images/spacer.gif\" border=\"0\" width=\"15\" height=\"1\"/></td></tr>";
                                    DataSet dsManager  = oService.GetUser(intService, 1); // Managers
                                    foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                    {
                                        int intManager = Int32.Parse(drManager["userid"].ToString());
                                        strManager += "<tr><td><img src=\"/images/spacer.gif\" border=\"0\" width=\"15\" height=\"1\"/></td><td>-</td><td><a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('PROFILE','?userid=" + intManager.ToString() + "');\">" + oUser.GetFullName(intManager) + " [" + oUser.GetName(intManager) + "]</a></td></tr>";
                                    }
                                    lblProgress.Text = "Pending Assignment [<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"ShowHideDiv2('divAssign" + intResource.ToString() + "');\">View Service Managers</a>]<div id=\"divAssign" + intResource.ToString() + "\" style=\"display:none\"><table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">" + strManager + "</table></div>";
                                }
                                else
                                {   //For automated
                                    lblProgress.Text  = oServiceRequest.GetStatusBar(100.00, "100", "12", true);
                                    btnView.Visible   = false;
                                    btnCancel.Visible = false;
                                }
                            }
                            else
                            {
                                DataSet dsSelected = oService.GetSelected(intRequest, intService, intNumber);
                                for (int ii = intNumber; ii > 0 && dsSelected.Tables[0].Rows.Count == 0; ii--)
                                {
                                    dsSelected = oService.GetSelected(intRequest, intService, ii - 1);
                                }
                                int intApproved = 0;
                                if (dsSelected.Tables[0].Rows.Count > 0)
                                {
                                    intApproved = Int32.Parse(dsSelected.Tables[0].Rows[0]["approved"].ToString());
                                }

                                if (intApproved > 0)
                                {
                                    Forecast         oForecast         = new Forecast(intProfile, dsn);
                                    ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                                    Types            oType             = new Types(intProfile, dsn);
                                    DataSet          dsService         = oForecast.GetAnswerService(intRequest);
                                    if (dsService.Tables[0].Rows.Count > 0)
                                    {
                                        int    intAnswer  = Int32.Parse(dsService.Tables[0].Rows[0]["id"].ToString());
                                        int    intModel   = Int32.Parse(dsService.Tables[0].Rows[0]["modelid"].ToString());
                                        int    intType    = oModelsProperties.GetType(intModel);
                                        string strExecute = oType.Get(intType, "forecast_execution_path");
                                        if (strExecute != "")
                                        {
                                            lblProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" title=\"Click here to execute this service\" onclick=\"OpenWindow('FORECAST_EXECUTE','" + strExecute + "?id=" + intAnswer.ToString() + "');\">Execute</a>";
                                        }
                                        else
                                        {
                                            lblProgress.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" title=\"Click here to execute this service\" onclick=\"alert('Execution has not been configured for asset type " + oType.Get(intType, "name") + "');\">Execute</a>";
                                        }
                                    }
                                }
                                else
                                {
                                    lblProgress.Text = "<a title=\"Click here to execute this service\" disabled=\"disabled\">Execute</a>";
                                    if (intApproved < 0)
                                    {
                                        int    intDenied     = Int32.Parse(dsSelected.Tables[0].Rows[0]["approvedby"].ToString());
                                        string strApprovedOn = dsSelected.Tables[0].Rows[0]["approvedon"].ToString();
                                        string strReason     = dsSelected.Tables[0].Rows[0]["reason"].ToString();
                                        lblRequestStatus.Text = "<a href=\"javascript:void(0);\" onclick=\"alert('Denied By: " + oUser.GetFullName(intDenied) + "\\nDenied On: " + strApprovedOn + "\\nReason: " + strReason.Replace(Environment.NewLine, "\\n") + "');\">Request Denied</a>";
                                    }
                                    else
                                    {
                                        lblRequestStatus.Text = "Pending Approval";
                                    }
                                }
                            }
                        }
                        else if (dblAllocated > 0.00)
                        {
                            lblProgress.Text = oServiceRequest.GetStatusBar((dblUsed / dblAllocated) * 100.00, "100", "12", true);
                        }
                        else
                        {
                            lblProgress.Text = "<i>N / A</i>";
                        }
                        btnView.Attributes.Add("onclick", "return OpenNewWindowMenu('/datapoint/service/resource.aspx?id=" + oFunction.encryptQueryString(intResource.ToString()) + "', '800', '600');");
                        btnView.ToolTip = "ResourceID: " + intResource.ToString();
                        if (btnNumber != null)
                        {
                            lblDetails.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('SERVICES_DETAIL','?rid=" + intRequest.ToString() + "&sid=" + intService.ToString() + "');\" title=\"Click here to view the details of this service\">" + oService.Get(intService, "name") + "</a>";
                        }
                        else
                        {
                            lblDetails.Text = "<a href=\"javascript:void(0);\" class=\"lookup\" onclick=\"OpenWindow('SERVICES_DETAIL','?sid=" + intService.ToString() + "');\" title=\"Click here to view the details of this service\">" + oService.Get(intService, "name") + "</a>";
                        }
                    }
                }
                else
                {
                    btnView.Enabled = false;
                    if (btnCancel != null)
                    {
                        btnCancel.Enabled = false;
                    }
                    if (btnNumber != null)
                    {
                        if (strViewRequest != "" && oService.Get(intService, "disable_customization") == "0" && lblProgress.Text.ToUpper().Contains("AWAITING") == true)
                        {
                            if (intNumber > 0)
                            {
                                btnNumber.Attributes.Add("onclick", "return OpenNewWindowMenu('" + strViewRequest + "?rid=" + intRequest.ToString() + "&formid=" + intService.ToString() + "&num=" + intNumber.ToString() + "', '800', '600');");
                            }
                            else
                            {
                                btnNumber.Enabled = false;
                            }
                        }
                        else
                        {
                            btnNumber.Enabled = false;
                        }
                    }
                    lblProgress.Text = "---";
                }

                // Load Workflow Repeaters
                Repeater rptWorkflow = (Repeater)ri.FindControl("rptWorkflow");
                if (rptWorkflow != null)
                {
                    LoadRepeater(rptWorkflow, strViewRequest);
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
     oForecast         = new Forecast(intProfile, dsn);
     oPlatform         = new Platforms(intProfile, dsn);
     oModel            = new Models(intProfile, dsn);
     oModelsProperties = new ModelsProperties(intProfile, dsn);
     oLocation         = new Locations(intProfile, dsn);
     oClass            = new Classes(intProfile, dsn);
     if (Request.QueryString["parent"] != null && Request.QueryString["parent"] != "")
     {
         intForecast = Int32.Parse(Request.QueryString["parent"]);
     }
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intID = Int32.Parse(Request.QueryString["id"]);
     }
     if (Request.QueryString["step"] != null && Request.QueryString["step"] != "")
     {
         panUpdate.Visible = true;
     }
     else
     {
         panNavigation.Visible = true;
     }
     if (intID > 0)
     {
         DataSet ds = oForecast.GetAnswer(intID);
         if (ds.Tables[0].Rows.Count > 0)
         {
             bool boolHundred   = false;
             int  intConfidence = Int32.Parse(ds.Tables[0].Rows[0]["confidenceid"].ToString());
             if (intConfidence > 0)
             {
                 Confidence oConfidence   = new Confidence(intProfile, dsn);
                 string     strConfidence = oConfidence.Get(intConfidence, "name");
                 if (strConfidence.Contains("100%") == true)
                 {
                     boolHundred = true;
                 }
             }
             if (boolHundred == true)
             {
                 panUpdate.Visible     = false;
                 panNavigation.Visible = false;
                 btnHundred.Visible    = true;
             }
             int  intPlatform = Int32.Parse(ds.Tables[0].Rows[0]["platformid"].ToString());
             int  intStep     = Int32.Parse(ds.Tables[0].Rows[0]["step"].ToString());
             bool boolTest    = (ds.Tables[0].Rows[0]["test"].ToString() == "1");
             int  intQuantity = Int32.Parse(ds.Tables[0].Rows[0]["quantity"].ToString());
             int  intAddress  = Int32.Parse(ds.Tables[0].Rows[0]["addressid"].ToString());
             intForecast = Int32.Parse(ds.Tables[0].Rows[0]["forecastid"].ToString());
             DataSet dsSteps = oForecast.GetSteps(intPlatform, 1);
             if (dsSteps.Tables[0].Rows.Count == intStep)
             {
                 btnNext.Text = "Finish";
             }
             if (intStep == 0 || intStep == 1)
             {
                 btnBack.Enabled = false;
             }
             if (oLocation.GetAddress(intAddress, "storage") != "1")
             {
                 radNo.Checked  = true;
                 radYes.Enabled = false;
                 radYes.ToolTip = "Location " + oLocation.GetFull(intAddress) + " is not configured for storage";
             }
             else
             {
                 bool boolProduction    = oClass.IsProd(Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()));
                 bool boolQA            = oClass.IsQA(Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString()));
                 bool boolNone          = (ds.Tables[0].Rows[0]["storage"].ToString() == "-2");
                 bool boolRequired      = oForecast.IsHACluster(intID);
                 bool boolNoReplication = oForecast.IsDROver48(intID, false);
                 // Get Model
                 int intModel = oForecast.GetModel(intID);
                 if (oModelsProperties.IsStorageDE_FDriveMustBeOnSAN(intModel) == true)
                 {
                     boolRequired = true;
                 }
                 Types oType = new Types(intProfile, dsn);
                 if (oType.GetPlatform(oModelsProperties.GetType(intModel)) == intSharedPlatform)
                 {
                     boolRequired = true;
                 }
                 if (boolRequired == true)
                 {
                     radNo.Enabled = false;
                     if (boolNone == false)
                     {
                         divYes.Style["display"] = "inline";
                     }
                     radNo.ToolTip = "Storage Required for Clusters";
                 }
                 if (!IsPostBack)
                 {
                     if (boolProduction == true)
                     {
                         panOldHighProduction.Visible     = true;
                         panOldStandardProduction.Visible = true;
                         panOldLowProduction.Visible      = true;
                     }
                     if (boolQA == true)
                     {
                         panOldHighQA.Visible     = true;
                         panOldStandardQA.Visible = true;
                         panOldLowQA.Visible      = true;
                     }
                     if ((boolProduction == false && boolQA == false) || (boolProduction == true && boolTest == true))
                     {
                         panOldHighTest.Visible     = true;
                         panOldStandardTest.Visible = true;
                         panOldLowTest.Visible      = true;
                     }
                     if (boolNoReplication == false)     // If Replication = true
                     {
                         panOldStandardReplication.Visible         = true;
                         ddlOldStandardReplicated.Enabled          = false;
                         ddlOldStandardReplicated.SelectedValue    = "Yes";
                         ddlOldStandardReplicated.ToolTip          = "Under 48 Hours requires Replication";
                         divOldStandardReplicated.Style["display"] = "inline";
                     }
                     if (ds.Tables[0].Rows[0]["storage"].ToString() == "1")
                     {
                         radYes.Checked   = true;
                         ds               = oForecast.GetStorageOS(intID);
                         panReset.Visible = (ds.Tables[0].Rows.Count > 0);
                         ds               = oForecast.GetStorage(intID);
                         if (ds.Tables[0].Rows.Count > 0)
                         {
                             divYes.Style["display"] = "inline";
                             if (ds.Tables[0].Rows[0]["high"].ToString() == "1")
                             {
                                 chkOldHigh.Checked          = true;
                                 divOldHigh.Style["display"] = "inline";
                                 txtOldHighRequire.Text      = ds.Tables[0].Rows[0]["high_total"].ToString();
                                 txtOldHighRequireQA.Text    = ds.Tables[0].Rows[0]["high_qa"].ToString();
                                 txtOldHighRequireTest.Text  = ds.Tables[0].Rows[0]["high_test"].ToString();
                             }
                             if (ds.Tables[0].Rows[0]["standard"].ToString() == "1")
                             {
                                 chkOldStandard.Checked          = true;
                                 divOldStandard.Style["display"] = "inline";
                                 txtOldStandardRequire.Text      = ds.Tables[0].Rows[0]["standard_total"].ToString();
                                 txtOldStandardRequireQA.Text    = ds.Tables[0].Rows[0]["standard_qa"].ToString();
                                 txtOldStandardRequireTest.Text  = ds.Tables[0].Rows[0]["standard_test"].ToString();
                                 double dblStandardReplicated = double.Parse(ds.Tables[0].Rows[0]["standard_replicated"].ToString());
                                 if (dblStandardReplicated > 0.00)
                                 {
                                     divOldStandardReplicated.Style["display"] = "inline";
                                     txtOldStandardReplicated.Text             = dblStandardReplicated.ToString();
                                     ddlOldStandardReplicated.SelectedValue    = "Yes";
                                 }
                             }
                             if (ds.Tables[0].Rows[0]["low"].ToString() == "1")
                             {
                                 chkOldLow.Checked          = true;
                                 divOldLow.Style["display"] = "inline";
                                 txtOldLowRequire.Text      = ds.Tables[0].Rows[0]["low_total"].ToString();
                                 txtOldLowRequireQA.Text    = ds.Tables[0].Rows[0]["low_qa"].ToString();
                                 txtOldLowRequireTest.Text  = ds.Tables[0].Rows[0]["low_test"].ToString();
                             }
                         }
                     }
                     else if (ds.Tables[0].Rows[0]["storage"].ToString() == "-1")
                     {
                         radLater.Checked = true;
                     }
                     else if (boolRequired == true && boolNone == false)
                     {
                         radYes.Checked = true;
                     }
                     else
                     {
                         radNo.Checked = true;
                     }
                 }
                 chkOldHigh.Attributes.Add("onclick", "ShowHideDivCheck('" + divOldHigh.ClientID + "',this);");
                 chkOldStandard.Attributes.Add("onclick", "ShowHideDivCheck('" + divOldStandard.ClientID + "',this);");
                 ddlOldStandardReplicated.Attributes.Add("onchange", "ShowHideDivDDL('" + divOldStandardReplicated.ClientID + "',this,'Yes');");
                 chkOldLow.Attributes.Add("onclick", "ShowHideDivCheck('" + divOldLow.ClientID + "',this);");
                 btnNext.Attributes.Add("onclick", "return EnsureStorage('" + radYes.ClientID + "','" + chkOldHigh.ClientID + "','" + chkOldStandard.ClientID + "','" + chkOldLow.ClientID + "')" +
                                        " && EnsureStorageOld('" + radYes.ClientID + "','" + chkOldHigh.ClientID + "','" + txtOldHighRequire.ClientID + "','" + txtOldHighRequireQA.ClientID + "','" + txtOldHighRequireTest.ClientID + "'," + (boolProduction ? "true" : "false") + ",false,null,null)" +
                                        " && EnsureStorageOld('" + radYes.ClientID + "','" + chkOldStandard.ClientID + "','" + txtOldStandardRequire.ClientID + "','" + txtOldStandardRequireQA.ClientID + "','" + txtOldStandardRequireTest.ClientID + "'," + (boolProduction ? "true" : "false") + "," + (boolNoReplication ? "true" : "false") + ",'" + ddlOldStandardReplicated.ClientID + "','" + txtOldStandardReplicated.ClientID + "')" +
                                        " && EnsureStorageOld('" + radYes.ClientID + "','" + chkOldLow.ClientID + "','" + txtOldLowRequire.ClientID + "','" + txtOldLowRequireQA.ClientID + "','" + txtOldLowRequireTest.ClientID + "'," + (boolProduction ? "true" : "false") + ",false,null,null)" +
                                        ";");
                 btnUpdate.Attributes.Add("onclick", "return EnsureStorage('" + radYes.ClientID + "','" + chkOldHigh.ClientID + "','" + chkOldStandard.ClientID + "','" + chkOldLow.ClientID + "')" +
                                          " && EnsureStorageOld('" + radYes.ClientID + "','" + chkOldHigh.ClientID + "','" + txtOldHighRequire.ClientID + "','" + txtOldHighRequireQA.ClientID + "','" + txtOldHighRequireTest.ClientID + "'," + (boolProduction ? "true" : "false") + ",false,null,null)" +
                                          " && EnsureStorageOld('" + radYes.ClientID + "','" + chkOldStandard.ClientID + "','" + txtOldStandardRequire.ClientID + "','" + txtOldStandardRequireQA.ClientID + "','" + txtOldStandardRequireTest.ClientID + "'," + (boolProduction ? "true" : "false") + "," + (boolNoReplication ? "true" : "false") + ",'" + ddlOldStandardReplicated.ClientID + "','" + txtOldStandardReplicated.ClientID + "')" +
                                          " && EnsureStorageOld('" + radYes.ClientID + "','" + chkOldLow.ClientID + "','" + txtOldLowRequire.ClientID + "','" + txtOldLowRequireQA.ClientID + "','" + txtOldLowRequireTest.ClientID + "'," + (boolProduction ? "true" : "false") + ",false,null,null)" +
                                          ";");
                 btnReset.Attributes.Add("onclick", "return OpenWindow('RESET_STORAGE', '?id=" + intID.ToString() + "');");
             }
         }
     }
     radLater.Attributes.Add("onclick", "ShowHideDiv('" + divYes.ClientID + "','none');");
     radNo.Attributes.Add("onclick", "ShowHideDiv('" + divYes.ClientID + "','none');");
     radYes.Attributes.Add("onclick", "ShowHideDiv('" + divYes.ClientID + "','inline');");
     btnClose.Attributes.Add("onclick", "return window.close();");
 }