/// <summary> /// 从Activity构造 /// </summary> /// <param name="activity"></param> /// <returns></returns> public static UserOperationLog FromActivity(IWfActivity activity) { UserOperationLog log = new UserOperationLog(); log.ResourceID = activity.Process.ResourceID; log.ApplicationName = activity.Process.Descriptor.ApplicationName; log.ProgramName = activity.Process.Descriptor.ProgramName; log.ProcessID = activity.Process.ID; log.ActivityID = activity.ID; if (activity.Descriptor.TaskTitle.IsNotEmpty()) { log.Subject = activity.Descriptor.TaskTitle; } else { log.Subject = activity.Process.Descriptor.DefaultTaskTitle; } log.Subject = activity.Process.ApplicationRuntimeParameters.GetMatchedString(log.Subject); log.ActivityName = activity.Descriptor.Name; if (DeluxePrincipal.IsAuthenticated) { log.Operator = DeluxeIdentity.CurrentUser; log.RealUser = DeluxeIdentity.CurrentRealUser; } log.TopDepartment = activity.RootActivity.Process.OwnerDepartment; return(log); }
/// <summary> /// 从环境信息中构造日志信息 /// </summary> /// <returns></returns> public static UserOperationLog FromEnvironment() { UserOperationLog log = new UserOperationLog(); if (DeluxePrincipal.IsAuthenticated) { log.Operator = DeluxeIdentity.CurrentUser; log.RealUser = DeluxeIdentity.CurrentRealUser; log.TopDepartment = DeluxeIdentity.CurrentUser.TopOU; } return(log); }
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); }