Пример #1
0
        public List <TaskListDto> GetPageableTasks(int pageSize, int pageNumber, int?assigned, int?requestedBy, int?unitId, int?projectId, int?taskId, int?taskStatusId, string title)
        {
            var result = _objectRawSql.Execute(StaticParams.DefaultConnstr, typeof(TaskListDto),
                                               @"select * from work.GetTaskList({2},{3},{4},{5},{6},{7},{8})  a 
                 order by a.ARequestedDate desc, a.Assigned asc, a.Queue asc OFFSET {0} * ({1} - 1) ROWS FETCH NEXT {0} ROWS ONLY ",
                                               pageSize, pageNumber, assigned, requestedBy, unitId, projectId, taskId, taskStatusId, title).Cast <TaskListDto>().ToList();

            var resultCount = _objectRawSql.Execute(StaticParams.DefaultConnstr, typeof(int),
                                                    "select count(a.Id) from work.GetTaskList({0},{1},{2},{3},{4},{5},{6})  a ", assigned, requestedBy, unitId, projectId, taskId, taskStatusId, title).Cast <int>().SingleOrDefault();

            if (result.Count > 0)
            {
                result[0].ResultCount = resultCount;
            }
            return(result);
        }