示例#1
0
        protected void CheckResults(string strName, string strNumber, int intLead, int intEngineer)
        {
            DataSet dsProject = new DataSet();

            if (strName != "")
            {
                dsProject = oProject.GetProjectsLikeName(strName);
            }
            else if (strNumber != "")
            {
                dsProject = oProject.GetProjectsLikeNumber(strNumber);
            }
            else if (intLead > 0)
            {
                dsProject = oProject.GetProjectsLead(intLead);
            }
            else if (intEngineer > 0)
            {
                dsProject = oProject.GetProjectsEngineer(intEngineer);
            }

            if (dsProject.Tables[0].Rows.Count == 1)
            {
                Response.Redirect(oPage.GetFullLink(intPage) + "?id=" + oFunction.encryptQueryString(dsProject.Tables[0].Rows[0]["projectid"].ToString()));
            }
            else
            {
                panNone.Visible     = true;
                panMultiple.Visible = true;
                StringBuilder sb = new StringBuilder(strMultiple);

                foreach (DataRow dr in dsProject.Tables[0].Rows)
                {
                    sb.Append("<tr onmouseover=\"CellRowOver(this);\" onmouseout=\"CellRowOut(this);\" onclick=\"window.navigate('");
                    sb.Append(oPage.GetFullLink(intPage));
                    sb.Append("?id=");
                    sb.Append(oFunction.encryptQueryString(dr["projectid"].ToString()));
                    sb.Append("');\">");
                    sb.Append("<td>");
                    sb.Append(dr["name"].ToString());
                    sb.Append("</td>");
                    sb.Append("<td>");
                    sb.Append(dr["number"].ToString());
                    sb.Append("</td>");
                    sb.Append("<td>");
                    sb.Append(dr["bd"].ToString());
                    sb.Append("</td>");
                    sb.Append("<td>");
                    sb.Append(oOrganization.GetName(Int32.Parse(dr["organization"].ToString())));
                    sb.Append("</td>");
                    sb.Append("<td>");
                    sb.Append(oStatusLevel.HTML(Int32.Parse(dr["status"].ToString())));
                    sb.Append("</td>");
                    sb.Append("</tr>");
                }

                strMultiple = sb.ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oProjectRequest  = new ProjectRequest(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oProjectNumber   = new ProjectNumber(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oVariable        = new Variables(intEnvironment);
            oService         = new Services(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            oStatusLevel     = new StatusLevels();
            oEnhancement     = new Enhancements(intProfile, dsn);
            oLog             = new Log(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);

            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 (!IsPostBack)
                {
                    if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
                    {
                        lblResourceParent.Text = Request.QueryString["rrid"];
                        int intResourceParent = Int32.Parse(lblResourceParent.Text);
                        ds = oResourceRequest.Get(intResourceParent);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int      intItem    = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                            int      intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                            int      intNumber  = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                            int      intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                            Forecast oForecast  = new Forecast(intProfile, dsn);
                            if (intService == intStorageService)
                            {
                                try
                                {
                                    OnDemandTasks oOnDemandTask = new OnDemandTasks(0, dsn);
                                    Locations     oLocation     = new Locations(0, dsn);
                                    DataSet       dsDesign      = oOnDemandTask.GetServerStorage(intRequest, intItem, intNumber);
                                    if (dsDesign.Tables[0].Rows.Count == 1)
                                    {
                                        int intAnswer  = Int32.Parse(dsDesign.Tables[0].Rows[0]["answerid"].ToString());
                                        int intAddress = Int32.Parse(oForecast.GetAnswer(intAnswer, "addressid"));
                                        lblLocation.Text    = oLocation.GetFull(intAddress);
                                        panLocation.Visible = true;
                                    }
                                }
                                catch { }
                            }
                            int     intProject  = Int32.Parse(oRequest.Get(intRequest, "projectid"));
                            int     intApp      = oRequestItem.GetItemApplication(intItem);
                            int     intForecast = 0;
                            DataSet dsForecast  = oForecast.GetProject(intProject);
                            if (dsForecast.Tables[0].Rows.Count > 0)
                            {
                                intForecast = Int32.Parse(dsForecast.Tables[0].Rows[0]["id"].ToString());
                            }
                            if (intForecast > 0)
                            {
                                btnView.Attributes.Add("oncontextmenu", "return OpenWindow('NEW_WINDOW','" + oPage.GetFullLink(intDesignBuilder) + "?id=" + intForecast.ToString() + "');");
                            }
                            else
                            {
                                btnView.Attributes.Add("oncontextmenu", "alert('There is no design for this project');return false;");
                            }
                            if (ds.Tables[0].Rows[0]["solo"].ToString() == "0")
                            {
                                btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewRequest.ToString() + "&rid=" + intRequest.ToString() + "');");
                                btnView.Text = "Click here to view the project details";
                                lblType.Text = "Project Request";
                            }
                            else
                            {
                                btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewResourceRequest.ToString() + "&rrid=" + intResourceParent.ToString() + "');");
                                if (oApplication.Get(intApp, "tpm") == "1")
                                {
                                    btnView.Text = "Click here to view the project details";
                                }
                                else
                                {
                                    btnView.Text = "Click here to view this request";
                                }
                                lblType.Text = "Service Request";
                            }
                            btnAssignments.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intSearchPage.ToString() + "&pid=" + intProject + "&aid=" + intApp.ToString() + "&sort=userid');");
                            //btnAssignments.Attributes.Add("onclick", "return OpenNewWindowMenu('/datapoint/projects/datapoint_projects.aspx?id=" + oFunction.encryptQueryString(intProject.ToString()) + "', '800', '600');");
                            lblItem.Text    = intItem.ToString();
                            lblService.Text = oService.GetName(intService);
                            if (oApplication.Get(intApp, "request_items") == "1")
                            {
                                lblGroup.Text = oApplication.GetName(intApp) + " | " + oRequestItem.GetItemName(intItem);
                            }
                            else
                            {
                                lblGroup.Text = oApplication.GetName(intApp);
                            }
                            int intUser       = Int32.Parse(oRequest.Get(intRequest, "userid"));
                            int intAppManager = oApplication.GetManager(intApp);
                            if (ds.Tables[0].Rows[0]["accepted"].ToString() == "-1" && oApplication.Get(intApp, "tpm") == "1")
                            {
                                if (intUser == intProfile || oDelegate.Get(intUser, intProfile) > 0)
                                {
                                    panRequest.Visible      = true;
                                    panAssignSingle.Visible = true;
                                    txtHours.Text           = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F");
                                    panHours.Visible        = !(oApplication.Get(intApp, "tpm") == "1");
                                    txtHours.Enabled        = (oService.Get(intService, "disable_hours") == "1" ? false : true);
                                    lblQuantity.Text        = ds.Tables[0].Rows[0]["devices"].ToString();
                                    lblStatus.Text          = oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString()));
                                    panQuantity.Visible     = (lblQuantity.Text != "0");
                                    txtQuantity.Text        = lblQuantity.Text;
                                    txtQuantity.Enabled     = (txtQuantity.Text != "0");
                                    txtQuantity.Enabled     = false;
                                    lblAssign.Text          = oUser.GetFullName(intProfile);
                                    strSummary = oResourceRequest.GetBodyOverallFix(intResourceParent, 0, intEnvironment, false);
                                }
                                else
                                {
                                    Response.Write("no rights");
                                    panDenied.Visible = true;
                                }
                                btnSubmit.Attributes.Add("onclick", "return ValidateNumber0('" + txtHours.ClientID + "','Please enter a valid number for the hours allocated') && ValidateHidden('" + hdnManager.ClientID + "','" + txtManager.ClientID + "','Please enter a valid LAN ID') && ProcessButton(this);");
                            }
                            else
                            {
                                string strValidate = "";
                                if (oUser.IsAdmin(intProfile) || oService.IsManager(intService, intProfile) || (oApplication.IsManager(intApp, intProfile) && oApplication.Get(intApp, "disable_manager") != "1"))
                                {
                                    panRequest.Visible        = true;
                                    panAssignMultiple.Visible = true;
                                    btnSubmit.Enabled         = (ds.Tables[0].Rows[0]["assigned"].ToString() == "");
                                    if (ds.Tables[0].Rows[0]["status"].ToString() == "5")
                                    {
                                        radHold.Checked            = true;
                                        divChoice.Style["display"] = "inline";
                                        divHold.Style["display"]   = "inline";
                                        txtHold.Text = ds.Tables[0].Rows[0]["reason"].ToString();
                                    }
                                    else
                                    {
                                        divChoice.Style["display"] = (ds.Tables[0].Rows[0]["accepted"].ToString() == "0" ? "inline" : "none");
                                        divAccept.Style["display"] = (ds.Tables[0].Rows[0]["accepted"].ToString() == "1" ? "inline" : "none");
                                    }
                                    int intEnhancementService = 0;
                                    Int32.TryParse(ConfigurationManager.AppSettings["HELP_ENHANCEMENT_SERVICEID"], out intEnhancementService);
                                    if (intService == intEnhancementService)
                                    {
                                        panEnhancement.Visible   = true;
                                        ddlModule.DataTextField  = "name";
                                        ddlModule.DataValueField = "id";
                                        ddlModule.DataSource     = oEnhancement.GetModules(1);
                                        ddlModule.DataBind();
                                        ddlModule.Items.Insert(0, new ListItem("-- SELECT --", "0"));

                                        strValidate += "ValidateDropDown('" + ddlModule.ClientID + "','Select a classification') && ";
                                        radEnhancementShort.Checked = true;
                                        radEnhancementReject.Attributes.Add("onclick", "ShowHideDiv('" + trEnhancementReject.ClientID + "','inline');ShowHideDiv('" + trEnhancementClassification.ClientID + "','none');ShowHideDiv('" + divAccept.ClientID + "','none');");
                                        radEnhancementDuplicate.Attributes.Add("onclick", "ShowHideDiv('" + trEnhancementReject.ClientID + "','inline');ShowHideDiv('" + trEnhancementClassification.ClientID + "','none');ShowHideDiv('" + divAccept.ClientID + "','none');");
                                        radEnhancementShort.Attributes.Add("onclick", "ShowHideDiv('" + trEnhancementReject.ClientID + "','none');ShowHideDiv('" + trEnhancementClassification.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','inline');");
                                        radEnhancementLong.Attributes.Add("onclick", "ShowHideDiv('" + trEnhancementReject.ClientID + "','inline');ShowHideDiv('" + trEnhancementClassification.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','inline');");
                                    }
                                    panDelete.Visible = (intItem == intImplementorDistributed || intItem == intImplementorMidrange);
                                    btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this request');");
                                    txtHours.Text       = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F");
                                    panHours.Visible    = !(oApplication.Get(intApp, "tpm") == "1");
                                    txtHours.Enabled    = (oService.Get(intService, "disable_hours") == "1" ? false : true);
                                    lblQuantity.Text    = ds.Tables[0].Rows[0]["devices"].ToString();
                                    panQuantity.Visible = (lblQuantity.Text != "0");
                                    txtQuantity.Text    = lblQuantity.Text;
                                    txtQuantity.Enabled = (txtQuantity.Text != "0");
                                    txtQuantity.Enabled = false;
                                    lblStatus.Text      = oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString()));
                                    trAssigned.Visible  = !(btnSubmit.Enabled);
                                    string  strAssign = "";
                                    DataSet dsManager = oService.GetUser(intService, 1);
                                    foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                    {
                                        if (strAssign != "")
                                        {
                                            strAssign += ", ";
                                        }
                                        strAssign += oUser.GetFullName(Int32.Parse(drManager["userid"].ToString()));
                                    }
                                    lblAssign.Text = strAssign;
                                    DataSet   dsReports = oUser.GetManagerReports(intAppManager, intRequest, intService, intNumber);
                                    DataTable dtReports = dsReports.Tables[0].Copy();
                                    dtReports.Clear();
                                    DataSet dsAssignment = oService.GetUser(intService, -100);
                                    foreach (DataRow drAssignment in dsAssignment.Tables[0].Rows)
                                    {
                                        int     intAssignment = Int32.Parse(drAssignment["userid"].ToString());
                                        DataSet dsAssignees   = oUser.GetManagerReports(intAssignment, intRequest, intService, intNumber);
                                        foreach (DataRow drAssignee in dsAssignees.Tables[0].Rows)
                                        {
                                            dtReports.ImportRow(drAssignee);
                                        }
                                    }
                                    if (dtReports.Rows.Count > 0)
                                    {
                                        // Use custom assignment list
                                        // First, remove duplicates
                                        Hashtable hTable        = new Hashtable();
                                        ArrayList duplicateList = new ArrayList();
                                        foreach (DataRow drow in dtReports.Rows)
                                        {
                                            if (hTable.Contains(drow["userid"]))
                                            {
                                                duplicateList.Add(drow);
                                            }
                                            else
                                            {
                                                hTable.Add(drow["userid"], string.Empty);
                                            }
                                        }
                                        foreach (DataRow dRow in duplicateList)
                                        {
                                            dtReports.Rows.Remove(dRow);
                                        }

                                        // Next, sort by username
                                        dtReports.DefaultView.Sort = "username";

                                        // Now add to dataset
                                        dsReports = new DataSet();
                                        dsReports.Tables.Add(dtReports.DefaultView.ToTable());
                                    }
                                    LoadList(dsReports, intApp);
                                    LoadAvailable(dsReports, intApp);
                                    strSummary = oResourceRequest.GetBodyOverallFix(intResourceParent, 0, intEnvironment, false);
                                }
                                else
                                {
                                    Response.Write("no delegate");
                                    panDenied.Visible = true;
                                }
                                btnSubmit.Attributes.Add("onclick", "return " + strValidate + "ValidateChoice('" + divChoice.ClientID + "','" + radAccept.ClientID + "','" + radReject.ClientID + "','" + radHold.ClientID + "','" + ddlUser.ClientID + "','" + txtHours.ClientID + "') && ProcessButton(this);");
                            }
                        }
                        else
                        {
                            panDenied.Visible = true;
                        }
                    }
                    else
                    {
                        panDenied.Visible = true;
                    }
                }
            }
            btnClose.Attributes.Add("onclick", "return CloseWindow();");
            lnkAvailable.Attributes.Add("onclick", "return ShowHideAvailable('" + divAvailable.ClientID + "');");
            radAccept.Attributes.Add("onclick", "ShowHideDiv('" + divAccept.ClientID + "','inline');ShowHideDiv('" + divReject.ClientID + "','none');ShowHideDiv('" + divHold.ClientID + "','none');");
            radReject.Attributes.Add("onclick", "ShowHideDiv('" + divReject.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','none');ShowHideDiv('" + divHold.ClientID + "','none');");
            radHold.Attributes.Add("onclick", "ShowHideDiv('" + divHold.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','none');ShowHideDiv('" + divReject.ClientID + "','none');");
            txtManager.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divManager.ClientID + "','" + lstManager.ClientID + "','" + hdnManager.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstManager.Attributes.Add("ondblclick", "AJAXClickRow();");
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            Projects      oProject      = new Projects(intProfile, dsn);
            Organizations oOrganization = new Organizations(intProfile, dsn);
            Segment       oSegment      = new Segment(intProfile, dsn);
            Users         oUser         = new Users(intProfile, dsn);
            StatusLevels  oStatusLevel  = new StatusLevels();
            StringBuilder sb            = new StringBuilder(strBody);

            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                int     intProject = Int32.Parse(Request.QueryString["id"]);
                DataSet ds         = oProject.Get(intProject);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    sb.Append("<tr><td nowrap><b>Project Name:</b></td><td>");
                    sb.Append(ds.Tables[0].Rows[0]["name"].ToString());
                    sb.Append("</td></tr>");
                    sb.Append("<tr><td nowrap><b>Project Number:</b></td><td>");
                    sb.Append(ds.Tables[0].Rows[0]["number"].ToString());
                    sb.Append("</td></tr>");
                    sb.Append("<tr><td nowrap><b>Initiative Type:</b></td><td>");
                    sb.Append(ds.Tables[0].Rows[0]["bd"].ToString());
                    sb.Append("</td></tr>");
                    sb.Append("<tr><td nowrap><b>Organization:</b></td><td>");
                    sb.Append(oOrganization.GetName(Int32.Parse(ds.Tables[0].Rows[0]["organization"].ToString())));
                    sb.Append("</td></tr>");
                    sb.Append("<tr><td nowrap><b>Segment:</b></td><td>");
                    sb.Append(oSegment.GetName(Int32.Parse(ds.Tables[0].Rows[0]["segmentid"].ToString())));
                    sb.Append("</td></tr>");
                    sb.Append("<tr><td nowrap><b>Project Lead:</b></td><td>");
                    sb.Append(oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["lead"].ToString())));
                    sb.Append("</td></tr>");
                    sb.Append("<tr><td nowrap><b>Executive Sponsor:</b></td><td>");
                    sb.Append(oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["executive"].ToString())));
                    sb.Append("</td></tr>");
                    sb.Append("<tr><td nowrap><b>Working Sponsor:</b></td><td>");
                    sb.Append(oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["working"].ToString())));
                    sb.Append("</td></tr>");
                    sb.Append("<tr><td nowrap><b>Integration Engineer:</b></td><td>");
                    sb.Append(oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["engineer"].ToString())));
                    sb.Append("</td></tr>");
                    sb.Append("<tr><td nowrap><b>Technical Lead:</b></td><td>");
                    sb.Append(oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["technical"].ToString())));
                    sb.Append("</td></tr>");
                    sb.Append("<tr><td nowrap><b>Status:</b></td><td>");
                    sb.Append(oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString())));
                    sb.Append("</td></tr>");
                }
            }

            if (sb.ToString() != "")
            {
                sb.Insert(0, "<table border=\"0\" cellpadding=\"4\" cellspacing=\"3\">");
                sb.Append("</table>");
            }

            strBody = sb.ToString();
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oProjectRequest  = new ProjectRequest(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oProjectNumber   = new ProjectNumber(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oVariable        = new Variables(intEnvironment);
            oService         = new Services(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            oStatusLevel     = new StatusLevels();
            oServiceDetail   = new ServiceDetails(intProfile, dsn);
            oLog             = new Log(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 (!IsPostBack)
                {
                    if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
                    {
                        lblResourceParent.Text = Request.QueryString["rrid"];
                        int intResourceParent = Int32.Parse(lblResourceParent.Text);
                        ds = oResourceRequest.Get(intResourceParent);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int      intItem     = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                            int      intService  = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                            int      intRequest  = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                            int      intNumber   = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                            int      intProject  = Int32.Parse(oRequest.Get(intRequest, "projectid"));
                            int      intApp      = oRequestItem.GetItemApplication(intItem);
                            int      intForecast = 0;
                            Forecast oForecast   = new Forecast(intProfile, dsn);
                            DataSet  dsForecast  = oForecast.GetProject(intProject);
                            if (dsForecast.Tables[0].Rows.Count > 0)
                            {
                                intForecast = Int32.Parse(dsForecast.Tables[0].Rows[0]["id"].ToString());
                            }
                            if (intForecast > 0)
                            {
                                btnView.Attributes.Add("oncontextmenu", "return OpenWindow('NEW_WINDOW','" + oPage.GetFullLink(intDesignBuilder) + "?id=" + intForecast.ToString() + "');");
                            }
                            else
                            {
                                btnView.Attributes.Add("oncontextmenu", "alert('There is no design for this project');return false;");
                            }
                            if (ds.Tables[0].Rows[0]["solo"].ToString() == "0")
                            {
                                btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewRequest.ToString() + "&rid=" + intRequest.ToString() + "');");
                                btnView.Text = "Click here to view the project details";
                                lblType.Text = "Project Request";
                            }
                            else
                            {
                                btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewResourceRequest.ToString() + "&rrid=" + intResourceParent.ToString() + "');");
                                if (oApplication.Get(intApp, "tpm") == "1")
                                {
                                    btnView.Text = "Click here to view the project details";
                                }
                                else
                                {
                                    btnView.Text = "Click here to view this request";
                                }
                                lblType.Text = "Service Request";
                            }
                            btnAssignments.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intSearchPage.ToString() + "&pid=" + intProject + "&aid=" + intApp.ToString() + "&sort=userid');");
                            lblItem.Text      = intItem.ToString();
                            lblService.Text   = oService.GetName(intService);
                            lblServiceID.Text = intService.ToString();
                            if (oApplication.Get(intApp, "request_items") == "1")
                            {
                                lblGroup.Text = oApplication.GetName(intApp) + " | " + oRequestItem.GetItemName(intItem);
                            }
                            else
                            {
                                lblGroup.Text = oApplication.GetName(intApp);
                            }
                            int intUser       = Int32.Parse(oRequest.Get(intRequest, "userid"));
                            int intAppManager = oApplication.GetManager(intApp);
                            if (ds.Tables[0].Rows[0]["accepted"].ToString() == "-1" && oApplication.Get(intApp, "tpm") == "1")
                            {
                                if (intUser == intProfile || oDelegate.Get(intUser, intProfile) > 0)
                                {
                                    panRequest.Visible         = true;
                                    panAssignSingle.Visible    = true;
                                    txtHours.Text              = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F");
                                    lblHoursOverall.Text       = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F");
                                    txtQuantityOverall.Text    = ds.Tables[0].Rows[0]["devices"].ToString();
                                    txtQuantityOverall.Enabled = false;
                                    txtQuantity.Text           = txtQuantityOverall.Text;
                                    txtQuantity.Enabled        = false;
                                    lblHours.Visible           = true;
                                    lblHours.Text              = txtHours.Text;
                                    lblStatus.Text             = oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString()));
                                    txtQuantity.Text           = ds.Tables[0].Rows[0]["devices"].ToString();
                                    btnAssign.Enabled          = (txtQuantity.Text != "0");
                                    lblAssignBy.Text           = oUser.GetFullName(intProfile);
                                    strSummary = oResourceRequest.GetBodyOverallFix(intResourceParent, 0, intEnvironment, false);
                                }
                                else
                                {
                                    Response.Write("no rights");
                                    panDenied.Visible = true;
                                }
                                btnSubmit.Attributes.Add("onclick", "return ValidateNumber0('" + txtHours.ClientID + "','Please enter a valid number for the hours allocated') && ValidateHidden('" + hdnManager.ClientID + "','" + txtManager.ClientID + "','Please enter a valid LAN ID') && ProcessButton(this);");
                            }
                            else
                            {
                                if (oUser.IsAdmin(intProfile) || oService.IsManager(intService, intProfile) || (oApplication.IsManager(intApp, intProfile) && oApplication.Get(intApp, "disable_manager") != "1"))
                                {
                                    panRequest.Visible        = true;
                                    panAssignMultiple.Visible = true;
                                    btnSubmit.Enabled         = (ds.Tables[0].Rows[0]["assigned"].ToString() == "");
                                    if (ds.Tables[0].Rows[0]["status"].ToString() == "5")
                                    {
                                        radHold.Checked            = true;
                                        divChoice.Style["display"] = "inline";
                                        divHold.Style["display"]   = "inline";
                                        txtHold.Text = ds.Tables[0].Rows[0]["reason"].ToString();
                                    }
                                    else
                                    {
                                        divChoice.Style["display"] = (ds.Tables[0].Rows[0]["accepted"].ToString() == "0" ? "inline" : "none");
                                        if (Request.QueryString["assign"] != null)
                                        {
                                            divAccept.Style["display"] = "inline";
                                            radAccept.Checked          = true;
                                        }
                                        else
                                        {
                                            divAccept.Style["display"] = (ds.Tables[0].Rows[0]["accepted"].ToString() == "1" ? "inline" : "none");
                                        }
                                    }
                                    panDelete.Visible = (intItem == intImplementorDistributed || intItem == intImplementorMidrange);
                                    btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this request');");
                                    txtHours.Text           = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F");
                                    lblHoursOverall.Text    = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F");
                                    txtQuantityOverall.Text = ds.Tables[0].Rows[0]["devices"].ToString();
                                    if (oApplication.Get(intApp, "tpm") == "1")
                                    {
                                        lblHours.Visible           = true;
                                        lblHours.Text              = txtHours.Text;
                                        txtQuantityOverall.Enabled = false;
                                        txtQuantity.Enabled        = false;
                                        btnAssign.Attributes.Add("onclick", "return ValidateDropDown('" + ddlUser.ClientID + "','Please select a technician')" +
                                                                 " && ProcessButton(this)" +
                                                                 ";");
                                    }
                                    else if (oServiceDetail.Gets(intService, 1).Tables[0].Rows.Count > 0)
                                    {
                                        lblHours.Visible = true;
                                        lblHours.Text    = "TBD ";
                                        btnWhy.Visible   = true;
                                        btnAssign.Attributes.Add("onclick", "return ValidateDropDown('" + ddlUser.ClientID + "','Please select a technician')" +
                                                                 " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter the quantity')" +
                                                                 " && ProcessButton(this)" +
                                                                 ";");
                                    }
                                    else if (oService.Get(intService, "disable_hours") == "1")
                                    {
                                        lblHours.Visible = true;
                                        lblHours.Text    = txtHours.Text;
                                        btnAssign.Attributes.Add("onclick", "return ValidateDropDown('" + ddlUser.ClientID + "','Please select a technician')" +
                                                                 " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter the quantity')" +
                                                                 " && ProcessButton(this)" +
                                                                 ";");
                                    }
                                    else
                                    {
                                        txtHours.Visible = true;
                                        btnAssign.Attributes.Add("onclick", "return ValidateDropDown('" + ddlUser.ClientID + "','Please select a technician')" +
                                                                 " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter the quantity')" +
                                                                 " && ValidateNumber0('" + txtHours.ClientID + "','Please enter the hours')" +
                                                                 " && ProcessButton(this)" +
                                                                 ";");
                                    }
                                    btnUpdate.Attributes.Add("onclick", "return ValidateNumber0('" + txtQuantityOverall.ClientID + "') && ProcessButton(this);");
                                    DataSet dsAssigned  = oResourceRequest.GetWorkflowsAssign(intResourceParent);
                                    int     intQuantity = Int32.Parse(ds.Tables[0].Rows[0]["devices"].ToString());
                                    foreach (DataRow drAssigned in dsAssigned.Tables[0].Rows)
                                    {
                                        intQuantity = intQuantity - Int32.Parse(drAssigned["devices"].ToString());
                                    }
                                    txtQuantity.Text    = intQuantity.ToString();
                                    btnAssign.Enabled   = (txtQuantity.Text != "0");
                                    lblStatus.Text      = oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString()));
                                    lblAssigned.Visible = !(btnSubmit.Enabled);
                                    string  strAssign = "";
                                    DataSet dsManager = oService.GetUser(intService, 1);
                                    foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                    {
                                        if (strAssign != "")
                                        {
                                            strAssign += ", ";
                                        }
                                        strAssign += oUser.GetFullName(Int32.Parse(drManager["userid"].ToString()));
                                    }
                                    lblAssignBy.Text = strAssign;
                                    DataSet   dsReports = oUser.GetManagerReports(intAppManager, intRequest, intService, intNumber);
                                    DataTable dtReports = dsReports.Tables[0].Copy();
                                    dtReports.Clear();
                                    DataSet dsAssignment = oService.GetUser(intService, -100);
                                    foreach (DataRow drAssignment in dsAssignment.Tables[0].Rows)
                                    {
                                        int     intAssignment = Int32.Parse(drAssignment["userid"].ToString());
                                        DataSet dsAssignees   = oUser.GetManagerReports(intAssignment, intRequest, intService, intNumber);
                                        foreach (DataRow drAssignee in dsAssignees.Tables[0].Rows)
                                        {
                                            dtReports.ImportRow(drAssignee);
                                        }
                                    }
                                    if (dtReports.Rows.Count > 0)
                                    {
                                        // Use custom assignment list
                                        // First, remove duplicates
                                        Hashtable hTable        = new Hashtable();
                                        ArrayList duplicateList = new ArrayList();
                                        foreach (DataRow drow in dtReports.Rows)
                                        {
                                            if (hTable.Contains(drow["userid"]))
                                            {
                                                duplicateList.Add(drow);
                                            }
                                            else
                                            {
                                                hTable.Add(drow["userid"], string.Empty);
                                            }
                                        }
                                        foreach (DataRow dRow in duplicateList)
                                        {
                                            dtReports.Rows.Remove(dRow);
                                        }

                                        // Next, sort by username
                                        dtReports.DefaultView.Sort = "username";

                                        // Now add to dataset
                                        dsReports = new DataSet();
                                        dsReports.Tables.Add(dtReports.DefaultView.ToTable());
                                    }
                                    LoadList(dsReports, intApp);
                                    LoadAvailable(dsReports, intApp);
                                    rptAssign.DataSource = dsAssigned;
                                    rptAssign.DataBind();
                                    foreach (RepeaterItem ri in rptAssign.Items)
                                    {
                                        ((LinkButton)ri.FindControl("btnDeleteAssign")).Attributes.Add("onclick", "return confirm('Are you sure you want to delete this assignment?');");
                                    }
                                    lblAssign.Visible = (rptAssign.Items.Count == 0);
                                    strSummary        = oResourceRequest.GetBodyOverallFix(intResourceParent, 0, intEnvironment, false);
                                    btnSubmit.Attributes.Add("onclick", "return ValidateChoice('" + divChoice.ClientID + "','" + radAccept.ClientID + "','" + radReject.ClientID + "','" + radHold.ClientID + "'," + dsAssigned.Tables[0].Rows.Count.ToString() + ") && ProcessButton(this);");
                                }
                                else
                                {
                                    Response.Write("no delegate");
                                    panDenied.Visible = true;
                                }
                            }
                        }
                        else
                        {
                            panDenied.Visible = true;
                        }
                    }
                    else
                    {
                        panDenied.Visible = true;
                    }
                }
            }
            btnClose.Attributes.Add("onclick", "return CloseWindow();");
            lnkAvailable.Attributes.Add("onclick", "return ShowHideAvailable('" + divAvailable.ClientID + "');");
            radAccept.Attributes.Add("onclick", "ShowHideDiv('" + divAccept.ClientID + "','inline');ShowHideDiv('" + divReject.ClientID + "','none');ShowHideDiv('" + divHold.ClientID + "','none');");
            radReject.Attributes.Add("onclick", "ShowHideDiv('" + divReject.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','none');ShowHideDiv('" + divHold.ClientID + "','none');");
            radHold.Attributes.Add("onclick", "ShowHideDiv('" + divHold.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','none');ShowHideDiv('" + divReject.ClientID + "','none');");
            txtManager.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divManager.ClientID + "','" + lstManager.ClientID + "','" + hdnManager.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstManager.Attributes.Add("ondblclick", "AJAXClickRow();");
            btnWhy.Attributes.Add("onclick", "return ShowHideAvailable('" + divWhy.ClientID + "');");
        }
示例#5
0
        protected void LoadSearch(int _search)
        {
            Search          oSearch          = new Search(intProfile, dsn);
            RequestItems    oRequestItem     = new RequestItems(intProfile, dsn);
            Services        oService         = new Services(intProfile, dsn);
            Applications    oApplication     = new Applications(intProfile, dsn);
            StatusLevels    oStatusLevel     = new StatusLevels();
            Users           oUser            = new Users(intProfile, dsn);
            Projects        oProject         = new Projects(intProfile, dsn);
            ResourceRequest oResourceRequest = new ResourceRequest(intProfile, dsn);
            ServiceRequests oServiceRequest  = new ServiceRequests(intProfile, dsn);
            DataSet         ds             = oSearch.GetProject(_search);
            int             intApplication = 0;

            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 (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["userid"].ToString() == intProfile.ToString())
                {
                    string strType        = ds.Tables[0].Rows[0]["type"].ToString();
                    string strClause      = "cv_projects.deleted = 0 AND cv_projects.number NOT LIKE 'CV%' AND cv_projects.number NOT LIKE 'EPS%'";
                    string strOr1         = "";
                    string strOr2         = "";
                    string strSQL         = "SELECT DISTINCT '?pid=' + CAST(cv_projects.projectid AS varchar(10)) + '&sid=" + _search.ToString() + "' AS query, cv_projects.name, cv_projects.number, cv_projects.status, cv_projects.modified FROM cv_projects INNER JOIN cv_requests LEFT OUTER JOIN cv_service_requests ON cv_service_requests.requestid = cv_requests.requestid AND cv_service_requests.deleted = 0 LEFT OUTER JOIN cv_project_requests ON cv_project_requests.requestid = cv_requests.requestid AND cv_project_requests.deleted = 0 INNER JOIN cv_resource_requests INNER JOIN cv_request_items INNER JOIN cv_applications ON cv_request_items.applicationid = cv_applications.applicationid AND cv_applications.deleted = 0 ON cv_request_items.itemid = cv_resource_requests.itemid AND cv_request_items.deleted = 0 INNER JOIN cv_users ON cv_resource_requests.userid = cv_users.userid AND cv_users.deleted = 0 AND cv_users.enabled = 1 ON cv_requests.requestid = cv_resource_requests.requestid AND cv_resource_requests.deleted = 0 ON cv_requests.projectid = cv_projects.projectid AND cv_requests.deleted = 0 WHERE ";
                    string strApplication = " AND cv_request_items.applicationid = " + intApplication.ToString();
                    switch (strType)
                    {
                    case "O":
                        strApplication = "";
                        string strOName   = ds.Tables[0].Rows[0]["oname"].ToString().Trim();
                        string strONumber = ds.Tables[0].Rows[0]["onumber"].ToString().Trim();
                        if (strONumber != "")
                        {
                            strClause      += " AND cv_projects.number LIKE '%" + strONumber + "%'";
                            lblResults.Text = "Project Number LIKE &quot;" + strONumber + "&quot;";
                        }
                        else
                        {
                            strClause      += " AND cv_projects.name LIKE '%" + strOName + "%'";
                            lblResults.Text = "Project Name LIKE &quot;" + strOName + "&quot;";
                        }
                        string strOStatus = ds.Tables[0].Rows[0]["ostatus"].ToString();
                        if (strOStatus != "0")
                        {
                            strClause += " AND cv_projects.status = " + strOStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strOStatus)) + "&quot;";
                        }
                        string strOStart = ds.Tables[0].Rows[0]["ostart"].ToString();
                        if (strOStart != "")
                        {
                            strOStart  = DateTime.Parse(strOStart).ToShortDateString();
                            strClause += " AND cv_projects.modified > " + strOStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Project Date > &quot;" + strOStart + "&quot;";
                        }
                        string strOEnd = ds.Tables[0].Rows[0]["oend"].ToString();
                        if (strOEnd != "")
                        {
                            strOEnd    = DateTime.Parse(strOEnd).ToShortDateString();
                            strClause += " AND cv_projects.modified < " + strOEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Project Date < &quot;" + strOEnd + "&quot;";
                        }
                        break;

                    case "P":
                        string strDepartment = ds.Tables[0].Rows[0]["department"].ToString();
                        if (strDepartment == "0")
                        {
                            strApplication   = "";
                            lblResults.Text += "Department = &quot;ALL&quot;";
                        }
                        else
                        {
                            strApplication   = " AND cv_request_items.applicationid = " + strDepartment;
                            lblResults.Text += "Department = &quot;" + oApplication.GetName(Int32.Parse(strDepartment)) + "&quot;";
                        }
                        string strDStatus = ds.Tables[0].Rows[0]["dstatus"].ToString();
                        if (strDStatus != "0")
                        {
                            strClause += " AND cv_resource_requests.status = " + strDStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strDStatus)) + "&quot;";
                        }
                        string strDStart = ds.Tables[0].Rows[0]["dstart"].ToString();
                        if (strDStart != "")
                        {
                            strDStart  = DateTime.Parse(strDStart).ToShortDateString();
                            strClause += " AND cv_requests.modified > " + strDStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date > &quot;" + strDStart + "&quot;";
                        }
                        string strDEnd = ds.Tables[0].Rows[0]["dend"].ToString();
                        if (strDEnd != "")
                        {
                            strDEnd    = DateTime.Parse(strDEnd).ToShortDateString();
                            strClause += " AND cv_requests.modified < " + strDEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date < &quot;" + strDEnd + "&quot;";
                        }
                        break;

                    case "T":
                        string strTechnician = ds.Tables[0].Rows[0]["technician"].ToString();
                        if (strTechnician != "0")
                        {
                            strClause       += " AND cv_resource_requests.userid = " + strTechnician;
                            lblResults.Text += "Technician = &quot;" + oUser.GetFullName(Int32.Parse(strTechnician)) + "&quot;";
                        }
                        string strTStatus = ds.Tables[0].Rows[0]["tstatus"].ToString();
                        if (strTStatus != "0")
                        {
                            strClause += " AND cv_resource_requests.status = " + strTStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strTStatus)) + "&quot;";
                        }
                        string strTStart = ds.Tables[0].Rows[0]["tstart"].ToString();
                        if (strTStart != "")
                        {
                            strTStart  = DateTime.Parse(strTStart).ToShortDateString();
                            strClause += " AND cv_requests.modified > " + strTStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date > &quot;" + strTStart + "&quot;";
                        }
                        string strTEnd = ds.Tables[0].Rows[0]["tend"].ToString();
                        if (strTEnd != "")
                        {
                            strTEnd    = DateTime.Parse(strTEnd).ToShortDateString();
                            strClause += " AND cv_requests.modified < " + strTEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date < &quot;" + strTEnd + "&quot;";
                        }
                        break;

                    case "L":
                        string strLead = ds.Tables[0].Rows[0]["lead"].ToString();
                        if (strLead != "0")
                        {
                            int intLead = Int32.Parse(strLead);
                            strClause       += " AND cv_users.manager = " + intLead.ToString();
                            lblResults.Text += "Team Lead = &quot;" + oUser.GetFullName(intLead) + "&quot;";
                        }
                        string strLStatus = ds.Tables[0].Rows[0]["lstatus"].ToString();
                        if (strLStatus != "0")
                        {
                            strClause += " AND cv_resource_requests.status = " + strLStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strLStatus)) + "&quot;";
                        }
                        string strLStart = ds.Tables[0].Rows[0]["lstart"].ToString();
                        if (strLStart != "")
                        {
                            strLStart  = DateTime.Parse(strLStart).ToShortDateString();
                            strClause += " AND cv_requests.modified > " + strLStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date < &quot;" + strLStart + "&quot;";
                        }
                        string strLEnd = ds.Tables[0].Rows[0]["lend"].ToString();
                        if (strLEnd != "")
                        {
                            strLEnd    = DateTime.Parse(strLEnd).ToShortDateString();
                            strClause += " AND cv_requests.modified < " + strLEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date > &quot;" + strLEnd + "&quot;";
                        }
                        break;

                    case "G":
                        string strItem = ds.Tables[0].Rows[0]["itemid"].ToString();
                        if (strItem != "0")
                        {
                            strClause       += " AND cv_resource_requests.itemid = " + strItem;
                            lblResults.Text += "Activity Type = &quot;" + oRequestItem.GetItemName(Int32.Parse(strItem)) + "&quot;";
                        }
                        string strGStatus = ds.Tables[0].Rows[0]["gstatus"].ToString();
                        if (strGStatus != "0")
                        {
                            strClause += " AND cv_resource_requests.status = " + strGStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strGStatus)) + "&quot;";
                        }
                        string strGStart = ds.Tables[0].Rows[0]["gstart"].ToString();
                        if (strGStart != "")
                        {
                            strGStart  = DateTime.Parse(strGStart).ToShortDateString();
                            strClause += " AND cv_requests.modified > " + strGStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date < &quot;" + strGStart + "&quot;";
                        }
                        string strGEnd = ds.Tables[0].Rows[0]["gend"].ToString();
                        if (strGEnd != "")
                        {
                            strGEnd    = DateTime.Parse(strGEnd).ToShortDateString();
                            strClause += " AND cv_requests.modified < " + strGEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date > &quot;" + strGEnd + "&quot;";
                        }
                        break;

                    case "S":
                        break;
                    }
                    strClause = strClause + strApplication;
                    if (strOr1 != "" && strOr2 != "")
                    {
                        strClause = strClause + " AND " + strOr1 + " AND cv_project_requests.id IS NOT NULL OR " + strClause + " AND " + strOr1 + " AND cv_service_requests.id IS NOT NULL OR " + strClause + " AND " + strOr2 + " AND cv_project_requests.id IS NOT NULL OR " + strClause + " AND " + strOr2 + " AND cv_service_requests.id IS NOT NULL";
                    }
                    else
                    {
                        strClause = strClause + " AND cv_project_requests.id IS NOT NULL OR " + strClause + " AND cv_service_requests.id IS NOT NULL";
                    }
                    ds = SqlHelper.ExecuteDataset(dsn, CommandType.Text, strSQL + strClause);
                    DataView dv = ds.Tables[0].DefaultView;
                    if (Request.QueryString["sort"] != null)
                    {
                        dv.Sort = Request.QueryString["sort"];
                    }
                    rptView.DataSource = dv;
                    rptView.DataBind();
                    foreach (RepeaterItem ri in rptView.Items)
                    {
                        Label _progress = (Label)ri.FindControl("lblProgress");
                        Label _status   = (Label)ri.FindControl("lblStatus");
                        _status.Text = oStatusLevel.HTML(Int32.Parse(_status.Text));
                        Label _updated = (Label)ri.FindControl("lblUpdated");
                        Label _number  = (Label)ri.FindControl("lblNumber");
                        if (_number.Text == "")
                        {
                            _number.Text = "<i>TBD...</i>";
                        }
                        double dblUsed      = 0.00;
                        double dblAllocated = 0.00;
                        if (_progress.Text.Contains("?pid=") == true)
                        {
                            int intProject = 0;
                            if (Request.QueryString["sid"] != null && Request.QueryString["sid"] != "")
                            {
                                string strProgress = _progress.Text.Substring(0, _progress.Text.IndexOf("&"));
                                intProject = Int32.Parse(strProgress.Substring(5));
                            }
                            else
                            {
                                intProject = Int32.Parse(_progress.Text.Substring(5));
                            }
                            _updated.Text = oProject.GetLastUpdated(intProject);
                            DataSet dsAll = oResourceRequest.GetWorkflowProject(intProject);
                            foreach (DataRow drAll in dsAll.Tables[0].Rows)
                            {
                                int intResourceWorkflow = Int32.Parse(drAll["id"].ToString());
                                dblAllocated += double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated"));
                                dblUsed      += oResourceRequest.GetWorkflowUsed(intResourceWorkflow);
                            }
                        }
                        else if (_progress.Text.Contains("?rid=") == true)
                        {
                            int     intRequest = Int32.Parse(_progress.Text.Substring(5));
                            DataSet dsAll      = oResourceRequest.GetWorkflowRequestAll(intRequest);
                            foreach (DataRow drAll in dsAll.Tables[0].Rows)
                            {
                                int intResourceWorkflow = Int32.Parse(drAll["id"].ToString());
                                dblAllocated += double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated"));
                                dblUsed      += oResourceRequest.GetWorkflowUsed(intResourceWorkflow);
                            }
                        }
                        double dblProgress = 0.00;
                        if (dblAllocated > 0.00)
                        {
                            dblProgress = (dblUsed / dblAllocated) * 100.00;
                        }
                        _progress.Text = oServiceRequest.GetStatusBar(dblProgress, "100", "6", true);
                    }
                    lblNone.Visible = (rptView.Items.Count == 0);
                }
            }
        }
        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();
            }
        }