//我的申请
        private void MyApplyList(OfficeListModel vm, IEnumerable <tbWeOAFlowDetail> workflowApproveList)
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var allApproveList = OAWeWorkFlow.GetAllApprovedList(flowTypeCode);
                var myApplyList    = OAWeWorkFlow.GetMyApplyList(db, flowTypeCode).ToList();
                var my             = (from a in myApplyList
                                      join b in db.Table <Wechat.Entity.tbWeOAOffice>() on a.ApproveBodyId equals b.Id
                                      select new Dto.Office.OfficeListDto
                {
                    Title = b.Title,
                    LimitDateTo = b.LimitDateTo,
                    OfficeFileFrom = b.OfficeFileFrom,
                    OfficeFileName = b.OfficeFileName,
                    OfficeFileNameSeq = b.OfficeFileNameSeq,
                    ReceiveFileTime = b.ReceiveFileTime,

                    Id = b.Id,
                    ApplyUser = workflowApproveList.Where(m => m.ApproveBodyId == b.Id).FirstOrDefault().tbSysUser.UserName,
                    ApproveDate = a.ApproveDate,
                    ApproveOpinion = a.ApproveOpinion,
                    ApproveUserName = a.tbSysUser.UserName,
                    NodeApproveStatus = allApproveList.Where(m => m.ApproveBodyId == a.ApproveBodyId && m.NodeApproveStatus == Code.EnumHelper.OAFlowNodeStatus.WithoutApproval).FirstOrDefault() == null ? Code.EnumHelper.OAFlowNodeStatus.Approved : Code.EnumHelper.OAFlowNodeStatus.WithoutApproval,
                    IsComplete = allApproveList.Where(m => m.ApproveBodyId == a.ApproveBodyId && m.tbWeOAFlowNextNode == null).FirstOrDefault() != null
                }).Distinct(new Code.EqualComparer <Dto.Office.OfficeListDto>((x, y) => x.Id == y.Id)).OrderByDescending(m => m.ApproveDate);
                //分页
                MyListPage(vm, my);
            }
        }
Beispiel #2
0
        public ActionResult ApplyCarIndex(Models.ApplyCar.ApplyCarListModel vm)
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var workflowApproveList = OAWeWorkFlow.GetWorkFlowApproveList(flowTypeCode);
                var allApproveList      = OAWeWorkFlow.GetAllApprovedList(flowTypeCode);

                WaitApproveList(vm, workflowApproveList);
                ApprovedList(vm, workflowApproveList, allApproveList);
                MyApplyList(vm, workflowApproveList, allApproveList);

                if (Request.IsAjaxRequest())
                {
                    return(PartialView("ApplyCarApproveBody", vm));
                }

                //发起流程权限
                var approver = db.Table <Wechat.Entity.tbWeOAFlowApprover>().Where(m => m.tbWeOAFlowNode.tbSysOAFlowType.Code == flowTypeCode && m.tbSysUser.Id == XkSystem.Code.Common.UserId && m.tbWeOAFlowNode.FlowStep == 1).FirstOrDefault();
                vm.StartFlowPermission = approver != null;

                return(View(vm));
            }
        }