Beispiel #1
0
        protected void btnSave_Click(Object Sender, EventArgs e)
        {
            int intResourceWorkflow = Int32.Parse(lblResourceWorkflow.Text);
            int intResourceParent   = oResourceRequest.GetWorkflowParent(intResourceWorkflow);

            //if (ddlStatus.SelectedIndex > -1 && txtComments.Text.Trim() != "")
            //{
            //    oResourceRequest.AddStatus(intResourceWorkflow, Int32.Parse(ddlStatus.SelectedItem.Value), txtComments.Text);

            //    //CVT62149 Workload Manager Red Light Status =Hold
            //    if (ddlStatus.SelectedValue == "1") //Red
            //        oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 5, true);
            //    else
            //        oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 2, true);
            //}

            if (oResourceRequest.Get(intResourceParent, "status") == ((int)ResourceRequestStatus.Closed).ToString() ||
                oResourceRequest.GetWorkflow(intResourceWorkflow, "status") == ((int)ResourceRequestStatus.Closed).ToString())
            {
                // already completed - nothing to do except close the window.
            }
            else
            {
                if (panNoSlider.Visible == false)
                {
                    double dblHours = 0.00;
                    if (panSlider.Visible == true)
                    {
                        if (Request.Form["hdnHours"] != null && Request.Form["hdnHours"] != "")
                        {
                            dblHours = double.Parse(Request.Form["hdnHours"]);
                        }
                        double dblUsed = oResourceRequest.GetWorkflowUsed(intResourceWorkflow);
                        dblHours = (dblHours - dblUsed);
                        if (dblHours > 0.00)
                        {
                            oResourceRequest.UpdateWorkflowHours(intResourceWorkflow, dblHours);
                        }
                    }
                    else
                    {
                        oServiceDetail.UpdateCheckboxes(Request, intResourceWorkflow, intRequest, intItem, intNumber);
                        double dblAllocated = oResourceRequest.GetDetailsHoursUsed(intRequest, intItem, intNumber, intResourceWorkflow, false);
                        oResourceRequest.UpdateWorkflowAllocated(intResourceWorkflow, dblAllocated);
                    }
                }
                if (panForm.Visible == true)
                {
                    oServiceEditor.SaveForm(Request, intRequest, intService, intNumber, true, intEnvironment, dsn);
                }
                oResourceRequest.UpdateWorkflowName(intResourceWorkflow, txtCustom.Text, intProfile);
            }
            Response.Redirect(Request.Path + "?rrid=" + intResourceWorkflow.ToString() + "&div=E&save=true");
        }
Beispiel #2
0
        private void Save(int intRequest)
        {
            int intItem    = Int32.Parse(lblItem.Text);
            int intNumber  = Int32.Parse(lblNumber.Text);
            int intService = Int32.Parse(lblService.Text);
            int intProject = oRequest.GetProjectNumber(intRequest);

            //if (intProject == -1)
            //    oServiceRequest.Update(intRequest, txtTitle.Text);
            oServiceEditor.AddRequest(intRequest, intService, intNumber, txtTitle.Text, Int32.Parse(radPriority.SelectedItem.Value), txtStatement.Text, DateTime.Now, DateTime.Now, (radExpediteYes.Checked ? 1 : 0));
            oServiceEditor.SaveForm(Request, intRequest, intService, intNumber, false, intEnvironment, dsn);

            //Reset the Resource Request and Workflow status for returned requests
            if (boolReqReturned == true)
            {
                int intReturned = 0;
                Int32.TryParse(lblReturned.Text, out intReturned);
                ResourceRequest oResourceRequest = new ResourceRequest(0, dsn);
                DataSet         dsRR             = oResourceRequest.GetRequestService(intRequest, intReturned, Int32.Parse(lblNumber.Text));
                if (dsRR.Tables[0].Rows.Count > 0)
                {
                    int intRRId = Int32.Parse(dsRR.Tables[0].Rows[0]["parent"].ToString());
                    oResourceRequest.updateResourceRequestReturnCompleted(Int32.Parse(lblReqReturnedId.Text));
                    DataSet dsRRWF = oResourceRequest.GetWorkflowsParent(intRRId);
                    oResourceRequest.UpdateStatusRequest(intRRId, 2);
                    foreach (DataRow dr in dsRRWF.Tables[0].Rows)
                    {
                        int intRRWFId = Int32.Parse(dr["id"].ToString());
                        oResourceRequest.UpdateWorkflowStatus(intRRWFId, 2, true);
                    }
                }
            }
            //Reset the Resource Request and approval process for denied requests
            if (boolReqDenied == true)
            {
                ResourceRequest oResourceRequest = new ResourceRequest(0, dsn);
                DataSet         dsResource       = oResourceRequest.GetAllService(intRequest, intService, 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);
                    if (dsRR.Tables[0].Rows.Count > 0)
                    {
                        oResourceRequest.UpdateStatusOverall(intResource, 2);
                        oService.UpdateSelectedApprove(intRequest, intService, Int32.Parse(lblNumber.Text), 0, 0, DateTime.Now, "");
                        if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false)
                        {
                            oServiceRequest.NotifyTeamLead(intItem, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0);
                        }
                    }
                }
            }
        }