Exemple #1
0
        /// <summary>
        /// 获取任务(分页)
        /// </summary>
        /// <param name="query"></param>
        /// <param name="activityState"></param>
        /// <returns></returns>
        private IEnumerable <TaskViewEntity> GetTasksPaged(TaskQueryEntity query, int activityState, out int allRowsCount)
        {
            //processState:2 -running 流程处于运行状态
            //activityType:4 -表示“任务”类型的节点
            //activityState: 1-ready(准备), 2-running()运行;

            ISession session    = SessionFactory.CreateSession();
            string   orderBySql = "ORDER BY TASKID DESC";
            string   whereSql   = string.Format(@"WHERE AppInstanceID={0} AND ProcessGUID='{1}' AND AssignedToUserID={2} 
                                AND ActivityState={3} AND ProcessState=2 AND ActivityType=4",
                                                query.AppInstanceID, query.ProcessGUID, query.UserID, activityState);;

            //如果数据记录数为0,则不用查询列表
            allRowsCount = TaskRepository.GetCount <TaskViewEntity>(whereSql, session.Connection, session.Transaction);
            if (allRowsCount == 0)
            {
                return(null);
            }

            //查询列表数据并返回结果集
            var list = TaskRepository.GetPage <TaskViewEntity>(query.PageIndex, query.PageSize, whereSql,
                                                               new
            {
                appInstanceID = query.AppInstanceID,
                processGUID   = query.ProcessGUID,
                activityState = activityState,
                userID        = query.UserID
            },
                                                               orderBySql,
                                                               session.Connection,
                                                               session.Transaction);

            return(list);
        }
Exemple #2
0
        public IList <TaskViewEntity> GetReadyTasks(TaskQueryEntity query)
        {
            int allRowsCount = 0;
            var taskManager  = new TaskManager();

            return(taskManager.GetReadyTasks(query, out allRowsCount).ToList());
        }
Exemple #3
0
        internal IEnumerable <ActivityInstanceEntity> GetAcitivityInstancePaged(TaskQueryEntity query)
        {
            ISession session    = SessionFactory.CreateSession();
            var      whereSql   = @" WHERE AppInstanceID = @appInstanceID
                            AND ProcessGUID = @processGUID";
            var      orderBySql = "ORDER BY CreatedDateTime DESC";

            var entityList = ActivityInstanceRepository.GetPage <ActivityInstanceEntity>(query.PageIndex, query.PageSize,
                                                                                         whereSql, new {
                appInstanceID = query.AppInstanceID,
                processGUID   = query.ProcessGUID
            },
                                                                                         orderBySql,
                                                                                         session.Connection, session.Transaction);

            return(entityList);
        }
Exemple #4
0
 /// <summary>
 /// 获取当前用户待办的任务
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 internal IEnumerable <TaskViewEntity> GetReadyTasks(TaskQueryEntity query, out int allRowsCount)
 {
     return(GetTasksPaged(query, 1, out allRowsCount));
 }