Example #1
0
        private void OnSaveUserOperationLog(WfExecutorDataContext dataContext)
        {
            UserOperationTasksLogCollection userTasks = null;

            if (dataContext.ContainsKey("USER_OPERATION_TASKSLOGS") == true)
            {
                userTasks = dataContext["USER_OPERATION_TASKSLOGS"] as UserOperationTasksLogCollection;
            }

            foreach (UserOperationLog userLog in dataContext.OperationLogs)
            {
                int identityID = UserOperationLogAdapter.Instance.InsertData(userLog);
                if (userTasks != null)
                {
                    foreach (UserOperationTasksLog item in userTasks)
                    {
                        item.ID = identityID;
                    }
                }
            }

            if (userTasks != null)
            {
                UserOperationTasksLogAdapter.Instance.AddOperationTasksLogs(userTasks);
            }
        }
Example #2
0
        protected override void OnAfterQuery(UserOperationLogCollection result)
        {
            UserOperationTasksLogCollection userTasklogs = this.GetOperationTasksLogs(result);

            Dictionary <long, UserOperationTasksLogCollection> dic = new Dictionary <long, UserOperationTasksLogCollection>();
            Dictionary <long, int> logIDCount = new Dictionary <long, int>();
            List <string>          userIDs    = new List <string>();

            foreach (UserOperationTasksLog item in userTasklogs)
            {
                if (dic.ContainsKey(item.ID) == false)
                {
                    dic[item.ID] = new UserOperationTasksLogCollection();
                    dic[item.ID].Add(item);

                    userIDs.Add(item.SendToUserID);
                    logIDCount.Add(item.ID, 0);
                }
                else if (dic[item.ID].Count < 5 && userIDs.Contains(item.SendToUserID) == false)
                {
                    dic[item.ID].Add(item);
                    userIDs.Add(item.SendToUserID);
                }

                logIDCount[item.ID]++;
            }
            userIDs = null;
            if (dic.Count > 0)
            {
                this.SetTargetDescription(result, dic, logIDCount);
            }
        }
Example #3
0
        protected virtual void OnPrepareUserOperationLog(WfExecutorDataContext dataContext)
        {
            UserOperationLogCollection logs = dataContext.OperationLogs;

            if (OperatorActivity != null)
            {
                UserOperationLog log = UserOperationLog.FromActivity(OperatorActivity);

                log.OperationType = DataObjects.OperationType.Update;
                log.OperationName = EnumItemDescriptionAttribute.GetDescription(this.OperationType);

                logs.Add(log);
            }

            FirePrepareUserOperationLog(dataContext, logs);

            foreach (UserOperationLog log in logs)
            {
                OnPrepareUserOperationLogDescription(dataContext, log);
            }

            List <string> accomplishedUserTaskIDs = new List <string>();

            foreach (UserTask item in WfRuntime.ProcessContext.AccomplishedUserTasks)
            {
                accomplishedUserTaskIDs.Add(item.TaskID);
            }

            UserOperationTasksLogCollection userOperationlogs = new UserOperationTasksLogCollection();

            foreach (UserTask userTaskItem in WfRuntime.ProcessContext.MoveToUserTasks)
            {
                if (accomplishedUserTaskIDs.Exists(taskID => string.Equals(taskID, userTaskItem.TaskID)) == false)
                {
                    userOperationlogs.Add(UserOperationTasksLog.FromUserTask(userTaskItem));
                }
            }

            if (userOperationlogs.Count > 0)
            {
                dataContext.Add("USER_OPERATION_TASKSLOGS", userOperationlogs);
            }
            else
            {
                dataContext.Remove("USER_OPERATION_TASKSLOGS");
            }
        }
Example #4
0
        private UserOperationTasksLogCollection GetOperationTasksLogs(UserOperationLogCollection logs)
        {
            UserOperationTasksLogCollection taskLogs = null;

            if (logs.Count > 0)
            {
                taskLogs = UserOperationTasksLogAdapter.Instance.Load(builder =>
                {
                    builder.LogicOperator = LogicOperatorDefine.Or;

                    foreach (MCS.Library.SOA.DataObjects.UserOperationLog item in logs)
                    {
                        builder.AppendItem("LOG_ID", item.ID);
                    }
                });
            }
            else
            {
                taskLogs = new UserOperationTasksLogCollection();
            }

            return(taskLogs);
        }
        protected virtual void OnPrepareUserOperationLog(WfExecutorDataContext dataContext)
        {
            UserOperationLogCollection logs = dataContext.OperationLogs;

            if (OperatorActivity != null)
            {
                UserOperationLog log = UserOperationLog.FromActivity(OperatorActivity);

                log.OperationType = DataObjects.OperationType.Update;
                log.OperationName = EnumItemDescriptionAttribute.GetDescription(this.OperationType);

                logs.Add(log);
            }

            FirePrepareUserOperationLog(dataContext, logs);

            foreach (UserOperationLog log in logs)
            {
                OnPrepareUserOperationLogDescription(dataContext, log);
            }

            List<string> accomplishedUserTaskIDs = new List<string>();
            foreach (UserTask item in WfRuntime.ProcessContext.AccomplishedUserTasks)
            {
                accomplishedUserTaskIDs.Add(item.TaskID);
            }

            UserOperationTasksLogCollection userOperationlogs = new UserOperationTasksLogCollection();
            foreach (UserTask userTaskItem in WfRuntime.ProcessContext.MoveToUserTasks)
            {
                if (accomplishedUserTaskIDs.Exists(taskID => string.Equals(taskID, userTaskItem.TaskID)) == false)
                    userOperationlogs.Add(UserOperationTasksLog.FromUserTask(userTaskItem));
            }

            if (userOperationlogs.Count > 0)
                dataContext.Add("USER_OPERATION_TASKSLOGS", userOperationlogs);
            else
                dataContext.Remove("USER_OPERATION_TASKSLOGS");
        }