Beispiel #1
0
        public async Task <IEnumerable <string> > GenerateFiles([FromRoute] int scheduleId)
        {
            List <PharmBatch> batches = await _context.PharmBatch.Where(x => x.ScheduleId == scheduleId).ToListAsync();

            foreach (PharmBatch batch in batches)
            {
                PharmHeader header = await _context.PharmHeader.FirstOrDefaultAsync(x => x.BatchId == batch.BatchId);

                if (header == null)
                {
                    continue;
                }
                ExportHeader(ref header);
                List <PharmDE> details = await _context.PharmDE.Where(x => x.BatchId == batch.BatchId).ToListAsync();

                if (details.Count() == 0)
                {
                    continue;
                }

                foreach (PharmDE detail in details)
                {
                    PharmDE refDetail = detail;
                    ExportDetail(ref refDetail);
                    PharmCD1 compound1 = await _context.PharmCD1.FirstOrDefaultAsync(x => x.DetailID == detail.DetailID);

                    if (compound1 != null)
                    {
                        ExportCompound1(ref compound1);
                        PharmCD2 compound2 = await _context.PharmCD2.FirstOrDefaultAsync(x => x.DetailID == detail.DetailID);

                        if (compound2 != null)
                        {
                            ExportCompound2(ref compound2);
                        }
                    }
                }
                ExportTrailer(ref header);
            }
            return(new string[] { "pharmacy", "file generation complete" });
        }
Beispiel #2
0
 private void ExportCompound1(ref PharmCD1 compound1)
 {
 }