Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Reload();
     }
     oPlatform = new Platforms(intProfile, dsn);
     if (Request.QueryString["save"] != null && Request.QueryString["save"] != "")
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "save", "<script type=\"text/javascript\">alert('User Added Successfully');<" + "/" + "script>");
     }
     if (Request.QueryString["delete"] != null && Request.QueryString["delete"] != "")
     {
         Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "delete", "<script type=\"text/javascript\">alert('User Deleted Successfully');<" + "/" + "script>");
     }
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intID = Int32.Parse(Request.QueryString["id"]);
         if (!IsPostBack)
         {
             lblName.Text        = oPlatform.GetName(intID);
             rptItems.DataSource = oPlatform.GetUsers(intID);
             rptItems.DataBind();
             lblNone.Visible = (rptItems.Items.Count == 0);
             foreach (RepeaterItem ri in rptItems.Items)
             {
                 ((LinkButton)ri.FindControl("btnDelete")).Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
             }
         }
         btnClose.Attributes.Add("onclick", "return HidePanel();");
         btnAdd.Attributes.Add("onclick", "return EnsureHidden('" + hdnUser.ClientID + "','" + txtUser.ClientID + "','Please enter the LAN ID of the user')" +
                               ";");
         Variables oVariable = new Variables(intEnvironment);
         txtUser.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divAJAX.ClientID + "','" + lstAJAX.ClientID + "','" + hdnUser.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
         lstAJAX.Attributes.Add("ondblclick", "AJAXClickRow();");
     }
 }
