Beispiel #1
0
        public void UpdateApplicationStatus(int applicationId, int applicationStatusId, string updatedBy)
        {
            var application = this.GetById(applicationId);

            if (application == null)
            {
                throw new ObjectNotFoundException("Cannot find application");
            }

            var applicationStatusHistory = new ApplicationStatusHistory
            {
                ApplicationId          = application.Id,
                ApplicationStatusIdOld = application.ApplicationStatusId,
                ApplicationStatusIdNew = applicationStatusId,
                CreatedBy   = updatedBy,
                CreatedDate = DateTime.Now
            };

            this.applicationStatusHistoryManager.Add(applicationStatusHistory);

            application.ApplicationStatusId = applicationStatusId;

            if (applicationStatusId == 8 || applicationStatusId == 10)
            {
                application.SubmittedDate = DateTime.Now;
            }

            application.UpdatedBy   = updatedBy;
            application.UpdatedDate = DateTime.Now;

            this.Repository.Save(application);
        }
Beispiel #2
0
        public void UpdateApplicationStatus(int organizationId, int applicationTypeId, int applicationStatusId, string updatedBy)
        {
            LogMessage("UpdateApplicationStatus (ApplicationManager)");

            var application = base.Repository.GetByOrganizationAndType(organizationId, applicationTypeId);

            if (application == null)
            {
                throw new ObjectNotFoundException("Cannot find application");
            }

            var applicationStatusHistory = new ApplicationStatusHistory();

            applicationStatusHistory.ApplicationId          = application.Id;
            applicationStatusHistory.ApplicationStatusIdOld = application.ApplicationStatusId;
            applicationStatusHistory.ApplicationStatusIdNew = applicationStatusId;
            applicationStatusHistory.CreatedBy   = updatedBy;
            applicationStatusHistory.CreatedDate = DateTime.Now;

            applicationStatusHistoryManager.Add(applicationStatusHistory);

            application.ApplicationStatusId = applicationStatusId;

            if (applicationStatusId == 8 || applicationStatusId == 10)
            {
                application.SubmittedDate = DateTime.Now;
            }

            application.UpdatedBy   = updatedBy;
            application.UpdatedDate = DateTime.Now;

            this.Repository.Save(application);
        }
Beispiel #3
0
        public async Task UpdateApplicationStatusAsync(Application application, int organizationId, int applicationTypeId, int applicationStatusId, string applicationStatusName, DateTime?dueDate, string updatedBy)
        {
            LogMessage("UpdateApplicationStatusAsync (ApplicationManager)");

            if (application == null)
            {
                throw new ObjectNotFoundException("Cannot find application");
            }

            var applicationStatusHistory = new ApplicationStatusHistory();

            applicationStatusHistory.ApplicationId          = application.Id;
            applicationStatusHistory.ApplicationStatusIdOld = application.ApplicationStatusId;
            applicationStatusHistory.ApplicationStatusIdNew = applicationStatusId;
            applicationStatusHistory.CreatedBy   = updatedBy;
            applicationStatusHistory.CreatedDate = DateTime.Now;

            applicationStatusHistoryManager.Add(applicationStatusHistory);

            application.ApplicationStatusId = applicationStatusId;

            if (applicationStatusId == 8 || applicationStatusId == 10)
            {
                application.SubmittedDate = DateTime.Now;
            }

            switch (applicationStatusName)
            {
            case Constants.ApplicationStatus.ForReview:
                foreach (
                    var response in
                    application.ApplicationResponses.Where(x => x.ApplicationResponseStatusId == null))
                {
                    response.ApplicationResponseStatusId = (int)Constants.ApplicationResponseStatuses.ForReview;
                }
                break;

            case Constants.ApplicationStatus.RFI:
                foreach (
                    var response in
                    application.ApplicationResponses.Where(
                        x =>
                        x.ApplicationResponseStatusId != null &&
                        x.ApplicationResponseStatus.Name == Constants.ApplicationResponseStatus.RFI &&
                        !x.VisibleApplicationResponseStatusId.HasValue))
                {
                    response.VisibleApplicationResponseStatusId = response.ApplicationResponseStatusId;
                }

                if (dueDate.HasValue)
                {
                    application.RFIDueDate = dueDate;
                }
                break;
            }

            if (dueDate.HasValue)
            {
                application.DueDate = dueDate;
            }

            application.UpdatedBy   = updatedBy;
            application.UpdatedDate = DateTime.Now;

            await this.Repository.SaveAsync(application);
        }