예제 #1
0
        public PrimaryAuditViewModel(int id)
        {
            var bizProcessesAudit = BizFactory.BizProcessesAudit.ChangeExtendedAppAuditStatus(this.Operater, id, Enumeration.ExtendedAppAuditStatus.InAudit);

            if (bizProcessesAudit != null)
            {
                _bizProcessesAudit = bizProcessesAudit;

                var extendedApp = CurrentDb.ExtendedApp.Where(m => m.Id == bizProcessesAudit.AduitReferenceId).FirstOrDefault();
                if (extendedApp != null)
                {
                    _extendedApp = extendedApp;
                }
            }


            var bizProcessesAuditDetails = CurrentDb.BizProcessesAuditDetails.Where(m => m.BizProcessesAuditId == id).ToList();

            if (bizProcessesAuditDetails != null)
            {
                var primaryAuditComments = bizProcessesAuditDetails.Where(m => m.BizProcessesAuditId == id && m.AuditStep == (int)Enumeration.ExtendedAppAuditStep.PrimaryAudit).OrderByDescending(m => m.CreateTime).Take(1).FirstOrDefault();
                if (primaryAuditComments != null)
                {
                    _bizProcessesAuditDetails = primaryAuditComments;

                    var auditComments = bizProcessesAuditDetails.Where(m => m.BizProcessesAuditId == bizProcessesAudit.Id && m.AuditStep == (int)Enumeration.ExtendedAppAuditStep.PrimaryAudit && m.AuditComments != null).OrderByDescending(m => m.CreateTime).Take(1).FirstOrDefault();
                    if (auditComments != null)
                    {
                        _bizProcessesAuditDetails.AuditComments = auditComments.AuditComments;
                    }
                }
            }
        }
        public SeniorAuditViewModel(int id)
        {
            var bizProcessesAudit = BizFactory.BizProcessesAudit.ChangeExtendedAppAuditStatus(this.Operater, id, Enumeration.ExtendedAppAuditStatus.InReview);

            if (bizProcessesAudit != null)
            {
                _bizProcessesAudit = bizProcessesAudit;

                var extendedApp = CurrentDb.ExtendedApp.Where(m => m.Id == bizProcessesAudit.AduitReferenceId).FirstOrDefault();
                if (extendedApp != null)
                {
                    _extendedApp = extendedApp;
                }
            }


            var auditCommentsHistory = CurrentDb.BizProcessesAuditDetails.Where(m => m.BizProcessesAuditId == id).ToList();

            if (auditCommentsHistory != null)
            {
                _auditCommentsHistory = auditCommentsHistory.Where(m => m.AuditTime != null && m.Auditor != null).ToList();

                var auditCommentsCurrent = auditCommentsHistory.Where(m => m.BizProcessesAuditId == id && m.AuditStep == (int)Enumeration.ExtendedAppAuditStep.SeniorAudit).OrderByDescending(m => m.CreateTime).Take(1).FirstOrDefault();

                if (auditCommentsCurrent != null)
                {
                    _auditCommentsCurrent = auditCommentsCurrent;
                }
            }
        }