Example #2
0
        private void LoadSearch(int _search)
        {
            lblTitle.Text = "Search Results";
            ds            = oAsset.GetSearch(_search);
            if (ds.Tables[0].Rows.Count > 0)
            {
                panResult.Visible = true;
                lblSearch.Text    = _search.ToString();
                string strSort = "";
                if (Request.QueryString["sort"] != null && Request.QueryString["sort"] != "")
                {
                    strSort = "&sort=" + Request.QueryString["sort"];
                }
                btnPrint.Attributes.Add("onclick", "return OpenWindow('NEW_WINDOW','/frame/print_asset_search.aspx?sid=" + _search.ToString() + strSort + "');");
                if (ds.Tables[0].Rows[0]["userid"].ToString() == intProfile.ToString())
                {
                    string strSearch = ds.Tables[0].Rows[0]["type"].ToString();
                    switch (strSearch)
                    {
                    case "1":
                        if (ds.Tables[0].Rows[0]["name"].ToString().Trim() != "")
                        {
                            lblResults.Text = "Device Name LIKE &quot;" + ds.Tables[0].Rows[0]["name"].ToString().Trim() + "&quot;";
                        }
                        if (ds.Tables[0].Rows[0]["serial"].ToString().Trim() != "")
                        {
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text = "Serial Number LIKE &quot;" + ds.Tables[0].Rows[0]["serial"].ToString().Trim() + "&quot;";
                        }
                        if (ds.Tables[0].Rows[0]["asset"].ToString().Trim() != "")
                        {
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text = "Asset Tag LIKE &quot;" + ds.Tables[0].Rows[0]["asset"].ToString().Trim() + "&quot;";
                        }
                        break;

                    case "2":
                        if (ds.Tables[0].Rows[0]["classid"].ToString().Trim() != "0")
                        {
                            lblResults.Text = "Class = &quot;" + oClasses.Get(Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString().Trim()), "name") + "&quot;";
                        }
                        if (ds.Tables[0].Rows[0]["environmentid"].ToString().Trim() != "0")
                        {
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Environment = &quot;" + oEnvironment.Get(Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString().Trim()), "name") + "&quot;";
                        }
                        break;

                    case "3":
                        string strPlatform = ds.Tables[0].Rows[0]["platformid"].ToString().Trim();
                        if (strPlatform != "" && strPlatform != "0")
                        {
                            lblResults.Text = "Platform = &quot;" + oPlatform.GetName(Int32.Parse(strPlatform)) + "&quot;";
                        }
                        string strType = ds.Tables[0].Rows[0]["typeid"].ToString().Trim();
                        if (strType != "" && strType != "0")
                        {
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Asset Type = &quot;" + oType.Get(Int32.Parse(strType), "name") + "&quot;";
                        }
                        string strModel = ds.Tables[0].Rows[0]["modelid"].ToString().Trim();
                        if (strModel != "" && strModel != "0")
                        {
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Model = &quot;" + oModel.Get(Int32.Parse(strModel), "name") + "&quot;";
                        }
                        break;

                    case "4":
                        string strDepot = ds.Tables[0].Rows[0]["depotid"].ToString().Trim();
                        if (strDepot != "" && strDepot != "0")
                        {
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Depot = &quot;" + oDepot.Get(Int32.Parse(strDepot), "name") + "&quot;";
                        }
                        break;
                    }
                    ds           = oAsset.GetSearchResults(_search);
                    lblPage.Text = "1";
                    lblSort.Text = "";
                    if (Request.QueryString["page"] != null && Request.QueryString["page"] != "")
                    {
                        lblPage.Text = Request.QueryString["page"];
                    }
                    if (Request.QueryString["sort"] != null && Request.QueryString["sort"] != "")
                    {
                        lblSort.Text = Request.QueryString["sort"];
                    }
                    lblTopPaging.Text = "";
                    LoadPaging(Int32.Parse(lblPage.Text), lblSort.Text);
                }
                else
                {
                    panDenied.Visible = true;
                }
            }
            else
            {
                panDenied.Visible = true;
            }
        }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
     oForecast        = new Forecast(intProfile, dsn);
     oServerName      = new ServerName(intProfile, dsn);
     oServer          = new Servers(intProfile, dsn);
     oPage            = new Pages(intProfile, dsn);
     oOperatingSystem = new OperatingSystems(intProfile, dsn);
     if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
     {
         intPage = Int32.Parse(Request.QueryString["pageid"]);
     }
     if (Request.QueryString["action"] != null && Request.QueryString["action"] != "")
     {
         panFinish.Visible = true;
     }
     else
     {
         if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
         {
             intApplication = Int32.Parse(Request.QueryString["applicationid"]);
         }
         if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
         {
             intApplication = Int32.Parse(Request.Cookies["application"].Value);
         }
         if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             intAnswer = Int32.Parse(Request.QueryString["id"]);
         }
         if (!IsPostBack)
         {
             if (intAnswer > 0)
             {
                 DataSet ds = oForecast.GetAnswer(intAnswer);
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     Projects         oProject          = new Projects(intProfile, dsn);
                     Requests         oRequest          = new Requests(intProfile, dsn);
                     Organizations    oOrganization     = new Organizations(intProfile, dsn);
                     Segment          oSegment          = new Segment(intProfile, dsn);
                     Platforms        oPlatform         = new Platforms(intProfile, dsn);
                     ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                     Confidence       oConfidence       = new Confidence(intProfile, dsn);
                     Classes          oClass            = new Classes(intProfile, dsn);
                     Environments     oEnvironment      = new Environments(intProfile, dsn);
                     Locations        oLocation         = new Locations(intProfile, dsn);
                     Users            oUser             = new Users(intProfile, dsn);
                     lblID.Text = intAnswer.ToString();
                     int intForecast = Int32.Parse(ds.Tables[0].Rows[0]["forecastid"].ToString());
                     int intRequest  = Int32.Parse(oForecast.Get(intForecast, "requestid"));
                     int intProject  = oRequest.GetProjectNumber(intRequest);
                     lblName.Text      = oProject.Get(intProject, "name");
                     lblNumber.Text    = oProject.Get(intProject, "number");
                     lblPortfolio.Text = oOrganization.GetName(Int32.Parse(oProject.Get(intProject, "organization")));
                     lblSegment.Text   = oSegment.GetName(Int32.Parse(oProject.Get(intProject, "segmentid")));
                     lblPlatform.Text  = oPlatform.GetName(Int32.Parse(ds.Tables[0].Rows[0]["platformid"].ToString()));
                     lblNickname.Text  = ds.Tables[0].Rows[0]["name"].ToString();
                     int intModel = Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString());
                     if (intModel == 0)
                     {
                         intModel = oForecast.GetModelAsset(intAnswer);
                     }
                     if (intModel == 0)
                     {
                         intModel = oForecast.GetModel(intAnswer);
                     }
                     lblModel.Text      = oModelsProperties.Get(intModel, "name");
                     lblCommitment.Text = DateTime.Parse(ds.Tables[0].Rows[0]["implementation"].ToString()).ToLongDateString();
                     lblQuantity.Text   = ds.Tables[0].Rows[0]["quantity"].ToString();
                     lblConfidence.Text = oConfidence.Get(Int32.Parse(ds.Tables[0].Rows[0]["confidenceid"].ToString()), "name");
                     int intClass = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString());
                     lblClass.Text = oClass.Get(intClass, "name");
                     if (oClass.IsProd(intClass))
                     {
                         panTest.Visible = true;
                         lblTest.Text    = (ds.Tables[0].Rows[0]["test"].ToString() == "1" ? "Yes" : "No");
                     }
                     lblEnvironment.Text = oEnvironment.Get(Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString()), "name");
                     lblLocation.Text    = oLocation.GetFull(Int32.Parse(ds.Tables[0].Rows[0]["addressid"].ToString()));
                     lblIP.Text          = ds.Tables[0].Rows[0]["workstation"].ToString();
                     lblDesignedBy.Text  = oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString()));
                     lblRequestor.Text   = ds.Tables[0].Rows[0]["userid"].ToString();
                     lblDesignedOn.Text  = DateTime.Parse(ds.Tables[0].Rows[0]["created"].ToString()).ToString();
                     lblUpdated.Text     = DateTime.Parse(ds.Tables[0].Rows[0]["modified"].ToString()).ToString();
                     panShow.Visible     = true;
                     btnSave.Enabled     = true;
                     // Load Components
                     rptApproval.DataSource = oServerName.GetComponentDetailUserApprovalsByUser(intProfile, intAnswer, 0);
                     rptApproval.DataBind();
                     foreach (RepeaterItem ri in rptApproval.Items)
                     {
                         int          intServer   = Int32.Parse(((Label)ri.FindControl("lblServer")).Text);
                         int          intDetail   = Int32.Parse(((Label)ri.FindControl("lblDetail")).Text);
                         RadioButton  radApprove  = (RadioButton)ri.FindControl("radApprove");
                         RadioButton  radDeny     = (RadioButton)ri.FindControl("radDeny");
                         HtmlTableRow trLicense   = (HtmlTableRow)ri.FindControl("trLicense");
                         HtmlTableRow trComments  = (HtmlTableRow)ri.FindControl("trComments");
                         TextBox      txtLicense  = (TextBox)ri.FindControl("txtLicense");
                         TextBox      txtComments = (TextBox)ri.FindControl("txtComments");
                         Label        lblOS       = (Label)ri.FindControl("lblOS");
                         int          intOS       = 0;
                         Int32.TryParse(oServer.Get(intServer, "osid"), out intOS);
                         lblOS.Text = oOperatingSystem.Get(intOS, "name");
                         radApprove.Attributes.Add("onclick", "ShowHideDiv('" + trLicense.ClientID + "','inline');ShowHideDiv('" + trComments.ClientID + "','inline');");
                         radDeny.Attributes.Add("onclick", "ShowHideDiv('" + trLicense.ClientID + "','none');ShowHideDiv('" + trComments.ClientID + "','inline');");
                         DataSet dsResult = oServerName.GetComponentDetailUserApprovals(intServer, intDetail);
                         if (dsResult.Tables[0].Rows.Count > 0)
                         {
                             // Load previous information
                             DataRow drResult = dsResult.Tables[0].Rows[0];
                             if (drResult["approved"].ToString() == "1")
                             {
                                 radApprove.Checked          = true;
                                 txtLicense.Text             = drResult["license"].ToString();
                                 trLicense.Style["display"]  = "inline";
                                 txtComments.Text            = drResult["comments"].ToString();
                                 trComments.Style["display"] = "inline";
                             }
                             if (drResult["approved"].ToString() == "0")
                             {
                                 radDeny.Checked             = true;
                                 txtComments.Text            = drResult["comments"].ToString();
                                 trComments.Style["display"] = "inline";
                             }
                         }
                     }
                 }
             }
         }
     }
 }
        private void LoadSearch(int _search)
        {
            Asset        oAsset       = new Asset(intProfile, dsnAsset);
            Classes      oClasses     = new Classes(intProfile, dsn);
            Environments oEnvironment = new Environments(intProfile, dsn);
            Platforms    oPlatform    = new Platforms(intProfile, dsn);
            Types        oType        = new Types(intProfile, dsn);
            Models       oModel       = new Models(intProfile, dsn);
            Depot        oDepot       = new Depot(intProfile, dsn);
            DataSet      ds           = oAsset.GetSearch(_search);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["userid"].ToString() == intProfile.ToString())
                {
                    string strSearch = ds.Tables[0].Rows[0]["type"].ToString();

                    switch (strSearch)
                    {
                    case "N":
                        if (ds.Tables[0].Rows[0]["name"].ToString().Trim() != "")
                        {
                            lblResults.Text = "Device Name LIKE &quot;" + ds.Tables[0].Rows[0]["name"].ToString().Trim() + "&quot;";
                        }
                        if (ds.Tables[0].Rows[0]["serial"].ToString().Trim() != "")
                        {
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text = "Serial Number LIKE &quot;" + ds.Tables[0].Rows[0]["serial"].ToString().Trim() + "&quot;";
                        }
                        if (ds.Tables[0].Rows[0]["asset"].ToString().Trim() != "")
                        {
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text = "Asset Tag LIKE &quot;" + ds.Tables[0].Rows[0]["asset"].ToString().Trim() + "&quot;";
                        }
                        break;

                    case "C":
                        if (ds.Tables[0].Rows[0]["classid"].ToString().Trim() != "0")
                        {
                            lblResults.Text = "Class = &quot;" + oClasses.Get(Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString().Trim()), "name") + "&quot;";
                        }
                        if (ds.Tables[0].Rows[0]["environmentid"].ToString().Trim() != "0")
                        {
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Environment = &quot;" + oEnvironment.Get(Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString().Trim()), "name") + "&quot;";
                        }
                        break;

                    case "T":
                        string strPlatform = ds.Tables[0].Rows[0]["platformid"].ToString().Trim();
                        if (strPlatform != "" && strPlatform != "0")
                        {
                            lblResults.Text = "Platform = &quot;" + oPlatform.GetName(Int32.Parse(strPlatform)) + "&quot;";
                        }
                        string strType = ds.Tables[0].Rows[0]["typeid"].ToString().Trim();
                        if (strType != "" && strType != "0")
                        {
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Asset Type = &quot;" + oType.Get(Int32.Parse(strType), "name") + "&quot;";
                        }
                        string strModel = ds.Tables[0].Rows[0]["modelid"].ToString().Trim();
                        if (strModel != "" && strModel != "0")
                        {
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Model = &quot;" + oModel.Get(Int32.Parse(strModel), "name") + "&quot;";
                        }
                        break;

                    case "D":
                        string strDepot = ds.Tables[0].Rows[0]["depotid"].ToString().Trim();
                        if (strDepot != "" && strDepot != "0")
                        {
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Depot = &quot;" + oDepot.Get(Int32.Parse(strDepot), "name") + "&quot;";
                        }
                        break;
                    }
                    ds = oAsset.GetSearchResults(_search);
                    DataView dv = ds.Tables[0].DefaultView;
                    if (Request.QueryString["sort"] != null)
                    {
                        dv.Sort = Request.QueryString["sort"];
                    }
                    rptView.DataSource = dv;
                    rptView.DataBind();
                    lblNone.Visible = (rptView.Items.Count == 0);
                }
            }
        }
