Beispiel #1
0
        private void LoadRequest()
        {
            int intRequest  = Int32.Parse(Request.QueryString["rid"]);
            int intProject  = oRequest.GetProjectNumber(intRequest);
            int intPriority = 3;
            int intService  = Int32.Parse(lblService.Text);
            int intItem     = oService.GetItemId(intService);

            string strStatement = "";
            string strExpedite  = "";

            if (oService.Get(intService, "statement") == "1")
            {
                panStatement.Visible = true;
                strStatement        += " && ValidateText('" + txtStatement.ClientID + "','Please enter a statement of work')";
            }
            else
            {
                panStatement.Visible = false;
            }
            panUpload.Visible = (oService.Get(intService, "upload") == "1");
            //if (oService.Get(intService, "expedite") == "1")
            //{
            //    panExpedite.Visible = true;
            //    strExpedite += " && ValidateRadioButtons('" + radExpediteYes.ClientID + "','" + radExpediteNo.ClientID + "','Please select whether or not you want to expedite this request')";
            //}
            //else
            panExpedite.Visible = false;
            if (Request.QueryString["formid"] != null && Request.QueryString["formid"] != "")
            {
                panUpdate.Visible  = true;
                btnCancelR.Visible = boolReqReturned;
                btnCancel.Visible  = (boolReqReturned == false);
                DataSet ds = oServiceEditor.GetRequestData(intRequest, intService, Int32.Parse(lblNumber.Text), 0, dsn);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtTitle.Text          = ds.Tables[0].Rows[0]["title"].ToString();
                    txtStatement.Text      = ds.Tables[0].Rows[0]["statement"].ToString();
                    intPriority            = Int32.Parse(ds.Tables[0].Rows[0]["priority"].ToString());
                    radExpediteYes.Checked = (ds.Tables[0].Rows[0]["expedite"].ToString() == "1");
                    radExpediteNo.Checked  = (ds.Tables[0].Rows[0]["expedite"].ToString() == "0");
                }
                strForm = oServiceEditor.LoadForm(intService, false, false, "", intEnvironment, ds, dsn);
            }
            else
            {
                panNavigation.Visible = true;
                strForm = oServiceEditor.LoadForm(intService, false, false, "", intEnvironment, null, dsn);
            }
            // Priority and SLA
            int intApp         = oRequestItem.GetItemApplication(intItem);
            int intWorkingDays = oApplication.GetLead(intApp, intPriority);

            if (intWorkingDays > 0)
            {
                panDeliverable.Visible = true;
                //oApplication.AssignPriority(intApp, radPriority, lblDeliverable.ClientID, txtEnd.ClientID, hdnEnd.ClientID);
                lblDeliverable.Text = intWorkingDays.ToString();
                //if (boolFound == false)
                //    txtEnd.Text = DateTime.Today.AddDays(intWorkingDays).ToShortDateString();
                hdnEnd.Value = DateTime.Today.AddDays(intWorkingDays).ToShortDateString();
            }
            radPriority.SelectedValue = intPriority.ToString();
            string strRequired = oServiceEditor.GetRequired();

            // Load Title if no project
            if (intProject == -1)
            {
                panTitle.Visible = true;
                if (oService.Get(intService, "title_override") == "1")
                {
                    lblTitleName.Text = oService.Get(intService, "title_name");
                }
                btnNext.Attributes.Add("onclick", "return ValidateText('" + txtTitle.ClientID + "','Please enter a title')" +
                                       strStatement +
                                       strRequired +
                                       strExpedite +
                                       " && ProcessButton(this) && LoadWait();");
                btnUpdate.Attributes.Add("onclick", "return ValidateText('" + txtTitle.ClientID + "','Please enter a title')" +
                                         strStatement +
                                         strRequired +
                                         strExpedite +
                                         " && ProcessButton(this) && LoadWait();");
            }
            else
            {
                btnNext.Attributes.Add("onclick", "return true" +
                                       strStatement +
                                       strRequired +
                                       strExpedite +
                                       " && ProcessButton(this) && LoadWait();");
                btnUpdate.Attributes.Add("onclick", "return true" +
                                         strStatement +
                                         strRequired +
                                         strExpedite +
                                         " && ProcessButton(this) && LoadWait();");
            }
            //Check for returned requests
            if (boolReqReturned == true || boolReqDenied == true)
            {
                int intReturned = 0;
                Int32.TryParse(lblReturned.Text, out intReturned);
                ResourceRequest oResourceRequest = new ResourceRequest(0, dsn);
                DataSet         dsResource       = oResourceRequest.GetAllService(intRequest, intReturned, Int32.Parse(lblNumber.Text));
                if (dsResource.Tables[0].Rows.Count > 0)
                {
                    int     intResource = Int32.Parse(dsResource.Tables[0].Rows[0]["rrid"].ToString());
                    DataSet dsRR        = oResourceRequest.Get(intResource);
                    Users   oUser       = new Users(0, dsn);
                    if (dsRR.Tables[0].Rows.Count > 0)
                    {
                        if (dsRR.Tables[0].Rows[0]["status"].ToString() == "-1")
                        {
                            // Request Denied
                            lblReqDenyCommentValue.Text = dsRR.Tables[0].Rows[0]["reason"].ToString();
                            if (lblReqDenyCommentValue.Text == "")
                            {
                                int intApproved = 0;
                                // Try getting from service approval.
                                DataSet dsSelected2 = oService.GetSelected(intRequest, intReturned, Int32.Parse(lblNumber.Text));
                                for (int ii = Int32.Parse(lblNumber.Text); ii > 0 && dsSelected2.Tables[0].Rows.Count == 0; ii--)
                                {
                                    dsSelected2 = oService.GetSelected(intRequest, intReturned, ii - 1);
                                }
                                if (dsSelected2.Tables[0].Rows.Count > 0)
                                {
                                    intApproved = Int32.Parse(dsSelected2.Tables[0].Rows[0]["approved"].ToString());
                                }
                                if (intApproved < 0)
                                {
                                    lblReqDenyCommentValue.Text = dsSelected2.Tables[0].Rows[0]["reason"].ToString();
                                }
                            }
                            pnlReqDenied.Visible = true;
                        }
                        else if (dsRR.Tables[0].Rows[0]["status"].ToString() == "7")
                        {
                            DataSet dsRRReturn = oResourceRequest.getResourceRequestReturn(intResource, intReturned, Int32.Parse(lblNumber.Text), 0, 0);
                            if (dsRRReturn.Tables[0].Rows.Count > 0)
                            {
                                lblReqReturnedId.Text         = dsRRReturn.Tables[0].Rows[0]["Id"].ToString();
                                lblReqReturnCommentValue.Text = oFunction.FormatText(dsRRReturn.Tables[0].Rows[0]["Comments"].ToString());
                                lblReqReturnedByValue.Text    = oUser.GetName(Int32.Parse(dsRRReturn.Tables[0].Rows[0]["ReturnedByUser"].ToString()));
                                lblReqReturnedByValue.Text    = oUser.GetFullName(Int32.Parse(dsRRReturn.Tables[0].Rows[0]["ReturnedByUser"].ToString()));
                                pnlReqReturn.Visible          = true;
                            }
                            DataSet dsRRReturn2 = oResourceRequest.getResourceRequestReturn(intResource, intReturned, Int32.Parse(lblNumber.Text), 1, 0);
                            if (dsRRReturn2.Tables[0].Rows.Count > 0)
                            {
                                lblReqReturnedId2.Text         = dsRRReturn2.Tables[0].Rows[0]["Id"].ToString();
                                lblReqReturnCommentValue2.Text = oFunction.FormatText(dsRRReturn2.Tables[0].Rows[0]["Comments"].ToString());
                                lblReqReturnedByValue2.Text    = oUser.GetName(Int32.Parse(dsRRReturn2.Tables[0].Rows[0]["ReturnedByUser"].ToString()));
                                lblReqReturnedByValue2.Text    = oUser.GetFullName(Int32.Parse(dsRRReturn2.Tables[0].Rows[0]["ReturnedByUser"].ToString()));
                                pnlReqReturn2.Visible          = true;
                            }
                        }
                        else
                        {
                            pnlReqReturn.Visible  = false;
                            pnlReqReturn2.Visible = false;
                        }
                    }
                }
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oProject         = new Projects(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oUser            = new Users(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oRequestField    = new RequestFields(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oServiceDetail   = new ServiceDetails(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            oDocument        = new Documents(intProfile, dsn);
            oLog             = new Log(intProfile, dsn);
            oServiceEditor   = new ServiceEditor(intProfile, dsnServiceEditor);
            oVariable        = new Variables(intEnvironment);
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
            {
                // Start Workflow Change
                lblResourceWorkflow.Text = Request.QueryString["rrid"];
                int intResourceWorkflow = Int32.Parse(Request.QueryString["rrid"]);
                int intResourceParent   = oResourceRequest.GetWorkflowParent(intResourceWorkflow);
                ds = oResourceRequest.Get(intResourceParent);
                // End Workflow Change
                intRequest          = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                lblRequestedBy.Text = oUser.GetFullName(oRequest.GetUser(intRequest));
                lblRequestedOn.Text = DateTime.Parse(oResourceRequest.Get(intResourceParent, "created")).ToString();
                lblDescription.Text = oRequest.Get(intRequest, "description");
                if (lblDescription.Text == "")
                {
                    lblDescription.Text = "<i>No information</i>";
                }
                intItem   = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                intNumber = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                int intStatus = 0;
                Int32.TryParse(oResourceRequest.GetWorkflow(intResourceWorkflow, "status"), out intStatus);
                // Start Workflow Change
                bool boolComplete = (oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == "3");
                int  intUser      = Int32.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "userid"));
                txtCustom.Text = oResourceRequest.GetWorkflow(intResourceWorkflow, "name");
                double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated"));
                boolJoined = (oResourceRequest.GetWorkflow(intResourceWorkflow, "joined") == "1");
                // End Workflow Change
                intService      = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                lblService.Text = oService.Get(intService, "name");
                int intApp = oRequestItem.GetItemApplication(intItem);

                //Check if this service returned
                bool    boolReturned = false;
                DataSet dsRR         = oResourceRequest.GetRequestService(intRequest, intService, intNumber);
                if (dsRR.Tables[0].Rows.Count > 0)
                {
                    int     intRRId    = Int32.Parse(dsRR.Tables[0].Rows[0]["parent"].ToString());
                    DataSet dsRRReturn = oResourceRequest.getResourceRequestReturn(intRRId, intService, intNumber, 1, 0);
                    if (dsRRReturn.Tables[0].Rows.Count > 0)
                    {
                        boolReturned                  = true;
                        lblReqReturnedId.Text         = dsRRReturn.Tables[0].Rows[0]["Id"].ToString();
                        lblReqReturnCommentValue.Text = oFunction.FormatText(dsRRReturn.Tables[0].Rows[0]["Comments"].ToString());
                        lblReqReturnedByValue.Text    = oUser.GetName(Int32.Parse(dsRRReturn.Tables[0].Rows[0]["ReturnedByUser"].ToString()));
                        lblReqReturnedByValue.Text    = oUser.GetFullName(Int32.Parse(dsRRReturn.Tables[0].Rows[0]["ReturnedByUser"].ToString()));
                        pnlReqReturn.Visible          = true;
                        boolServiceReturned           = true;
                    }
                    else
                    {
                        pnlReqReturn.Visible = false;
                    }
                }

                if (!IsPostBack)
                {
                    if (Request.QueryString["save"] != null && Request.QueryString["save"] != "")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "saved", "<script type=\"text/javascript\">alert('Information Saved Successfully');<" + "/" + "script>");
                    }
                    if (Request.QueryString["require"] != null && Request.QueryString["require"] != "")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "required", "<script type=\"text/javascript\">alert('Information Saved Successfully\\n\\nHowever, one or more required fields were skipped.\\nUpdate these fields and you will be able to complete this request." + (string.IsNullOrEmpty(Request.QueryString["required"]) ? "" : "\\n\\n - " + oFunction.decryptQueryString(Request.QueryString["required"])) + "');<" + "/" + "script>");
                    }
                    if (Request.QueryString["status"] != null && Request.QueryString["status"] != "")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "statusd", "<script type=\"text/javascript\">alert('Status Update has been Added');<" + "/" + "script>");
                    }

                    DataSet dsServiceEditor = oServiceEditor.GetRequestData(intRequest, intService, intNumber, 1, dsn);
                    strForm = oServiceEditor.LoadForm(intRequest, intService, intNumber, true, false, "", intEnvironment, dsServiceEditor, dsn);

                    string strRequired = oServiceEditor.GetRequired();
                    double dblUsed     = oResourceRequest.GetWorkflowUsed(intResourceWorkflow);
                    lblUpdated.Text = oResourceRequest.GetUpdated(intResourceParent);
                    if (dblAllocated == dblUsed)
                    {
                        if (boolComplete == false)
                        {
                            oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete");
                            btnComplete.Attributes.Add("onclick", "return true " + strRequired + " && confirm('Are you sure you want to mark this as completed and remove it from your workload?') && ProcessControlButton();");
                        }
                        else
                        {
                            btnSave.ImageUrl   = "/images/tool_save_dbl.gif";
                            btnSave.Enabled    = false;
                            btnReturn.ImageUrl = "/images/tool_return_dbl.gif";
                            btnReturn.Enabled  = false;
                            oFunction.ConfigureToolButton(btnComplete, "/images/tool_complete");
                            btnComplete.Attributes.Add("onclick", "alert('This task has already been marked COMPLETE. You can close this window.');return false;");
                        }
                    }
                    else
                    {
                        btnComplete.ImageUrl = "/images/tool_complete_dbl.gif";
                        btnComplete.Enabled  = false;
                    }
                    bool boolSLABreached = false;
                    if (oService.Get(intService, "sla") != "")
                    {
                        oFunction.ConfigureToolButton(btnSLA, "/images/tool_sla");
                        int intDays = oResourceRequest.GetSLA(intResourceParent);
                        if (intDays > -99999)
                        {
                            if (boolReturned == false)
                            {
                                if (intDays < 1)
                                {
                                    btnSLA.Style["border"] = "solid 2px #FF0000";
                                }
                                else if (intDays < 3)
                                {
                                    btnSLA.Style["border"] = "solid 2px #FF9999";
                                }
                            }
                            boolSLABreached = (intDays < 0);
                            btnSLA.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_SLA','?rrid=" + intResourceParent.ToString() + "');");
                        }
                        else
                        {
                            btnSLA.ImageUrl = "/images/tool_sla_dbl.gif";
                            btnSLA.Enabled  = false;
                        }
                    }
                    else
                    {
                        btnSLA.ImageUrl = "/images/tool_sla_dbl.gif";
                        btnSLA.Enabled  = false;
                    }
                    oFunction.ConfigureToolButton(btnEmail, "/images/tool_email");
                    btnEmail.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_EMAIL','?rrid=" + intResourceWorkflow.ToString() + "&type=GENERIC');");
                    dblUsed       = (dblUsed / dblAllocated) * 100;
                    strCheckboxes = oServiceDetail.LoadCheckboxes(intRequest, intItem, intNumber, intResourceWorkflow, intService);
                    if (strForm != "")
                    {
                        panForm.Visible = true;
                    }
                    if (oService.Get(intService, "tasks") != "1" || strCheckboxes == "")
                    {
                        if (oService.Get(intService, "no_slider") == "1")
                        {
                            panNoSlider.Visible  = true;
                            btnComplete.ImageUrl = "/images/tool_complete.gif";
                            btnComplete.Enabled  = true;
                            btnComplete.Attributes.Add("onclick", "return true " + strRequired + " && confirm('Are you sure you want to mark this as completed and remove it from your workload?') && ProcessControlButton();");
                            btnComplete.CommandArgument = "FAST";
                        }
                        else
                        {
                            panSlider.Visible      = true;
                            sldHours._StartPercent = dblUsed.ToString();
                            sldHours._TotalHours   = dblAllocated.ToString();
                        }
                    }
                    else
                    {
                        panCheckboxes.Visible = true;
                    }
                    intProject          = oRequest.GetProjectNumber(intRequest);
                    hdnTab.Value        = "D";
                    panWorkload.Visible = true;
                    bool boolRed = LoadStatus(intResourceWorkflow);
                    if (boolRed == false && boolSLABreached == true && boolReturned == false)
                    {
                        btnComplete.Attributes.Add("onclick", "alert('NOTE: Your Service Level Agreement (SLA) has been breached!\\n\\nYou must provide a RED STATUS update with an explanation of why your SLA was breached for this request.\\n\\nOnce a RED STATUS update has been provided, you will be able to complete this request.');return false;");
                    }
                    LoadChange(intResourceWorkflow);
                    LoadInformation(intResourceWorkflow);
                    chkDescription.Checked = (Request.QueryString["doc"] != null);
                    lblDocuments.Text      = oDocument.GetDocuments_Service(intRequest, intService, oVariable.DocumentsFolder(), 1, (Request.QueryString["doc"] != null));
                    // GetDocuments(string _physical, int _projectid, int _requestid, int _userid, int _security, bool _show_description, bool _mine)
                    //lblDocuments.Text = oDocument.GetDocuments(Request.PhysicalApplicationPath, 0, intRequest, 0, 1, (Request.QueryString["doc"] != null), false);

                    btnDenied.Attributes.Add("onclick", "return CloseWindow();");
                    oFunction.ConfigureToolButton(btnSave, "/images/tool_save");
                    oFunction.ConfigureToolButton(btnPrint, "/images/tool_print");
                    btnPrint.Attributes.Add("onclick", "return PrintWindow();");
                    oFunction.ConfigureToolButton(btnClose, "/images/tool_close");
                    btnClose.Attributes.Add("onclick", "return ExitWindow();");
                    //btnSave.Attributes.Add("onclick", "return ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "') && ProcessControlButton();");
                    btnSave.Attributes.Add("onclick", "return ProcessControlButton();");
                    btnStatus.Attributes.Add("onclick", "return ValidateStatus('" + ddlStatus.ClientID + "','" + txtComments.ClientID + "')" +
                                             " && ProcessControlButton()" +
                                             ";");
                    btnChange.Attributes.Add("onclick", "return ValidateText('" + txtNumber.ClientID + "','Please enter a change control number')" +
                                             " && ValidateDate('" + txtDate.ClientID + "','Please enter a valid implementation date')" +
                                             " && ValidateTime('" + txtTime.ClientID + "','Please enter a valid implementation time')" +
                                             " && ProcessControlButton()" +
                                             ";");
                    imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');");
                    // 6/1/2009 - Load ReadOnly View
                    if (oResourceRequest.CanUpdate(intProfile, intResourceWorkflow, false) == false)
                    {
                        oFunction.ConfigureToolButtonRO(btnSave, btnComplete);
                        //panDenied.Visible = true;
                    }

                    if (oService.Get(intService, "rr_path") == "/controls/rr/rr_service_editor.ascx" && oService.Get(intService, "disable_customization") == "0")
                    {
                        if (intStatus != (int)ResourceRequestStatus.AwaitingResponse) //Awaiting Client Response
                        {
                            btnReturn.Visible = true;
                            oFunction.ConfigureToolButton(btnReturn, "/images/tool_return");
                            btnReturn.Attributes.Add("onclick", "return OpenWindow('RESOURCE_REQUEST_RETURN','?rrid=" + intResourceParent.ToString() + "&rrwfid=" + intResourceWorkflow.ToString() + "');");
                        }
                        else
                        {
                            btnReturn.Visible = true;
                            oFunction.ConfigureToolButton(btnReturn, "/images/tool_return");
                            btnReturn.Attributes.Add("onclick", "alert('This request has already been returned');return false;");
                        }
                    }
                    else
                    {
                        btnReturn.Visible = false;
                    }
                }
            }
            else
            {
                panDenied.Visible = true;
            }
        }