コード例 #1
0
        public void MapToEntity(TreatmentReport treatmentReport, TreatmentReportEntity treatmentReportEntity)
        {
            if (treatmentReportEntity != null && treatmentReport != null)
            {
                treatmentReportEntity.Id         = treatmentReport.Id;
                treatmentReportEntity.Conclusion = treatmentReport.Conclusion;
                treatmentReportEntity.Comment    = treatmentReport.Comment;

                if (treatmentReport.CurrentTreatment != null)
                {
                    var treatmentEntity = new TreatmentEntity();
                    treatmentMapper.MapToEntity(treatmentReport.CurrentTreatment, treatmentEntity);
                    treatmentReportEntity.TreatmentId = treatmentEntity.Id;
                }

                if (treatmentReport.Medicines != null && treatmentReport.Medicines.Any())
                {
                    var medicineRepository = MedicineRepository.GetInstance();

                    foreach (var medicine in treatmentReport.Medicines)
                    {
                        var medicineEntity = medicineRepository.GetItemById(medicine.Id);
                        treatmentReportEntity.Medicines.Add(medicineEntity);
                    }
                }
            }
        }
コード例 #2
0
        public void MapToEntity(Operation operation, OperationEntity operationEntity)
        {
            if (operation != null && operationEntity != null)
            {
                operationEntity.Id          = operation.Id;
                operationEntity.TreatmentId = operation.TreatmentId;

                if (operation.CurrentTypeOperation != null)
                {
                    var typeOperationEntity = new TypeOperationEntity();
                    typeOperationMapper.MapToEntity(operation.CurrentTypeOperation, typeOperationEntity);
                    operationEntity.TypeOperationId = typeOperationEntity.Id;
                }

                if (operation.Medicines.Any())
                {
                    var medcicineRepository = MedicineRepository.GetInstance();

                    foreach (var medicine in operation.Medicines)
                    {
                        var medicineEntity = medcicineRepository.GetItemById(medicine.Id);
                        operationEntity.Medicines.Add(medicineEntity);
                    }
                }
            }
        }
コード例 #3
0
 public MedicineService()
 {
     medicineRepository = MedicineRepository.GetInstance();
     medicineMapper     = new MedicineMapper();
 }