Beispiel #1
0
 private ActionResult CreateEditView(TSending sending)
 {
     AddReferenceDataToViewBag(ViewBag, sending);
     sending.LaboratoryNumber = sending.IsolateLaboratoryNumber
                                ?? ReportFormatter.ToLaboratoryNumber(GetNextSequentialIsolateNumber(), CurrentYear);
     return(View(sending));
 }
Beispiel #2
0
        protected override List <QueryRecord> QueryRecords()
        {
            var query = NotDeletedSendings().Select(x => new
            {
                x.MeningoSendingId,
                x.Isolate.MeningoIsolateId,
                x.Isolate.ReportStatus,
                x.Isolate.ReportDate,
                x.Patient.Initials,
                x.Patient.BirthDate,
                x.Isolate.StemNumber,
                x.ReceivingDate,
                x.SamplingLocation,
                x.OtherInvasiveSamplingLocation,
                x.OtherNonInvasiveSamplingLocation,
                x.Isolate.YearlySequentialIsolateNumber,
                x.Isolate.Year,
                x.SenderLaboratoryNumber,
                x.MeningoPatientId,
                PatientPostalCode = x.Patient.PostalCode,
                SenderPostalCode  = db.Senders.FirstOrDefault(s => s.SenderId == x.SenderId).PostalCode,
            });
            var queryRecords = query.ToList().Select(x =>
            {
                var invasive         = MeningoSending.IsInvasive(x.SamplingLocation) ? YesNo.Yes : YesNo.No;
                var samplingLocation = x.SamplingLocation == MeningoSamplingLocation.OtherInvasive
                    ? Server.HtmlEncode(x.OtherInvasiveSamplingLocation)
                    : x.SamplingLocation == MeningoSamplingLocation.OtherNonInvasive
                    ? Server.HtmlEncode(x.OtherNonInvasiveSamplingLocation)
                    : EnumEditor.GetEnumDescription(x.SamplingLocation);
                var laboratoryNumber = ReportFormatter.ToLaboratoryNumber(x.YearlySequentialIsolateNumber, x.Year, DatabaseType.Meningococci);
                return(new QueryRecord
                {
                    SendingId = x.MeningoSendingId,
                    IsolateId = x.MeningoIsolateId,
                    PatientId = x.MeningoPatientId,
                    Initials = x.Initials,
                    BirthDate = x.BirthDate,
                    StemNumber = x.StemNumber.ToStemNumberWithPrefix(DatabaseType.Meningococci),
                    ReceivingDate = x.ReceivingDate,
                    SamplingLocation = samplingLocation,
                    Invasive = EnumEditor.GetEnumDescription(invasive),
                    LaboratoryNumber = x.Year * 10000 + x.YearlySequentialIsolateNumber,
                    LaboratoryNumberString = laboratoryNumber,
                    ReportStatus = x.ReportStatus,
                    PatientPostalCode = x.PatientPostalCode,
                    SenderPostalCode = x.SenderPostalCode,
                    SenderLaboratoryNumber = x.SenderLaboratoryNumber,
                    FullTextSearch = string.Join(" ",
                                                 x.Initials, x.BirthDate.ToReportFormat(),
                                                 x.StemNumber.ToStemNumberWithPrefix(DatabaseType.Meningococci),
                                                 x.ReceivingDate.ToReportFormat(),
                                                 invasive, samplingLocation, laboratoryNumber,
                                                 x.PatientPostalCode, x.SenderPostalCode, x.SenderLaboratoryNumber, x.MeningoPatientId)
                                     .ToLower()
                });
            }).ToList();

            return(queryRecords);
        }