예제 #1
0
        public PagingResult List(int formId, int infoId = 0, int extendInfoId = 0, int userId = 0, int applyUserId = 0, int approvalUserId = 0, CheckStatus status = CheckStatus.All, int page = 1, int rows = 20)
        {
            var parameter = new Extend1Parameter
            {
                FormId         = formId,
                ExtendInfoId   = extendInfoId == 0 ? infoId : extendInfoId,
                UserId         = userId,
                PostUserId     = applyUserId,
                ApprovalUserId = approvalUserId,
                Page           = new PageParameter(page, rows)
            };

            switch (status)
            {
            case CheckStatus.All:
                break;

            case CheckStatus.Checked:
                parameter.FlowStatus = new[] { FlowStatus.Completed, FlowStatus.Done };
                break;

            case CheckStatus.Uncheck:
                parameter.FlowStatus = new[] { FlowStatus.Doing, FlowStatus.Back };
                break;
            }
            var list = Core.FormInfoExtend1Manager.GetList(parameter).GroupBy(e => e.InfoId).Select(g => g.FirstOrDefault());

            return(new PagingResult
            {
                List = list.Select(e => new
                {
                    e.ID,
                    e.UserId,
                    e.InfoId,
                    e.CreateTime,
                    e.ScheduleBeginTime,
                    e.ScheduleEndTime,
                    e.RealEndTime,
                    e.Reason,
                    e.Result,
                    e.UpdateTime,
                    e.ApprovalUserId,
                    e.FlowDataId,
                    ApprovalUser = e.ApprovalUserName,
                    ApplyUser = e.ApplyUserName,
                    e.FormId,
                    e.Title,
                    e.FlowStep,
                    e.AttachmentId,
                    Completed = e.FlowData == null ? false : e.FlowData.Completed,
                    e.FlowData,
                    e.FlowStatus,
                }),
                Page = parameter.Page,
            });
        }
예제 #2
0
        public IEnumerable <UserFormExtend1> GetList(Extend1Parameter parameter)
        {
            var query = Core.UserFormInfoManager.GetUserInfoList <UserFormExtend1>(parameter);

            if (parameter.ExtendInfoId > 0)
            {
                query = query.Where(e => e.ExtendInfoId == parameter.ExtendInfoId);
            }
            if (parameter.Result.HasValue)
            {
                query = query.Where(e => e.Result == parameter.Result);
            }
            if (parameter.ApprovalUserId > 0)
            {
                query = query.Where(e => e.ApprovalUserId == parameter.ApprovalUserId);
            }
            return(query.OrderByDescending(e => e.ID).SetPage(parameter.Page));
        }