private void InitializeWorkQueueItem(Object sender, Server.Application.WorkQueueItemGetCompletedEventArgs e) { GlobalProgressBarHide(); if ((!SetExceptionMessage(e)) && (!SetExceptionMessage(e.Result, "Work Queue Item"))) { workQueueItem = new Mercury.Client.Core.Work.WorkQueueItem(MercuryApplication, e.Result); InitializeAll(); } return; }
private void InitializeEntityInformationFromWorkQueueItem(Int64 workQueueItemId) { Client.Core.Work.WorkQueueItem workQueueItem = MercuryApplication.WorkQueueItemGet(WorkflowResponse.WorkQueueItemId); if (workQueueItem == null) { return; } switch (workQueueItem.ItemObjectType) { case "Member": InitializeMemberInformation(workQueueItem.ItemObjectId); break; } return; }
protected void Page_Load(object sender, EventArgs e) { Int64 workQueueItemId = 0; if (MercuryApplication == null) { return; } if (!Page.IsPostBack) { #region Initial Page Load if (Request.QueryString["WorkQueueItemId"] != null) { workQueueItemId = Int64.Parse(Request.QueryString["WorkQueueItemId"]); } workQueueItem = MercuryApplication.WorkQueueItemGet(workQueueItemId); if (workQueueItem == null) { Response.Redirect("/PermissionDenied.aspx", true); return; } InitializeAll(); #endregion } // Initial Page Load else // Postback { } return; }
protected void WorkQueueItemAssignWindow_ButtonOk_OnClick(Object sender, EventArgs e) { if (MercuryApplication == null) { return; } Boolean success = false; String responseScript = "$find(\"" + WorkQueueItemAssignWindow.ClientID + "\").close ();"; String postScript = String.Empty; Int64 workQueueItemId = 0; // RE-ASSIGN WORK QUEUE ITEM if (Int64.TryParse(WorkQueueItemAssignId.Text, out workQueueItemId)) { Int64 assignedToWorkQueueId = Int64.Parse(WorkQueueItemAssignWorkQueueSelection.SelectedValue); Int64 assignedToSecurityAuthorityId = Int64.Parse(WorkQueueItemAssignUserSelection.SelectedValue.Split('|')[0]); String assignedToUserAccountId = WorkQueueItemAssignUserSelection.SelectedValue.Split('|')[1]; String assignedToUserAccountName = WorkQueueItemAssignUserSelection.SelectedValue.Split('|')[2]; String assignedToUserDisplayName = (WorkQueueItemAssignUserSelection.Text.Split(':').Length >= 2) ? WorkQueueItemAssignUserSelection.Text.Split(':')[1] : String.Empty; Client.Core.Work.WorkQueueItem workQueueItem = MercuryApplication.WorkQueueItemGet(workQueueItemId); if (assignedToWorkQueueId != workQueueItem.WorkQueueId) { success = workQueueItem.MoveToQueue(assignedToWorkQueueId); if (!success) { postScript = ("alert (\"" + MercuryApplication.LastException.Message.Replace("\"", "\\") + "\");"); } } else { success = true; } if (success) { success = workQueueItem.AssignTo(assignedToSecurityAuthorityId, assignedToUserAccountId, assignedToUserAccountName, assignedToUserDisplayName, "Work Queue Management - Direct Assignment"); } } else { responseScript += "alert('Unable to parse the Work Queue Item Id.');"; } // REBIND DATE GRID WorkQueueItemsGrid.DataSource = null; WorkQueueItemsGrid.Rebind(); // CLIENT-SIDE CLOSE DIALOG WINDOW Master.TelerikAjaxManagerControl.ResponseScripts.Add(responseScript + postScript); return; }
protected void MemberWorkHistoryGrid_OnItemDataBound(Object sender, Telerik.Web.UI.GridItemEventArgs eventArgs) { String anchorText; String parameterString = String.Empty; if (eventArgs.Item is Telerik.Web.UI.GridDataItem) { Telerik.Web.UI.GridDataItem gridItem = (Telerik.Web.UI.GridDataItem)eventArgs.Item; if (gridItem.OwnerTableView.Name != "MemberWorkHistoryMasterView") { return; } Client.Core.Work.WorkQueueItem workQueueItem = null; Int64 workQueueItemId = Convert.ToInt64(gridItem["WorkQueueItemId"].Text); foreach (Client.Core.Work.WorkQueueItem currentWorkQueueItem in WorkQueueItems) { if (currentWorkQueueItem.Id == workQueueItemId) { workQueueItem = currentWorkQueueItem; break; } } if (workQueueItem == null) { workQueueItem = MercuryApplication.WorkQueueItemGet(workQueueItemId); } String statusImage = String.Empty; if (!workQueueItem.CompletionDate.HasValue) { if (workQueueItem.MilestoneDate <= DateTime.Today) { statusImage = "Warn.png"; } if (workQueueItem.ThresholdDate <= DateTime.Today) { statusImage = "Warn.png"; } if (workQueueItem.DueDate <= DateTime.Today) { statusImage = "Stop.png"; } } else { statusImage = "Ok.png"; } if (!String.IsNullOrEmpty(statusImage)) { statusImage = "/Images/Common16/" + statusImage; anchorText = "<img src=\"" + statusImage + "\" alt=\"Status\" style=\"padding: 2px;\" />"; gridItem["WorkQueueItemStatus"].Text = anchorText; } Client.Core.Work.WorkQueue workQueue = MercuryApplication.WorkQueueGet(Convert.ToInt64(gridItem["WorkQueueId"].Text), true); if (workQueue == null) { workQueue = MercuryApplication.WorkQueueGet(Convert.ToInt64(gridItem["WorkQueueId"].Text), false); } if (workQueue != null) { // DETAILS COLUMN if (AllowUserInteraction) { parameterString = " <a href=\"/Application/Work/WorkQueueItemDetail.aspx?WorkQueueItemId=" + workQueueItem.Id.ToString() + "\" target=\"_blank\">(details)</a>"; gridItem["WorkQueueItemStatus"].Text = gridItem["WorkQueueItemStatus"].Text + parameterString; } // ACTION COLUMN if ((workQueueItem != null) && (AllowUserInteraction)) { #region Assign/Work To Column anchorText = gridItem["AssignedTo"].Text; if ((!workQueueItem.CompletionDate.HasValue) && (workQueueItem.WorkQueue.WorkflowId != 0)) { // SELF-ASSIGN (IF NO MANAGE PERMISSION) //if ((workQueue.HasSelfAssignPermission) && !((workQueueItem.AssignedToSecurityAuthorityId == MercuryApplication.Session.AuthorityId) && (workQueueItem.AssignedToUserAccountId == MercuryApplication.Session.UserAccountId))) { if ((workQueue.WorkflowId != 0) && ((MercuryApplication.SessionWorkQueueHasSelfAssignPermission(workQueue.Id)) || (MercuryApplication.SessionWorkQueueHasManagePermission(workQueue.Id))) || ((workQueueItem.AssignedToSecurityAuthorityId == MercuryApplication.Session.SecurityAuthorityId) && (workQueueItem.AssignedToUserAccountId == MercuryApplication.Session.UserAccountId))) { parameterString = String.Empty; parameterString = parameterString + "/Application/Workflow/Workflow.aspx"; if (workQueueItem.WorkflowInstanceId == Guid.Empty) { parameterString = parameterString + "?WorkflowId=" + workQueue.WorkflowId.ToString(); parameterString = parameterString + "&WorkQueueItemId=" + workQueueItem.Id.ToString(); parameterString = parameterString + "&" + workQueueItem.ItemObjectType + "Id=" + workQueueItem.ItemObjectId.ToString(); parameterString = parameterString + "&Source=MemberProfile"; anchorText = anchorText + " <a href=\"" + parameterString + "\">(work)</a>"; } else { parameterString = parameterString + "?WorkflowId=" + workQueue.WorkflowId.ToString(); parameterString = parameterString + "&WorkflowInstanceId=" + workQueueItem.WorkflowInstanceId.ToString(); parameterString = parameterString + "&Source=MemberProfile"; anchorText = anchorText + " <a href=\"" + parameterString + "\">(work - resume)</a>"; } } // // RELEASE ASSIGNMENT (EITHER SELF ASSIGNED OR MANAGE) // else if (!(workQueue.HasManagePermission) && ((workQueueItem.AssignedToSecurityAuthorityId == MercuryApplication.Session.AuthorityId) && (workQueueItem.AssignedToUserAccountId == MercuryApplication.Session.UserAccountId))) { // parameterString = String.Empty; // parameterString = parameterString + workQueueItem.WorkQueueItemId.ToString () + ", "; // WORK QUEUE ITEM ID // parameterString = parameterString + "'" + anchorText.Replace ("'", "''") + "', "; // CURRENT ASSIGNMENT // parameterString = parameterString + "'0', "; // SECURITY AUTHORITY ID // parameterString = parameterString + "'', "; // USER ACCOUNT ID // parameterString = parameterString + "'** Not Assigned'"; // USER ACCOUNT ID // anchorText = anchorText + " <a href=\"javascript:MyWorkQueues_WorkQueueItem_OnAssignItem_" + WorkQueueAction_WorkQueueItemId.ClientID.Replace ('.', '_') + " (" + parameterString + ")\">(release)</a>"; // } // // CHANGE ASSIGNMENT (MANAGE) // else if (workQueue.HasManagePermission) { // parameterString = String.Empty; // parameterString = parameterString + workQueueItem.WorkQueueItemId.ToString () + ", "; // WORK QUEUE ITEM ID // parameterString = parameterString + "'" + workQueueItem.ObjectType + ": " + workQueueItem.ItemDescription.Replace ("'", "''") + "', "; // parameterString = parameterString + "'" + workQueueItem.AssignedToSecurityAuthorityId.ToString () + "|" + workQueueItem.AssignedToUserAccountId + "'"; // anchorText = anchorText + " <a href=\"javascript:MyWorkQueues_WorkQueueItem_OnChangeAssignment_" + WorkQueueAction_WorkQueueItemId.ClientID.Replace ('.', '_') + " (" + parameterString + ")\">(change)</a>"; // } gridItem["AssignedTo"].Text = anchorText; } #endregion #region Completed Workflow Steps Column String completedAnchor = gridItem["CompletionDate"].Text; if (workQueueItem.CompletionDate.HasValue) { } gridItem["CompletionDate"].Text = completedAnchor; #endregion } } } return; }
private void InitialPageLoadInitialization() { // SAVE REFERRER SO THAT THE APPLICATION CAN RETURN TO IT AFTER COMPLETING THE WORKFLOW if (String.IsNullOrWhiteSpace(ReferrerUrl)) // ONLY RELOAD IF CURRENT SAVE SESSION IS EMPTY REFERRER { if (Request.UrlReferrer != null) { ReferrerUrl = Request.UrlReferrer.ToString(); } else { ReferrerUrl = "/Application/Workspace/Workspace.aspx"; } } // INITIALIZE WORKFLOW String workflowName = (String)Request.QueryString["Workflow"]; Int64 currentWorkflowId = 0; if (!String.IsNullOrWhiteSpace(workflowName)) { CurrentWorkflow = MercuryApplication.WorkflowGet(workflowName, false); } else { if (Int64.TryParse((String)Request.QueryString["WorkflowId"], out currentWorkflowId)) { CurrentWorkflow = MercuryApplication.WorkflowGet(currentWorkflowId, true); if (CurrentWorkflow != null) { workflowName = CurrentWorkflow.Name; } } } if (!String.IsNullOrEmpty((String)Request.QueryString["WorkflowInstanceId"])) { // RESUME EXISTING WORKFLOW WorkflowInstanceId = new Guid((String)Request.QueryString["WorkflowInstanceId"]); CurrentWorkflow = MercuryApplication.WorkflowGet(workflowName, false); if (CurrentWorkflow == null) { CurrentWorkflow = MercuryApplication.WorkflowGet(currentWorkflowId, true); } if (CurrentWorkflow != null) { WorkflowTitleLabel.Text = "Workflow: " + CurrentWorkflow.Name + ((!String.IsNullOrEmpty(CurrentWorkflow.Description)) ? " [" + CurrentWorkflow.Description + "]" : String.Empty); TelerikAjaxManager.ResponseScripts.Add(ResponseScriptWorkflowResume); } else { WorkflowTitleLabel.Text = "Workflow Engine"; WorkflowExceptionMessageRow.Style.Clear(); WorkflowExceptionMessage.Text = "Workflow Exception: Unable to Load Workflow."; } } else { Boolean canWork = true; Int64 workQueueItemId; if (Int64.TryParse((String)Request.QueryString["WorkQueueItemId"], out workQueueItemId)) { canWork = false; Client.Core.Work.WorkQueueItem workQueueItem = MercuryApplication.WorkQueueItemGet(workQueueItemId); if (workQueueItem != null) { if ((workQueueItem.AssignedToSecurityAuthorityId == MercuryApplication.Session.SecurityAuthorityId) && (workQueueItem.AssignedToUserAccountId == MercuryApplication.Session.UserAccountId)) { canWork = true; } else if (workQueueItem.AssignTo(MercuryApplication.Session.SecurityAuthorityId, MercuryApplication.Session.UserAccountId, MercuryApplication.Session.UserAccountName, MercuryApplication.Session.UserDisplayName, "Member Profile - Work History")) { canWork = true; } } if (canWork) { Server.Application.WorkflowStartRequest startRequest = WorkflowStartRequest; startRequest.WorkQueueItemId = workQueueItemId; WorkflowStartRequest = startRequest; } } if ((canWork) && (CurrentWorkflow != null)) { WorkflowTitleLabel.Text = "Workflow: " + CurrentWorkflow.Name + ((!String.IsNullOrEmpty(CurrentWorkflow.Description)) ? " [" + CurrentWorkflow.Description + "]" : String.Empty); Page.ClientScript.RegisterStartupScript(this.GetType(), "StartWorkflow", ResponseScriptWorkflowStart); } else if (!canWork) { WorkflowTitleLabel.Text = "Workflow Engine"; WorkflowExceptionMessageRow.Style.Clear(); WorkflowExceptionMessage.Text = "Permission Denied: Unable to perform work on the selected Work Queue Item. This Item might already be owned. Please try again."; } else { WorkflowTitleLabel.Text = "Workflow Engine"; WorkflowExceptionMessageRow.Style.Clear(); WorkflowExceptionMessage.Text = "Workflow Exception: " + MercuryApplication.LastException; } } return; }