protected override void OnSaveUserOperationLogs(WfDesignerExecutorDataContext dataContext, UserOperationLogCollection logs)
        {
            List<IWfProcessDescriptor> importedProcesses = dataContext.GetValue("ImportedProcesses", new List<IWfProcessDescriptor>());

            importedProcesses.ForEach(processDesp => logs.Add(this.CreateImportLog(processDesp)));

            this.FillEnvironmentInfoToLogs(logs);
            base.OnSaveUserOperationLogs(dataContext, logs);
        }
        protected override void OnPrepareUserOperationLog(WfDesignerExecutorDataContext dataContext, UserOperationLogCollection logs)
        {
            UserOperationLog log = new UserOperationLog();

            log.Subject = string.Format("{0}", this.OperationType.ToDescription());

            logs.Add(log);

            base.OnPrepareUserOperationLog(dataContext, logs);

            this.FillEnvironmentInfoToLogs(logs);
        }
Exemple #3
0
        private static WfClientUserOperationLogPageQueryResult QueryUserOperationLog(QueryCondition qc, int totalCount)
        {
            CommonAdapter adapter = new CommonAdapter(UserOperationLogAdapter.Instance.ConnectionName);

            UserOperationLogCollection serverLogs = adapter.SplitPageQuery <UserOperationLog, UserOperationLogCollection>(qc, ref totalCount);

            WfClientUserOperationLogCollection clientLogs = WfClientUserOperationLogConverter.Instance.ServerToClient(serverLogs);

            WfClientUserOperationLogPageQueryResult result = new WfClientUserOperationLogPageQueryResult();

            result.TotalCount = totalCount;
            result.QueryResult.CopyFrom(clientLogs);

            return(result);
        }
        /// <summary>
        /// 填充日志中的环境信息
        /// </summary>
        /// <param name="logs"></param>
        protected void FillEnvironmentInfoToLogs(UserOperationLogCollection logs)
        {
            logs.ForEach(log =>
            {
                log.OperationName = this.OperationType.ToDescription();

                if (DeluxePrincipal.IsAuthenticated)
                {
                    log.Operator = DeluxeIdentity.CurrentUser;
                    log.RealUser = DeluxeIdentity.CurrentRealUser;

                    log.TopDepartment = DeluxeIdentity.CurrentUser.TopOU;
                }
            });
        }
Exemple #5
0
        public UserOperationLogCollection GetUserOperationLogsWithCount(int startRowIndex, int maximumRows, string where, string orderBy, ref int totalCount)
        {
            if (string.IsNullOrEmpty(orderBy))
            {
                orderBy = "OPERATE_DATETIME Desc";
            }

            QueryCondition qc = new QueryCondition(
                startRowIndex,
                maximumRows,
                "*",
                "WF.USER_OPERATION_LOG (NOLOCK)",
                orderBy,
                where
                );

            DataSet ds = CommonAdapter.Instance.SplitPageQuery(qc, totalCount < 0);

            UserOperationLogCollection Logs = new UserOperationLogCollection();

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                MCS.Library.SOA.DataObjects.UserOperationLog log = new MCS.Library.SOA.DataObjects.UserOperationLog();

                ORMapping.DataRowToObject(row, log);

                Logs.Add(log);
            }

            if (ds.Tables.Count > 1)
            {
                totalCount = (int)ds.Tables[1].Rows[0][0];
            }

            HttpContext.Current.Items["UserOperationLogsCount"] = totalCount;

            //当页码超出索引的,返回最大页
            if (Logs.Count == 0 && totalCount > 0)
            {
                int newStartRowIndex = (totalCount - 1) / maximumRows * maximumRows;

                totalCount = -1;

                Logs = GetUserOperationLogsWithCount(newStartRowIndex, maximumRows, where, orderBy, ref totalCount);
            }

            return(Logs);
        }
        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");
            }
        }
Exemple #7
0
        public UserOperationLogCollection ClientToServer(IEnumerable <WfClientUserOperationLog> client)
        {
            client.NullCheck("client");

            UserOperationLogCollection server = new UserOperationLogCollection();

            foreach (WfClientUserOperationLog clientItem in client)
            {
                UserOperationLog serverItem = null;

                this.ClientToServer(clientItem, ref serverItem);

                server.Add(serverItem);
            }

            return(server);
        }