Example #5
0
        private void Load()
        {
            DataSet ds = oPlatform.GetForecasts(1);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                TreeNode oNode = new TreeNode();
                oNode.Text         = dr["name"].ToString();
                oNode.ToolTip      = dr["name"].ToString();
                oNode.ImageUrl     = "/images/folder.gif";
                oNode.SelectAction = TreeNodeSelectAction.Expand;
                oTreeview.Nodes.Add(oNode);
                Load(Int32.Parse(dr["platformid"].ToString()), oNode);
                TreeNode oNew = new TreeNode();
                oNew.Text        = "&nbsp;Add Step";
                oNew.ToolTip     = "Add Step";
                oNew.ImageUrl    = "/images/green_right.gif";
                oNew.NavigateUrl = "javascript:Add('" + dr["platformid"].ToString() + "','" + oPlatform.GetName(Int32.Parse(dr["platformid"].ToString())) + "');";
                oNode.ChildNodes.Add(oNew);
            }
        }
Example #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
     oForecast  = new Forecast(intProfile, dsn);
     oPage      = new Pages(intProfile, dsn);
     if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
     {
         intPage = Int32.Parse(Request.QueryString["pageid"]);
     }
     if (Request.QueryString["action"] != null && Request.QueryString["action"] != "")
     {
         panFinish.Visible = true;
     }
     else
     {
         if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
         {
             intApplication = Int32.Parse(Request.QueryString["applicationid"]);
         }
         if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
         {
             intApplication = Int32.Parse(Request.Cookies["application"].Value);
         }
         if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             intAnswer = Int32.Parse(Request.QueryString["id"]);
         }
         if (!IsPostBack)
         {
             if (intAnswer > 0)
             {
                 DataSet ds = oForecast.GetAnswer(intAnswer);
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     Projects         oProject          = new Projects(intProfile, dsn);
                     Requests         oRequest          = new Requests(intProfile, dsn);
                     Organizations    oOrganization     = new Organizations(intProfile, dsn);
                     Segment          oSegment          = new Segment(intProfile, dsn);
                     Platforms        oPlatform         = new Platforms(intProfile, dsn);
                     ModelsProperties oModelsProperties = new ModelsProperties(intProfile, dsn);
                     Confidence       oConfidence       = new Confidence(intProfile, dsn);
                     Classes          oClass            = new Classes(intProfile, dsn);
                     Environments     oEnvironment      = new Environments(intProfile, dsn);
                     Locations        oLocation         = new Locations(intProfile, dsn);
                     Users            oUser             = new Users(intProfile, dsn);
                     lblID.Text = intAnswer.ToString();
                     int intForecast = Int32.Parse(ds.Tables[0].Rows[0]["forecastid"].ToString());
                     int intRequest  = Int32.Parse(oForecast.Get(intForecast, "requestid"));
                     int intProject  = oRequest.GetProjectNumber(intRequest);
                     lblName.Text       = oProject.Get(intProject, "name");
                     lblNumber.Text     = oProject.Get(intProject, "number");
                     lblPortfolio.Text  = oOrganization.GetName(Int32.Parse(oProject.Get(intProject, "organization")));
                     lblSegment.Text    = oSegment.GetName(Int32.Parse(oProject.Get(intProject, "segmentid")));
                     lblPlatform.Text   = oPlatform.GetName(Int32.Parse(ds.Tables[0].Rows[0]["platformid"].ToString()));
                     lblNickname.Text   = ds.Tables[0].Rows[0]["name"].ToString();
                     lblModel.Text      = oModelsProperties.Get(Int32.Parse(ds.Tables[0].Rows[0]["modelid"].ToString()), "name");
                     lblCommitment.Text = DateTime.Parse(ds.Tables[0].Rows[0]["implementation"].ToString()).ToLongDateString();
                     lblQuantity.Text   = ds.Tables[0].Rows[0]["quantity"].ToString();
                     lblConfidence.Text = oConfidence.Get(Int32.Parse(ds.Tables[0].Rows[0]["confidenceid"].ToString()), "name");
                     int intClass = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString());
                     lblClass.Text = oClass.Get(intClass, "name");
                     if (oClass.IsProd(intClass))
                     {
                         panTest.Visible = true;
                         lblTest.Text    = (ds.Tables[0].Rows[0]["test"].ToString() == "1" ? "Yes" : "No");
                     }
                     lblEnvironment.Text = oEnvironment.Get(Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString()), "name");
                     lblLocation.Text    = oLocation.GetFull(Int32.Parse(ds.Tables[0].Rows[0]["addressid"].ToString()));
                     lblIP.Text          = ds.Tables[0].Rows[0]["workstation"].ToString();
                     lblDesignedBy.Text  = oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString()));
                     lblDesignedOn.Text  = DateTime.Parse(ds.Tables[0].Rows[0]["created"].ToString()).ToString();
                     lblUpdated.Text     = DateTime.Parse(ds.Tables[0].Rows[0]["modified"].ToString()).ToString();
                     panShow.Visible     = true;
                     btnApprove.Enabled  = true;
                     btnDeny.Enabled     = true;
                 }
             }
         }
     }
     btnApprove.Attributes.Add("onclick", "return confirm('Are you sure you want to APPROVE this request?');");
     btnDeny.Attributes.Add("onclick", "return ValidateText('" + txtComments.ClientID + "','Please enter a reason for the rejection of this request') && confirm('Are you sure you want to DENY this request?');");
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                StringBuilder sb = new StringBuilder(strQuestions);
                oForecast         = new Forecast(intProfile, dsn);
                oUser             = new Users(intProfile, dsn);
                oProject          = new Projects(intProfile, dsn);
                oProjectPending   = new ProjectsPending(intProfile, dsn, intEnvironment);
                oRequest          = new Requests(intProfile, dsn);
                oOrganization     = new Organizations(intProfile, dsn);
                oStatusLevel      = new StatusLevels();
                oPlatform         = new Platforms(intProfile, dsn);
                oModel            = new Models(intProfile, dsn);
                oModelsProperties = new ModelsProperties(intProfile, dsn);
                int intForecast = Int32.Parse(Request.QueryString["id"]);
                if (!IsPostBack)
                {
                    Document doc = new Document();
                    iTextSharp.text.Table oTable = new iTextSharp.text.Table(2);
                    oTable.BorderWidth = 0;
                    oTable.BorderColor = new iTextSharp.text.Color(255, 255, 255);
                    oTable.Padding     = 2;
                    oTable.Width       = 100;
                    iTextSharp.text.Font oFontHeader = new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 10, 1);
                    iTextSharp.text.Font oFontBold   = new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 8, 1);
                    iTextSharp.text.Font oFont       = new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 8, 0);
                    if (Request.QueryString["export"] != null)
                    {
                        PdfWriter.GetInstance(doc, Response.OutputStream);
                        string       strHeader = "ClearView Design Summary";
                        HeaderFooter header    = new HeaderFooter(new Phrase(strHeader, new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 6)), false);
                        header.Border    = iTextSharp.text.Rectangle.NO_BORDER;
                        header.Alignment = 2;
                        doc.Header       = header;
                        string       strFooter = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
                        HeaderFooter footer    = new HeaderFooter(new Phrase(strFooter, new iTextSharp.text.Font(iTextSharp.text.Font.HELVETICA, 6)), false);
                        footer.Border    = iTextSharp.text.Rectangle.NO_BORDER;
                        footer.Alignment = 2;
                        doc.Footer       = footer;
                        doc.Open();
                        //iTextSharp.text.Image gif = iTextSharp.text.Image.GetInstance(Request.MapPath("~/images/nc_logo.gif"));
                        //gif.Alignment = iTextSharp.text.Image.RIGHT_ALIGN;
                        //gif.ScalePercent(50f); // change it's size
                        //doc.Add(gif);
                        Cell cell = new Cell(new Phrase("General Information", oFontHeader));
                        cell.Colspan         = 2;
                        cell.BackgroundColor = new iTextSharp.text.Color(204, 204, 204);
                        oTable.AddCell(cell);
                    }
                    DataSet ds         = oForecast.Get(intForecast);
                    int     intRequest = 0;
                    sb.Append("<table width=\"100%\" cellpadding=\"4\" cellspacing=\"3\" border=\"0\">");
                    sb.Append("<tr><td colspan=\"2\" class=\"header\">General Information</td></tr>");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        oTable.AddCell(new Cell(new Phrase("Requestor:", oFontBold)));
                        oTable.AddCell(new Cell(new Phrase(oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString())), oFont)));
                        sb.Append("<tr><td nowrap>Requestor:</td><td width=\"100%\">");
                        sb.Append(oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString())));
                        sb.Append("</td></tr>");
                        oTable.AddCell(new Cell(new Phrase("Submission Date:", oFontBold)));
                        oTable.AddCell(new Cell(new Phrase(DateTime.Parse(ds.Tables[0].Rows[0]["created"].ToString()).ToLongDateString(), oFont)));
                        sb.Append("<tr><td nowrap>Submission Date:</td><td width=\"100%\">");
                        sb.Append(DateTime.Parse(ds.Tables[0].Rows[0]["created"].ToString()).ToLongDateString());
                        sb.Append("</td></tr>");
                        intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                    }
                    int intManager  = 0;
                    int intEngineer = 0;
                    int intLead     = 0;
                    int intProject  = oRequest.GetProjectNumber(intRequest);
                    if (intProject > 0)
                    {
                        DataSet dsProject = oProject.Get(intProject);
                        if (dsProject.Tables[0].Rows.Count > 0)
                        {
                            oTable.AddCell(new Cell(new Phrase("Project Name:", oFontBold)));
                            oTable.AddCell(new Cell(new Phrase(dsProject.Tables[0].Rows[0]["name"].ToString(), oFont)));
                            oTable.AddCell(new Cell(new Phrase("Initiative Type:", oFontBold)));
                            oTable.AddCell(new Cell(new Phrase(dsProject.Tables[0].Rows[0]["bd"].ToString(), oFont)));
                            oTable.AddCell(new Cell(new Phrase("Organization:", oFontBold)));
                            oTable.AddCell(new Cell(new Phrase(oOrganization.GetName(Int32.Parse(dsProject.Tables[0].Rows[0]["organization"].ToString())), oFont)));
                            oTable.AddCell(new Cell(new Phrase("Project Number:", oFontBold)));
                            oTable.AddCell(new Cell(new Phrase(dsProject.Tables[0].Rows[0]["number"].ToString(), oFont)));
                            oTable.AddCell(new Cell(new Phrase("Project Status:", oFontBold)));
                            oTable.AddCell(new Cell(new Phrase(oStatusLevel.Name(Int32.Parse(dsProject.Tables[0].Rows[0]["status"].ToString())), oFont)));
                            sb.Append("<tr><td nowrap>Project Name:</td><td width=\"100%\">");
                            sb.Append(dsProject.Tables[0].Rows[0]["name"].ToString());
                            sb.Append("</td></tr>");
                            sb.Append("<tr><td nowrap>Initiative Type:</td><td width=\"100%\">");
                            sb.Append(dsProject.Tables[0].Rows[0]["bd"].ToString());
                            sb.Append("</td></tr>");
                            sb.Append("<tr><td nowrap>Organization:</td><td width=\"100%\">");
                            sb.Append(oOrganization.GetName(Int32.Parse(dsProject.Tables[0].Rows[0]["organization"].ToString())));
                            sb.Append("</td></tr>");
                            sb.Append("<tr><td nowrap>Project Number:</td><td width=\"100%\">");
                            sb.Append(dsProject.Tables[0].Rows[0]["number"].ToString());
                            sb.Append("</td></tr>");
                            sb.Append("<tr><td nowrap>Project Status:</td><td width=\"100%\">");
                            sb.Append(oStatusLevel.HTML(Int32.Parse(dsProject.Tables[0].Rows[0]["status"].ToString())));
                            sb.Append("</td></tr>");
                            intManager  = Int32.Parse(dsProject.Tables[0].Rows[0]["lead"].ToString());
                            intEngineer = Int32.Parse(dsProject.Tables[0].Rows[0]["engineer"].ToString());
                            intLead     = Int32.Parse(dsProject.Tables[0].Rows[0]["technical"].ToString());
                        }
                    }
                    else
                    {
                        DataSet dsPending = oProjectPending.GetRequest(intRequest);
                        if (dsPending.Tables[0].Rows.Count > 0)
                        {
                            oTable.AddCell(new Cell(new Phrase("Project Name:", oFontBold)));
                            oTable.AddCell(new Cell(new Phrase(dsPending.Tables[0].Rows[0]["name"].ToString(), oFont)));
                            oTable.AddCell(new Cell(new Phrase("Initiative Type:", oFontBold)));
                            oTable.AddCell(new Cell(new Phrase(dsPending.Tables[0].Rows[0]["bd"].ToString(), oFont)));
                            oTable.AddCell(new Cell(new Phrase("Organization:", oFontBold)));
                            oTable.AddCell(new Cell(new Phrase(oOrganization.GetName(Int32.Parse(dsPending.Tables[0].Rows[0]["organization"].ToString())), oFont)));
                            oTable.AddCell(new Cell(new Phrase("Project Number:", oFontBold)));
                            oTable.AddCell(new Cell(new Phrase(dsPending.Tables[0].Rows[0]["number"].ToString(), oFont)));
                            oTable.AddCell(new Cell(new Phrase("Project Status:", oFontBold)));
                            oTable.AddCell(new Cell(new Phrase("PENDING", oFont)));
                            sb.Append("<tr><td nowrap>Project Name:</td><td width=\"100%\">");
                            sb.Append(dsPending.Tables[0].Rows[0]["name"].ToString());
                            sb.Append("</td></tr>");
                            sb.Append("<tr><td nowrap>Initiative Type:</td><td width=\"100%\">");
                            sb.Append(dsPending.Tables[0].Rows[0]["bd"].ToString());
                            sb.Append("</td></tr>");
                            sb.Append("<tr><td nowrap>Organization:</td><td width=\"100%\">");
                            sb.Append(oOrganization.GetName(Int32.Parse(dsPending.Tables[0].Rows[0]["organization"].ToString())));
                            sb.Append("</td></tr>");
                            sb.Append("<tr><td nowrap>Project Number:</td><td width=\"100%\">");
                            sb.Append(dsPending.Tables[0].Rows[0]["number"].ToString());
                            sb.Append("</td></tr>");
                            sb.Append("<tr><td nowrap>Project Status:</td><td width=\"100%\" class=\"pending\">PENDING</td></tr>");
                            intManager  = Int32.Parse(dsPending.Tables[0].Rows[0]["lead"].ToString());
                            intEngineer = Int32.Parse(dsPending.Tables[0].Rows[0]["engineer"].ToString());
                            intLead     = Int32.Parse(dsPending.Tables[0].Rows[0]["technical"].ToString());
                        }
                    }
                    if (intManager > 0)
                    {
                        sb.Append("<tr><td nowrap>Project Manager:</td><td width=\"100%\">");
                        sb.Append(oUser.GetFullName(intManager));
                        sb.Append("</td></tr>");
                    }
                    else
                    {
                        sb.Append("<tr><td nowrap>Project Manager:</td><td width=\"100%\"></td></tr>");
                    }
                    if (intEngineer > 0)
                    {
                        sb.Append("<tr><td nowrap>Integration Engineer:</td><td width=\"100%\">");
                        sb.Append(oUser.GetFullName(intEngineer));
                        sb.Append("</td></tr>");
                    }
                    else
                    {
                        sb.Append("<tr><td nowrap>Integration Engineer:</td><td width=\"100%\"></td></tr>");
                    }
                    if (intLead > 0)
                    {
                        sb.Append("<tr><td nowrap>Technical Lead:</td><td width=\"100%\">");
                        sb.Append(oUser.GetFullName(intLead));
                        sb.Append("</td></tr>");
                    }
                    else
                    {
                        sb.Append("<tr><td nowrap>Technical Lead:</td><td width=\"100%\"></td></tr>");
                    }

                    oTable.AddCell(new Cell(new Phrase("Project Manager:", oFontBold)));
                    oTable.AddCell(new Cell(new Phrase(oUser.GetFullName(intManager), oFont)));
                    oTable.AddCell(new Cell(new Phrase("Integration Engineer:", oFontBold)));
                    oTable.AddCell(new Cell(new Phrase(oUser.GetFullName(intEngineer), oFont)));
                    oTable.AddCell(new Cell(new Phrase("Technical Lead:", oFontBold)));
                    oTable.AddCell(new Cell(new Phrase(oUser.GetFullName(intLead), oFont)));
                    oTable.AddCell(new Cell(new Phrase(" ", oFontBold)));
                    oTable.AddCell(new Cell(new Phrase(" ", oFont)));
                    Cell cell2 = new Cell(new Phrase("Line Items", oFontHeader));
                    cell2.Colspan         = 2;
                    cell2.BackgroundColor = new iTextSharp.text.Color(204, 204, 204);
                    oTable.AddCell(cell2);
                    sb.Append("<tr><td colspan=\"2\"><hr size=\"1\" noshade /></td></tr>");
                    sb.Append("<tr><td colspan=\"2\" class=\"header\">Line Items</td></tr>");
                    sb.Append("<tr><td colspan=\"2\">");
                    ds = oForecast.GetAnswers(intForecast);
                    bool boolChange = false;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        int    intID          = Int32.Parse(dr["id"].ToString());
                        int    intPlatform    = Int32.Parse(dr["platformid"].ToString());
                        int    intClass       = Int32.Parse(dr["classid"].ToString());
                        int    intEnvir       = Int32.Parse(dr["environmentid"].ToString());
                        double dblQuantity    = double.Parse(dr["quantity"].ToString()) + double.Parse(dr["recovery_number"].ToString());
                        int    intModel       = 0;
                        int    intServerModel = oForecast.GetModelAsset(intID);
                        if (intServerModel == 0)
                        {
                            intServerModel = oForecast.GetModel(intID);
                        }
                        if (intServerModel == 0)
                        {
                            // Get the model selected in the equipment dropdown (if not server)
                            intModel = Int32.Parse(dr["modelid"].ToString());
                        }
                        double dblAmp       = 0.00;
                        double dblReplicate = 0.00;
                        string strModel     = "";
                        if (intServerModel > 0)
                        {
                            dblAmp = (double.Parse(oModelsProperties.Get(intServerModel, "amp")) * dblQuantity);
                            double.TryParse(oModelsProperties.Get(intServerModel, "replicate_times"), out dblReplicate);
                            if (intModel == 0)
                            {
                                intModel = Int32.Parse(oModelsProperties.Get(intServerModel, "modelid"));
                            }
                            strModel = oModelsProperties.Get(intServerModel, "name");
                        }
                        else if (intModel > 0)
                        {
                            strModel = oModel.Get(intModel, "name");
                        }
                        else
                        {
                            DataSet dsVendor = oForecast.GetAnswer(intID);
                            if (dsVendor.Tables[0].Rows.Count > 0 && dsVendor.Tables[0].Rows[0]["modelname"].ToString() != "")
                            {
                                dblAmp   = (double.Parse(dsVendor.Tables[0].Rows[0]["amp"].ToString()) * dblQuantity);
                                strModel = dsVendor.Tables[0].Rows[0]["modelname"].ToString();
                            }
                        }
                        if (intModel == 0)
                        {
                            strModel = "Solution Unavailable";
                        }
                        // STORAGE
                        DataSet dsStorage  = oForecast.GetStorage(intID);
                        double  dblStorage = 0.00;
                        if (dsStorage.Tables[0].Rows.Count > 0)
                        {
                            double dblHigh     = double.Parse(dsStorage.Tables[0].Rows[0]["high_total"].ToString()) + double.Parse(dsStorage.Tables[0].Rows[0]["high_qa"].ToString()) + double.Parse(dsStorage.Tables[0].Rows[0]["high_test"].ToString()) + (double.Parse(dsStorage.Tables[0].Rows[0]["high_replicated"].ToString()) * dblReplicate) + double.Parse(dsStorage.Tables[0].Rows[0]["high_ha"].ToString());
                            double dblStandard = double.Parse(dsStorage.Tables[0].Rows[0]["standard_total"].ToString()) + double.Parse(dsStorage.Tables[0].Rows[0]["standard_qa"].ToString()) + double.Parse(dsStorage.Tables[0].Rows[0]["standard_test"].ToString()) + (double.Parse(dsStorage.Tables[0].Rows[0]["standard_replicated"].ToString()) * dblReplicate) + double.Parse(dsStorage.Tables[0].Rows[0]["standard_ha"].ToString());
                            double dblLow      = double.Parse(dsStorage.Tables[0].Rows[0]["low_total"].ToString()) + double.Parse(dsStorage.Tables[0].Rows[0]["low_qa"].ToString()) + double.Parse(dsStorage.Tables[0].Rows[0]["low_test"].ToString()) + (double.Parse(dsStorage.Tables[0].Rows[0]["low_replicated"].ToString()) * dblReplicate) + double.Parse(dsStorage.Tables[0].Rows[0]["low_ha"].ToString());
                            dblStorage = dblHigh + dblStandard + dblLow;
                        }
                        sb.Append("<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"background-color:");
                        sb.Append(boolChange ? "#FFFFFF" : "#F6F6F6");
                        sb.Append("\">");
                        sb.Append("<tr><td>");
                        sb.Append("<table width=\"100%\" cellpadding=\"5\" cellspacing=\"2\" border=\"0\">");
                        sb.Append("<tr><td valign=\"top\" nowrap>Nickname:</td><td>");
                        sb.Append(dr["name"].ToString());
                        sb.Append("</td></tr>");
                        sb.Append("<tr><td valign=\"top\" nowrap>Platform:</td><td>");
                        sb.Append(oPlatform.GetName(intPlatform));
                        sb.Append("</td></tr>");
                        oTable.AddCell(new Cell(new Phrase("Nickname:", oFontBold)));
                        oTable.AddCell(new Cell(new Phrase(dr["name"].ToString(), oFont)));
                        oTable.AddCell(new Cell(new Phrase("Platform:", oFontBold)));
                        oTable.AddCell(new Cell(new Phrase(oPlatform.GetName(intPlatform), oFont)));
                        oTable.AddCell(new Cell(new Phrase("Model:", oFontBold)));
                        oTable.AddCell(new Cell(new Phrase(strModel, oFont)));
                        oTable.AddCell(new Cell(new Phrase("Commitment Date:", oFontBold)));
                        oTable.AddCell(new Cell(new Phrase((dr["implementation"].ToString() == "" ? "" : DateTime.Parse(dr["implementation"].ToString()).ToShortDateString()), oFont)));
                        oTable.AddCell(new Cell(new Phrase("Quantity:", oFontBold)));
                        oTable.AddCell(new Cell(new Phrase(dblQuantity.ToString(), oFont)));
                        string strPDF = oModel.Get(intModel, "pdf");
                        sb.Append("<tr><td valign=\"top\" nowrap>Model:</td><td width=\"100%\">");
                        sb.Append(strPDF == "" ? strModel : "<a href=\"javascript:void(0);\" onclick=\"OpenNewWindowMAX('" + strPDF.Replace("\\", "\\\\") + "');\">" + strModel + "</a>");
                        sb.Append("</td></tr>");
                        sb.Append("<tr><td valign=\"top\" nowrap>Commitment Date:</td><td width=\"100%\">");
                        sb.Append(dr["implementation"].ToString() == "" ? "" : DateTime.Parse(dr["implementation"].ToString()).ToShortDateString());
                        sb.Append("</td></tr>");
                        sb.Append("<tr><td valign=\"top\" nowrap>Quantity:</td><td width=\"100%\"><a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/frame/forecast/forecast_print_quantity.aspx?id=");
                        sb.Append(intID.ToString());
                        sb.Append("',275,200);\">");
                        sb.Append(dblQuantity.ToString());
                        sb.Append("</a></td></tr>");
                        double  dblA = 0.00;
                        DataSet dsA  = oForecast.GetAcquisitions(intModel, 1);
                        foreach (DataRow drA in dsA.Tables[0].Rows)
                        {
                            dblA += double.Parse(drA["cost"].ToString());
                        }
                        sb.Append("<tr><td valign=\"top\" nowrap>Acquisition Costs:</td><td width=\"100%\"><a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/frame/forecast/forecast_print_acquisition.aspx?id=");
                        sb.Append(intID.ToString());
                        sb.Append("',400,300);\">$");
                        sb.Append(dblA.ToString("N"));
                        sb.Append("</a></td></tr>");
                        oTable.AddCell(new Cell(new Phrase("Acquisition Costs:", oFontBold)));
                        oTable.AddCell(new Cell(new Phrase(dblA.ToString("N"), oFont)));
                        double  dblO = 0.00;
                        DataSet dsO  = oForecast.GetOperations(intModel, 1);
                        foreach (DataRow drO in dsO.Tables[0].Rows)
                        {
                            dblO += double.Parse(drO["cost"].ToString());
                        }
                        oTable.AddCell(new Cell(new Phrase("Operational Costs:", oFontBold)));
                        oTable.AddCell(new Cell(new Phrase(dblO.ToString("N"), oFont)));
                        oTable.AddCell(new Cell(new Phrase("Storage:", oFontBold)));
                        oTable.AddCell(new Cell(new Phrase(dblStorage.ToString("N") + " GB", oFont)));
                        oTable.AddCell(new Cell(new Phrase("AMPs:", oFontBold)));
                        oTable.AddCell(new Cell(new Phrase(dblAmp.ToString("N") + " AMPs", oFont)));
                        sb.Append("<tr><td valign=\"top\" nowrap>Operational Costs:</td><td width=\"100%\"><a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/frame/forecast/forecast_print_operational.aspx?id=");
                        sb.Append(intID.ToString());
                        sb.Append("',400,300);\">$");
                        sb.Append(dblO.ToString("N"));
                        sb.Append("</a></td></tr>");
                        sb.Append("<tr><td valign=\"top\" nowrap>Storage:</td><td width=\"100%\"><a href=\"javascript:void(0);\" onclick=\"OpenNewWindow('/frame/forecast/forecast_print_storage.aspx?id=");
                        sb.Append(intID.ToString());
                        sb.Append("',650,200);\">");
                        sb.Append(dblStorage.ToString("N"));
                        sb.Append(" GB</a></td></tr>");
                        sb.Append("<tr><td valign=\"top\" nowrap>AMPs:</td><td width=\"100%\">");
                        sb.Append(dblAmp.ToString("N"));
                        sb.Append("</td></tr>");
                        if (Request.QueryString["checked"] != null)
                        {
                            sb.Append("<tr><td valign=\"top\" colspan=\"2\"><b>Questions & Responses</b></td></tr>");
                            DataSet dsQuestions = oForecast.GetQuestionPlatform(intPlatform, intClass, intEnvir);
                            foreach (DataRow drQuestion in dsQuestions.Tables[0].Rows)
                            {
                                string  strResponse    = "";
                                string  strResponsePDF = "";
                                int     intQuestion    = Int32.Parse(drQuestion["id"].ToString());
                                DataSet dsAnswers      = oForecast.GetAnswerPlatform(intID, intQuestion);
                                foreach (DataRow drAnswer in dsAnswers.Tables[0].Rows)
                                {
                                    strResponse += "<tr><td valign=\"top\"></td><td> " + oForecast.GetResponse(Int32.Parse(drAnswer["responseid"].ToString()), "response") + "</td></tr>";
                                    if (strResponsePDF != "")
                                    {
                                        strResponsePDF += ", ";
                                    }
                                    strResponsePDF += oForecast.GetResponse(Int32.Parse(drAnswer["responseid"].ToString()), "response");
                                }
                                if (strResponse != "")
                                {
                                    sb.Append("<tr><td valign=\"top\" colspan=\"2\"><table cellpadding=\"1\" cellspacing=\"1\" border=\"0\">");
                                    sb.Append("<tr><td valign=\"top\"><img src=\"/images/help.gif\" align=\"absmiddle\" border=\"0\"/></td><td>");
                                    sb.Append(drQuestion["question"].ToString());
                                    sb.Append("</td></tr>");
                                    Cell oCellQ = new Cell(new Phrase(drQuestion["question"].ToString(), oFontBold));
                                    oCellQ.Colspan = 2;
                                    oTable.AddCell(oCellQ);
                                    Cell oCellA = new Cell(new Phrase(strResponsePDF, oFont));
                                    oCellA.Colspan = 2;
                                    oTable.AddCell(oCellA);
                                    sb.Append(strResponse);
                                    sb.Append("</table></td></tr>");
                                }
                            }
                        }
                        sb.Append("</table></td></tr>");
                        Cell oCellD = new Cell(new Phrase("", oFont));
                        oCellD.Colspan         = 2;
                        oCellD.BackgroundColor = new iTextSharp.text.Color(100, 100, 100);
                        oTable.AddCell(oCellD);
                        sb.Append("<tr height=\"1\"><td colspan=\"2\" style=\"border-bottom:dashed 1px #CCCCCC\"><img src=\"/images/spacer.gif\" border=\"0\" width=\"1\" height=\"1\" /></td></tr>");
                        sb.Append("</table>");
                        boolChange = !boolChange;
                    }
                    sb.Append("</td></tr>");
                    chkQuestions.Checked = (Request.QueryString["checked"] != null);
                    chkQuestions.Attributes.Add("onclick", "WaitDDL('" + divWait.ClientID + "');");
                    if (Request.QueryString["export"] != null)
                    {
                        doc.Add(oTable);
                        doc.Close();
                        Response.ContentType = "application/pdf";
                        Response.AddHeader("Content-Disposition", "attachment; filename=export.pdf");
                        Response.End();
                        Response.Flush();
                    }
                }

                strQuestions = sb.ToString();
            }
        }
