예제 #1
0
        public void SetStatus(SchemeStatus status)
        {
            if ((SchemeStatus == SchemeStatus.Withdrawn && status != SchemeStatus.Withdrawn)
                || (SchemeStatus == SchemeStatus.Rejected && status != SchemeStatus.Rejected))
            {
                throw new InvalidOperationException(
                    string.Format("Scheme cannot transition scheme status '{0}' to '{1}'", SchemeStatus, status));
            }

            if (SchemeStatus == SchemeStatus.Pending && status == SchemeStatus.Withdrawn)
            {
                throw new InvalidOperationException(
                    string.Format("Scheme cannot transition scheme status '{0}' to '{1}'", SchemeStatus, status));
            }

            if (SchemeStatus == SchemeStatus.Approved && (status == SchemeStatus.Pending || status == SchemeStatus.Rejected))
            {
                throw new InvalidOperationException(
                    string.Format("Scheme cannot transition scheme status '{0}' to '{1}'", SchemeStatus, status));
            }

            if (SchemeStatus == SchemeStatus.Withdrawn && status == SchemeStatus.Withdrawn)
            {
                throw new InvalidOperationException(
                    string.Format("Scheme cannot transition scheme status '{0}' to '{1}'", SchemeStatus, status));
            }

            SchemeStatus = status;
        }
예제 #2
0
파일: Scheme.cs 프로젝트: DEFRA/prsd-weee
        public void SetStatus(SchemeStatus status)
        {
            if ((SchemeStatus == SchemeStatus.Withdrawn && status != SchemeStatus.Withdrawn) ||
                (SchemeStatus == SchemeStatus.Rejected && status != SchemeStatus.Rejected))
            {
                throw new InvalidOperationException(
                          string.Format("Scheme cannot transition scheme status '{0}' to '{1}'", SchemeStatus, status));
            }

            if (SchemeStatus == SchemeStatus.Pending && status == SchemeStatus.Withdrawn)
            {
                throw new InvalidOperationException(
                          string.Format("Scheme cannot transition scheme status '{0}' to '{1}'", SchemeStatus, status));
            }

            if (SchemeStatus == SchemeStatus.Approved && (status == SchemeStatus.Pending || status == SchemeStatus.Rejected))
            {
                throw new InvalidOperationException(
                          string.Format("Scheme cannot transition scheme status '{0}' to '{1}'", SchemeStatus, status));
            }

            if (SchemeStatus == SchemeStatus.Withdrawn && status == SchemeStatus.Withdrawn)
            {
                throw new InvalidOperationException(
                          string.Format("Scheme cannot transition scheme status '{0}' to '{1}'", SchemeStatus, status));
            }

            SchemeStatus = status;
        }