예제 #1
0
        public static WebMethodResponse AccessTeamActions(int requestId, WorkflowAction action, string comments)
        {
            //TODO: get actorId from current user
            var accessReq = new AccessRequest(requestId);
            comments = comments.FromJSONStringToObj<string>();
            switch (action)
            {
                case WorkflowAction.Ack:
                    return accessReq.Ack();
                case WorkflowAction.Change:
                    return accessReq.RequestToChange(comments);
                case WorkflowAction.Cancel:
                    return accessReq.NoAccess(action, comments);
                case WorkflowAction.Denied:
                    return accessReq.NoAccess(action, comments);

                default:
                    return new WebMethodResponse(false, "AIM", "Unknown operation");
            }
        }
예제 #2
0
        public static WebMethodResponse BuilderActions(int requestId, WorkflowAction action)
        {
            //TODO: get actorId from current user
            var accessReq = new AccessRequest(requestId);

            switch (action)
            {
                case WorkflowAction.Cancel:
                    return accessReq.NoAccess(action, "");
                case WorkflowAction.Complete:
                    return accessReq.FinalizeRequest();
                case WorkflowAction.Ticket:
                    return accessReq.CreateServiceDeskTicket();

                default:
                    return new WebMethodResponse(false, "BuilderActions", "Unknown action");
            }
        }
예제 #3
0
파일: ReminderTask.cs 프로젝트: apxlee/SAP
        static bool overdue(SNAP_Workflow_State wfState, string overdueType)
        {
            DateTime dueDate = DateTime.Parse(wfState.dueDate.ToString());
            TimeSpan diff = DateTime.Now.Subtract(dueDate);

            int overdueAlertIntervalInDays = Convert.ToInt16(ConfigurationManager.AppSettings["OverdueAlertIntervalInDays"]);
            int overdueAlertMaxDay = Convert.ToInt16(ConfigurationManager.AppSettings["OverdueAlertMaxDay"]);

            if (overdueAlertMaxDay <= 0 || overdueAlertIntervalInDays <= 0)
                return false;

            if (wfState.workflowStatusEnum != (byte)WorkflowState.Pending_Approval
                && wfState.workflowStatusEnum != (byte)WorkflowState.Change_Requested)
                return false;

            if (diff.Days >= overdueAlertMaxDay
                && (wfState.workflowStatusEnum == (byte)WorkflowState.Pending_Approval
                    || wfState.workflowStatusEnum == (byte)WorkflowState.Change_Requested))
            {
                var accessReq = new AccessRequest(wfState.SNAP_Workflow.requestId);
                accessReq.NoAccess(WorkflowAction.Abandon, string.Format("Request has been abandoned because of inactivity.  Maximum overdue days ({0}) for action reached.", overdueAlertMaxDay));
                return false;
            }

            if (diff.Days < overdueAlertMaxDay && diff.Days > 0)
            {
                // at least more than 24 hours over due
                if (diff.Days % overdueAlertIntervalInDays == 1 || overdueAlertIntervalInDays == 1) // also every x interval days to send alert
                {
                    if (wfState.workflowStatusEnum == (byte)WorkflowState.Pending_Approval
                        || wfState.workflowStatusEnum == (byte)WorkflowState.Change_Requested)
                    {
                        wfState.SNAP_Workflow.SNAP_Workflow_Comments.Add(new SNAP_Workflow_Comment()
                                                                             {
                                                                                 commentText =
                                                                                     "Overdue: " + overdueType.Replace('_', ' '),
                                                                                 commentTypeEnum =
                                                                                     (byte) CommentsType.Email_Reminder,
                                                                                 createdDate = DateTime.Now
                                                                             });

                        return true;
                    }
                }
            }
            return false;
        }