Example #8
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);
            oLocation    = new Locations(intProfile, dsn);
            oClass       = new Classes(intProfile, dsn);
            oEnvironment = new Environments(intProfile, dsn);
            oServerName  = new ServerName(intProfile, dsn);
            oDataPoint   = new DataPoint(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 (!IsPostBack)
            {
                LoadLists();
            }
            int  intAddress       = 0;
            int  intRecovery      = 0;
            bool boolRecoveryMany = false;

            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;
                    }
                    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;
                    }
                    boolRecoveryMany = (oForecast.IsDRUnder48(intID, false) && oForecast.IsDRManyToOne(intID));
                    if (!IsPostBack)
                    {
                        lblPlatform.Text    = oPlatform.GetName(intPlatform);
                        lblPlatform.Visible = true;
                        int intClass = Int32.Parse(ds.Tables[0].Rows[0]["classid"].ToString());
                        if (ds.Tables[0].Rows[0]["override"].ToString() == "1" || ds.Tables[0].Rows[0]["override"].ToString() == "-1")
                        {
                            radYes.Checked = true;
                            divOverride.Style["display"] = "inline";
                            if (ds.Tables[0].Rows[0]["breakfix"].ToString() == "1")
                            {
                                radBreakYes.Checked        = true;
                                divChange.Style["display"] = "inline";
                                txtChange.Text             = ds.Tables[0].Rows[0]["change"].ToString();
                                divName.Style["display"]   = "inline";
                                int intName = Int32.Parse(ds.Tables[0].Rows[0]["nameid"].ToString());
                                if (oClass.Get(intClass, "pnc") == "1")
                                {
                                    txtDeviceName.Text = oServerName.GetNameFactory(intName, 0);
                                }
                                else
                                {
                                    txtDeviceName.Text = oServerName.GetName(intName, 0);
                                }
                                txtQuantity.ReadOnly = true;
                            }
                            else
                            {
                                radBreakNo.Checked = true;
                            }
                        }
                        else
                        {
                            radNo.Checked = true;
                        }
                        txtName.Text = ds.Tables[0].Rows[0]["name"].ToString();
                        try
                        {
                            ddlClass.SelectedValue = intClass.ToString();
                        }
                        catch { }
                        if (ddlClass.SelectedIndex == 0)
                        {
                            // Class is not available, add it.
                            ddlClass.Items.Add(new ListItem(oClass.Get(intClass, "name") + " *", intClass.ToString()));
                            ddlClass.SelectedValue = intClass.ToString();
                        }
                        if (oClass.IsProd(intClass) && oClass.Get(intClass, "pnc") != "1")
                        {
                            divTest.Style["display"] = "inline";
                            chkTest.Checked          = (ds.Tables[0].Rows[0]["test"].ToString() == "1");
                        }
                        int intEnv = Int32.Parse(ds.Tables[0].Rows[0]["environmentid"].ToString());
                        hdnEnvironment.Value          = intEnv.ToString();
                        ddlEnvironment.SelectedValue  = intEnv.ToString();
                        ddlEnvironment.Enabled        = true;
                        ddlEnvironment.DataTextField  = "name";
                        ddlEnvironment.DataValueField = "id";
                        ddlEnvironment.DataSource     = oClass.GetEnvironment(intClass, 1);
                        ddlEnvironment.DataBind();
                        ddlEnvironment.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                        if (lblPlatform.Text.ToUpper() == "SERVER" && ddlClass.SelectedItem.Text.ToUpper() == "PRODUCTION")
                        {
                            ddlMaintenance.Enabled = true;
                        }
                        if (lblPlatform.Text.ToUpper() == "SERVER" && ddlClass.SelectedItem.Text.ToUpper() == "TEST")
                        {
                            ddlMaintenance.Enabled = true;
                        }
                        if (lblPlatform.Text.ToUpper() == "SERVER")
                        {
                            divServerType.Style["display"] = "inline";
                        }
                        intAddress = Int32.Parse(ds.Tables[0].Rows[0]["addressid"].ToString());
                        ddlMaintenance.SelectedValue = ds.Tables[0].Rows[0]["maintenanceid"].ToString();
                        int intApplicationID = Int32.Parse(ds.Tables[0].Rows[0]["applicationid"].ToString());
                        ddlApplications.SelectedValue = intApplicationID.ToString();
                        DataSet dsSubApplications = oServerName.GetSubApplications(intApplicationID, 1);
                        if (dsSubApplications.Tables[0].Rows.Count > 0)
                        {
                            int intSubApplicationID = Int32.Parse(ds.Tables[0].Rows[0]["subapplicationid"].ToString());
                            ddlSubApplications.DataTextField  = "name";
                            ddlSubApplications.DataValueField = "id";
                            ddlSubApplications.DataSource     = dsSubApplications;
                            ddlSubApplications.DataBind();
                            ddlSubApplications.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                            divSubApplications.Style["display"] = "inline";
                            ddlSubApplications.SelectedValue    = intSubApplicationID.ToString();
                            hdnSubApplication.Value             = intSubApplicationID.ToString();
                        }
                        txtQuantity.Text         = ds.Tables[0].Rows[0]["quantity"].ToString();
                        radResiliencyYes.Checked = (ds.Tables[0].Rows[0]["resiliency"].ToString() == "1");
                        radResiliencyNo.Checked  = (radResiliencyYes.Checked == false);
                        if (txtQuantity.Text == "0")
                        {
                            txtQuantity.Text = "";
                        }
                        intRecovery = Int32.Parse(ds.Tables[0].Rows[0]["recovery_number"].ToString());
                    }
                }
                else
                {
                    btnBack.Enabled     = false;
                    ddlPlatform.Visible = true;
                    intAddress          = intLocation;
                    radNo.Checked       = true;
                }
            }
            else
            {
                btnBack.Enabled     = false;
                ddlPlatform.Visible = true;
                intAddress          = intLocation;
                radNo.Checked       = true;
            }
            if (intAddress > 0)
            {
                intLocation = intAddress;
            }
            strLocation       = oLocation.LoadDDL("ddlState", "ddlCity", "ddlAddress", hdnLocation.ClientID, intLocation, true, "ddlCommon");
            hdnLocation.Value = intLocation.ToString();
            ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',1);EnableMaintenance();ShowTestOption('" + divTest.ClientID + "');");
            ddlPlatform.Attributes.Add("onchange", "ShowServerType('" + divServerType.ClientID + "');");
            ddlApplications.Attributes.Add("onchange", "PopulateSubApplications('" + ddlApplications.ClientID + "','" + ddlSubApplications.ClientID + "','" + divSubApplications.ClientID + "');");
            ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
            ddlSubApplications.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlSubApplications.ClientID + "','" + hdnSubApplication.ClientID + "');");
            btnNext.Attributes.Add("onclick", "return EnsureOverride('" + radYes.ClientID + "','" + radNo.ClientID + "','" + radBreakYes.ClientID + "','" + radBreakNo.ClientID + "','" + txtChange.ClientID + "')" +
                                   " && ValidateDropDown('" + ddlPlatform.ClientID + "','Please select a platform')" +
                                   " && ValidateHidden0('" + hdnLocation.ClientID + "','ddlState','Please select a location')" +
                                   " && ValidateDropDown('" + ddlClass.ClientID + "','Please select a class')" +
                                   " && ValidateDropDown('" + ddlEnvironment.ClientID + "','Please select an environment')" +
                                   " && EnsureMaintenance('" + ddlMaintenance.ClientID + "','Please select a maintenance window')" +
                                   " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter a valid quantity')" +
                                   " && ValidateHiddenDisabled('" + hdnSubApplication.ClientID + "','" + ddlSubApplications.ClientID + "','Please select a value')" +
                                   " && ForeRecoveryFirst(" + (boolRecoveryMany ? "true" : "false") + ",'" + txtQuantity.ClientID + "'," + intRecovery.ToString() + ")" +
                                   " && ValidateTextDisabled('" + txtDeviceName.ClientID + "', 'Please enter a valid device name')" +
                                   " && EnsureDeviceName('" + radYes.ClientID + "','" + radBreakYes.ClientID + "','" + txtDeviceName.ClientID + "','" + ddlClass.ClientID + "')" +
                                   ";");
            btnUpdate.Attributes.Add("onclick", "return EnsureOverride('" + radYes.ClientID + "','" + radNo.ClientID + "','" + radBreakYes.ClientID + "','" + radBreakNo.ClientID + "','" + txtChange.ClientID + "')" +
                                     " && ValidateDropDown('" + ddlPlatform.ClientID + "','Please select a platform')" +
                                     " && ValidateHidden0('" + hdnLocation.ClientID + "','ddlState','Please select a location')" +
                                     " && ValidateDropDown('" + ddlClass.ClientID + "','Please select a class')" +
                                     " && ValidateDropDown('" + ddlEnvironment.ClientID + "','Please select an environment')" +
                                     " && EnsureMaintenance('" + ddlMaintenance.ClientID + "','Please select a maintenance window')" +
                                     " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter a valid quantity')" +
                                     " && ValidateHiddenDisabled('" + hdnSubApplication.ClientID + "','" + ddlSubApplications.ClientID + "','Please select a value')" +
                                     " && ForeRecoveryFirst(" + (boolRecoveryMany ? "true" : "false") + ",'" + txtQuantity.ClientID + "'," + intRecovery.ToString() + ")" +
                                     " && ValidateTextDisabled('" + txtDeviceName.ClientID + "', 'Please enter a valid device name')" +
                                     " && EnsureDeviceName('" + radYes.ClientID + "','" + radBreakYes.ClientID + "','" + txtDeviceName.ClientID + "','" + ddlClass.ClientID + "')" +
                                     ";");
            radYes.Attributes.Add("onclick", "ShowHideDiv('" + divOverride.ClientID + "','inline');ShowHideDivCheck('" + divChange.ClientID + "',document.getElementById('" + radBreakYes.ClientID + "'));ShowHideDivCheck('" + divName.ClientID + "',document.getElementById('" + radBreakYes.ClientID + "'));LockQuantityRadio('" + radYes.ClientID + "','" + radBreakYes.ClientID + "','" + txtQuantity.ClientID + "');");
            radNo.Attributes.Add("onclick", "ShowHideDiv('" + divOverride.ClientID + "','none');ShowHideDiv('" + divChange.ClientID + "','none');ShowHideDiv('" + divName.ClientID + "','none');LockQuantity('" + txtQuantity.ClientID + "',false);");
            radBreakYes.Attributes.Add("onclick", "ShowHideDiv('" + divChange.ClientID + "','inline');ShowHideDiv('" + divName.ClientID + "','inline');LockQuantity('" + txtQuantity.ClientID + "',true);");
            radBreakNo.Attributes.Add("onclick", "ShowHideDiv('" + divChange.ClientID + "','none');ShowHideDiv('" + divName.ClientID + "','none');LockQuantity('" + txtQuantity.ClientID + "',false);");
            btnClose.Attributes.Add("onclick", "return window.close();");
        }