Exemple #8
0
        public void UserOperationLogAdapterTest()
        {
            int resId            = 3;
            int actId            = 3;
            UserOperationLog log = GetInstanceOfUserOperationLog(resId, actId);

            UserOperationLogAdapter.Instance.Update(log);


            UserOperationLogCollection log3 = UserOperationLogAdapter.Instance.LoadByResourceID("resource" + resId.ToString());

            UserOperationLog log2 = UserOperationLogAdapter.Instance.Load(log3[0].ID);

            Assert.AreEqual(log.ResourceID, log2.ResourceID);
            Assert.AreEqual(log.Operator.ID, log2.Operator.ID);

            UserOperationLogAdapter.Instance.Delete(log);
        }
 protected virtual void FirePrepareUserOperationLog(WfExecutorDataContext dataContext, UserOperationLogCollection logs)
 {
     if (PrepareUserOperationLog != null)
     {
         PrepareUserOperationLog(dataContext, logs);
     }
 }
        protected override void OnSaveUserOperationLogs(WfDesignerExecutorDataContext dataContext, UserOperationLogCollection logs)
        {
            List <IWfProcessDescriptor> importedProcesses = dataContext.GetValue("ImportedProcesses", new List <IWfProcessDescriptor>());

            importedProcesses.ForEach(processDesp => logs.Add(this.CreateImportLog(processDesp)));

            this.FillEnvironmentInfoToLogs(logs);
            base.OnSaveUserOperationLogs(dataContext, logs);
        }
        public UserOperationLogCollection ClientToServer(IEnumerable<WfClientUserOperationLog> client)
        {
            client.NullCheck("client");

            UserOperationLogCollection server = new UserOperationLogCollection();

            foreach (WfClientUserOperationLog clientItem in client)
            {
                UserOperationLog serverItem = null;

                this.ClientToServer(clientItem, ref serverItem);

                server.Add(serverItem);
            }

            return server;
        }
 protected virtual void OnPrepareUserOperationLog(WfDesignerExecutorDataContext dataContext, UserOperationLogCollection logs)
 {
     this.FirePrepareUserOperationLog(dataContext, logs);
 }
        /// <summary>
        /// 填充日志中的环境信息
        /// </summary>
        /// <param name="logs"></param>
        protected void FillEnvironmentInfoToLogs(UserOperationLogCollection logs)
        {
            logs.ForEach(log =>
            {
                log.OperationName = this.OperationType.ToDescription();

                if (DeluxePrincipal.IsAuthenticated)
                {
                    log.Operator = DeluxeIdentity.CurrentUser;
                    log.RealUser = DeluxeIdentity.CurrentRealUser;

                    log.TopDepartment = DeluxeIdentity.CurrentUser.TopOU;
                }
            });
        }
 protected virtual void OnPrepareUserOperationLog(WfDesignerExecutorDataContext dataContext, UserOperationLogCollection logs)
 {
     this.FirePrepareUserOperationLog(dataContext, logs);
 }
 protected virtual void OnSaveUserOperationLogs(WfDesignerExecutorDataContext dataContext, UserOperationLogCollection logs)
 {
     logs.ForEach(log => UserOperationLogAdapter.Instance.InsertData(log));
 }
 protected virtual void FirePrepareUserOperationLog(WfExecutorDataContext dataContext, UserOperationLogCollection logs)
 {
     if (PrepareUserOperationLog != null)
         PrepareUserOperationLog(dataContext, logs);
 }
Exemple #17
0
        protected override void OnPrepareUserOperationLog(WfDesignerExecutorDataContext dataContext, UserOperationLogCollection logs)
        {
            UserOperationLog log = new UserOperationLog();

            log.ResourceID = this.ProcessDescriptor.Key;
            log.Subject    = string.Format("{0}:{1}", this.OperationType.ToDescription(), this.ProcessDescriptor.Key);

            logs.Add(log);

            base.OnPrepareUserOperationLog(dataContext, logs);

            this.FillEnvironmentInfoToLogs(logs);
        }
 protected virtual void OnSaveUserOperationLogs(WfDesignerExecutorDataContext dataContext, UserOperationLogCollection logs)
 {
     logs.ForEach(log => UserOperationLogAdapter.Instance.InsertData(log));
 }