コード例 #1
0
ファイル: ManifestDto.cs プロジェクト: koskedk/dwapi-mnch
        public static ExtractDto Generate(List <Cargo> cargoBox)
        {
            var extractDto = new ExtractDto();

            var cargoes = cargoBox.Where(x =>
                                         x.Type == CargoType.AppMetrics &&
                                         x.Items.Contains("MnchService") &&
                                         x.Items.Contains("ExtractCargos"))
                          .Select(c => c.Items)
                          .ToList();

            foreach (var cargo in cargoes)
            {
                var temp = JsonConvert.DeserializeObject <ExtractDto>(cargo);
                if (null != temp && !string.IsNullOrWhiteSpace(temp.LogValue))
                {
                    extractDto = JsonConvert.DeserializeObject <ExtractDto>(temp.LogValue);
                    if (extractDto.ExtractCargos.Any())
                    {
                        return(extractDto);
                    }
                }
            }

            return(extractDto);
        }
コード例 #2
0
ファイル: ManifestDto.cs プロジェクト: koskedk/dwapi-mnch
        public ManifestDto(Manifest manifest, int count)
        {
            Id           = manifest.Id;
            FacilityCode = manifest.SiteCode;
            FacilityName = manifest.Name;
            Docket       = "MNCH";
            LogDate      = manifest.DateLogged;
            BuildDate    = manifest.DateArrived;
            PatientCount = count;
            Session      = manifest.Session;
            Start        = manifest.Start;
            End          = manifest.End;
            Tag          = manifest.Tag;
            var cargoes            = manifest.Cargoes.Where(x => x.Type != CargoType.Patient).ToList();
            var serializerSettings = new JsonSerializerSettings()
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };

            if (cargoes.Any())
            {
                Cargo = JsonConvert.SerializeObject(ExtractDto.GenerateCargo(cargoes), serializerSettings);
            }
        }