예제 #1
0
        private void CompletedWorkflow()
        {
            int intResourceWorkflow = Int32.Parse(lblResourceWorkflow.Text);
            int intResourceParent   = oResourceRequest.GetWorkflowParent(intResourceWorkflow);

            double dblAllocated = double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated"));

            oResourceRequest.UpdateWorkflowHoursOverwrite(intResourceWorkflow, dblAllocated);

            // Add a green / completed status if there are no updates, OR the last status is not green
            DataSet dsStatus = oResourceRequest.GetStatuss(intResourceWorkflow);

            if (dsStatus.Tables[0].Rows.Count == 0 || dsStatus.Tables[0].Rows[0]["status"].ToString() != "3")
            {
                oResourceRequest.AddStatus(intResourceWorkflow, 3, "Completed", intProfile);
            }
            oResourceRequest.UpdateWorkflowStatus(intResourceWorkflow, 3, true);
            oResourceRequest.CloseWorkflow(intResourceWorkflow, intEnvironment, 0, dsnServiceEditor, true, intResourceRequestApprove, intAssignPage, intViewPage, dsnAsset, dsnIP);

            //update Procurement Details Initiate new Services or Complete Request
            UpdateProcurementDetails();

            //Asset Order => Initiate New Service Or Complete Request
            oAssetOrder.InitiateNextServiceRequestOrCompleteRequest(Int32.Parse(hdnOrderId.Value), intNumber, intService, false, dsnServiceEditor, intAssignPage, intViewPage, dsnAsset, dsnIP);

            //If this service was returned then update the status of next service
            if (boolServiceReturned == true)
            {
                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)
                    {
                        int intNextRRId      = Int32.Parse(dsRRReturn.Tables[0].Rows[0]["NextRRId"].ToString());
                        int intNextServiceId = Int32.Parse(dsRRReturn.Tables[0].Rows[0]["NextServiceId"].ToString());
                        int intNextNumber    = Int32.Parse(dsRRReturn.Tables[0].Rows[0]["NextNumber"].ToString());;


                        oResourceRequest.UpdateStatusRequest(intNextRRId, 2);
                        DataSet dsRRWF = oResourceRequest.GetWorkflowsParent(intNextRRId);
                        foreach (DataRow dr in dsRRWF.Tables[0].Rows)
                        {
                            int intRRWFId = Int32.Parse(dr["id"].ToString());
                            oResourceRequest.UpdateWorkflowStatus(intRRWFId, 2, true);
                        }
                    }
                }
                oResourceRequest.updateResourceRequestReturnCompleted(Int32.Parse(lblReqReturnedId.Text));
            }
            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "reload", "<script type=\"text/javascript\">RefreshOpeningWindow();window.close();<" + "/" + "script>");
        }
