public FullReportRow(
     IFormsRepository formsRepo,
     IEnumerable <vFormResultUser> allVfrus,
     string formIdentifier,
     vFormResultUser vfru,
     DateTime?statusChangeDate,
     bool isHistorical = false,
     def_FileAttachment historicalSnapshot = null)
 {
     this.formsRepo          = formsRepo;
     this.allVfrus           = allVfrus;
     this.formIdentifier     = formIdentifier;
     this.vfru               = vfru;
     this.statusChangeDate   = statusChangeDate;
     this.isHistorical       = isHistorical;
     this.historicalSnapshot = historicalSnapshot;
 }
        /// <summary>
        /// Determines the next schedualed recertification date for a given applicant.
        /// This method shouldn't be called when the count of approved applications is 0, returns 1/1/0001 if it is.
        ///
        /// Base Rule: END of birth month, END of birth month +6.
        ///
        /// Upon first approval, if base rule results in less than 3 months, advance to the next 6 month date.  E.g. birth month March,
        /// initially approved July.  Instead of recert due Sept 30, due next March 31.  Exception applies for initial approval.
        /// After that, even if a recert is late, it doesn't delay the next recert due from the Base Rule.
        /// </summary>
        ///
        /// <param name="formResultUser">a formResultUser view record for the fiven applicant</param>
        ///
        /// <param name="query">the full set of formResultUsers to consider in computing the recertification date.
        /// Any records that aren't approved or that have a "subject" that does not match the given applicant will be ignored.</param>
        ///
        /// <returns>DateTime of the next Recertification date, defaults to null if calculation does not apply.</returns>
        private DateTime?GetRecert(IFormsRepository formsRepo, vFormResultUser formResultUser, IEnumerable <vFormResultUser> query)
        {
            if (!sortOrderForApprovedStatusDetail.HasValue)
            {
                def_StatusDetail sd = formsRepo.GetStatusDetailByMasterIdentifier(1, "APPROVED");
                sortOrderForApprovedStatusDetail = Convert.ToInt32(sd.sortOrder);
            }
            // Get applications for the applicant so Recertification can be determined.
            IEnumerable <vFormResultUser> apprRcrd = query.Where(fr => fr.formStatus == sortOrderForApprovedStatusDetail && fr.subject == formResultUser.subject).OrderByDescending(fr => fr.statusChangeDate);
            int acceptCount = apprRcrd.Count();

            if (acceptCount == 0)
            {
                return(null);
            }

            DateTime recentRecert = Convert.ToDateTime(apprRcrd.Select(fr => fr.statusChangeDate).FirstOrDefault());

            return(new Applications(formsRepo).GetRecert(formResultUser.DOB, acceptCount, recentRecert));
        }
Exemplo n.º 3
0
        private CaFullReportRow BuildRowFromVFormResultUser(vFormResultUser thisRecord, IEnumerable <vFormResultUser> allRecords)
        {
            string formIdentifier = applicableFormIdentifiers[thisRecord.formId];

            return(new CaFullReportRow(formsRepo, allRecords, formIdentifier, thisRecord, thisRecord.statusChangeDate));
        }
Exemplo n.º 4
0
        private List <CaFullReportRow> BuildHistoryRowsForBaseRow(CaFullReportRow baseRow, vFormResultUser thisRecord, IEnumerable <vFormResultUser> allRecords)
        {
            IQueryable <def_StatusLog> statusLogs = formsRepo
                                                    .GetStatusLogsForFormResultId(thisRecord.formResultId)
                                                    .Where(sl => sl.statusDetailIdTo.HasValue);
            List <CaFullReportRow> result = new List <CaFullReportRow>();

            foreach (def_StatusLog sl in statusLogs)
            {
                def_FileAttachment snapshot = formsRepo.GetFileAttachment(sl.statusLogId, 2);
                result.Add(new CaFullReportRow(formsRepo, allRecords, baseRow.formIdentifier, thisRecord, sl.statusLogDate, true, snapshot));
            }
            return(result);
        }