예제 #2
0
        protected void SaveRequest(int intStatus)
        {
            //Set Default Values For Request , Item , Number
            int    intServiceId   = 0;
            string strServerTitle = "";

            if (hdnRequestId.Value == "")
            {
                hdnRequestId.Value = "0";
            }
            if (hdnItemId.Value == "")
            {
                hdnItemId.Value = "0";
            }
            if (hdnNumber.Value == "")
            {
                hdnNumber.Value = "0";
            }



            if (Int32.Parse(rblOrderType.SelectedValue) == (int)AssetOrderType.Dispose)
            {
                hdnRackId.Value              = "0";
                ddlEnclosure.SelectedValue   = "0";
                txtEnclosureSlot.Text        = "0";
                ddlClass.SelectedValue       = "0";
                ddlEnvironment.SelectedValue = "0";
                hdnEnvironment.Value         = "0";
            }


            if (intStatus == (int)AssestOrderReqStatus.Active)
            {
                //Create new request
                int intRequest = oRequest.AddTask(0, intProfile, txtDescription.Text, DateTime.Now, DateTime.Now);
                hdnRequestId.Value = intRequest.ToString();
            }

            //Add / Update Order Request
            if (hdnOrderId.Value == "")
            {
                int intOrderId = oAssetOrder.AddOrderId(intProfile);
                hdnOrderId.Value = intOrderId.ToString();

                oAssetOrder.AddOrder(Int32.Parse(hdnOrderId.Value),
                                     Int32.Parse(hdnRequestId.Value), Int32.Parse(hdnItemId.Value), Int32.Parse(hdnNumber.Value),
                                     Int32.Parse(rblOrderType.SelectedValue),
                                     txtDescription.Text.Trim(),
                                     Int32.Parse(ddlModel.SelectedValue),
                                     0,
                                     0,
                                     (hdnAssetCategoryId.Value == "4"?Int32.Parse(hdnZoneId.Value):0),
                                     (hdnAssetCategoryId.Value != "4" ? Int32.Parse(hdnRackId.Value) : 0),
                                     txtRackPos.Text, Int32.Parse(ddlResiliency.SelectedItem.Value), Int32.Parse(ddlOperatingSystemGroup.SelectedItem.Value),
                                     Int32.Parse(ddlClass.SelectedValue),
                                     Int32.Parse((hdnEnvironment.Value != "" ? hdnEnvironment.Value : "0")),
                                     Int32.Parse(ddlEnclosure.SelectedValue),
                                     (txtEnclosureSlot.Text.Trim() != "" ? Int32.Parse(txtEnclosureSlot.Text.Trim()) : 0),
                                     Int32.Parse(txtQuantity.Text.Trim()),
                                     (rblOrderType.SelectedValue == "1" ? Int32.Parse(txtQuantity.Text.Trim()) : 0),
                                     (rblOrderType.SelectedValue == "2" ? Int32.Parse(txtQuantity.Text.Trim()) : 0), 0,
                                     DateTime.Parse(txtRequestedByDate.Text.Trim()), (chkClustered.Checked ? 1 : 0),
                                     (chkSanAttached.Checked ? 1 : 0), (chkBootLuns.Checked ? 1 : 0), Int32.Parse(ddlSwitch1.SelectedItem.Value),
                                     txtPort1.Text, Int32.Parse(ddlSwitch2.SelectedItem.Value), txtPort2.Text, intStatus, intProfile);
            }
            else
            {
                if (intStatus == (int)AssestOrderReqStatus.UpdateOnly)
                {
                    // Get old status
                    intStatus = Int32.Parse(btnUpdate.CommandArgument);
                }
                oAssetOrder.UpdateOrder(Int32.Parse(hdnOrderId.Value),
                                        Int32.Parse(hdnRequestId.Value), Int32.Parse(hdnItemId.Value), Int32.Parse(hdnNumber.Value),
                                        Int32.Parse(rblOrderType.SelectedValue),
                                        txtDescription.Text.Trim(),
                                        Int32.Parse(ddlModel.SelectedValue),
                                        0, 0,
                                        (hdnAssetCategoryId.Value == "4" ? Int32.Parse(hdnZoneId.Value) : 0),
                                        (hdnAssetCategoryId.Value != "4" ? Int32.Parse(hdnRackId.Value) : 0),
                                        txtRackPos.Text, Int32.Parse(ddlResiliency.SelectedItem.Value), Int32.Parse(ddlOperatingSystemGroup.SelectedItem.Value),
                                        Int32.Parse(ddlClass.SelectedValue),
                                        Int32.Parse((hdnEnvironment.Value != "" ? hdnEnvironment.Value : "0")),
                                        Int32.Parse(ddlEnclosure.SelectedValue),
                                        (txtEnclosureSlot.Text.Trim() != "" ? Int32.Parse(txtEnclosureSlot.Text.Trim()) : 0),
                                        Int32.Parse(txtQuantity.Text.Trim()),
                                        (rblOrderType.SelectedValue == "1" ? Int32.Parse(txtQuantity.Text.Trim()) : 0),
                                        (rblOrderType.SelectedValue == "2" ? Int32.Parse(txtQuantity.Text.Trim()) : 0), 0,
                                        DateTime.Parse(txtRequestedByDate.Text.Trim()), (chkClustered.Checked ? 1 : 0),
                                        (chkSanAttached.Checked ? 1 : 0), (chkBootLuns.Checked ? 1 : 0), Int32.Parse(ddlSwitch1.SelectedItem.Value),
                                        txtPort1.Text, Int32.Parse(ddlSwitch2.SelectedItem.Value), txtPort2.Text, intStatus, intProfile);
            }

            //Added or deleted the assets to cv_asset_order_asset selection
            SaveAssetSelection(intStatus);

            //Add Commetns
            SaveReqComment();

            /* While finally submitting the request -
             * 1. For selected assets set  NewOrderId=RequestID
             * 2. If it's Re-Deployment clear the asset configuration
             * 3. If it's Asset Movement set Asset Attribute =Moving
             *
             */
            if (intStatus == (int)AssestOrderReqStatus.Active)
            {
                oAssetOrder.InitiateNextServiceRequestOrCompleteRequest(Int32.Parse(hdnOrderId.Value), 0, 0, true, dsnServiceEditor, intAssignPage, intViewPage, dsnAsset, dsnIP);
            }
        }