Exemplo n.º 1
0
        public AdaptRepresentation Map(int ddi)
        {
            if (_ddis.ContainsKey(ddi))
            {
                var matchingDdi     = _ddis[ddi];
                var representations = RepresentationManager.Instance.Representations.Where(x => x.Ddi.GetValueOrDefault() == matchingDdi.Id);
                if (representations.Any())
                {
                    //Default the representation mapping approprately on import
                    var representation = representations.FirstOrDefault(r => r.IsDefaultRepresentationForDDI)
                                         ??
                                         representations.First();

                    AdaptRepresentation adaptRep = GetADAPTRepresentation(representation);
                    if (adaptRep != null)
                    {
                        return(adaptRep);
                    }
                }

                return(new ApplicationDataModel.Representations.NumericRepresentation {
                    Code = ddi.ToString("X4"), CodeSource = RepresentationCodeSourceEnum.ISO11783_DDI
                });
            }
            return(null);
        }
Exemplo n.º 2
0
        public int?Map(AdaptRepresentation adapRepresentation)
        {
            if (adapRepresentation == null)
            {
                return(null);
            }

            var matchingRepresentation = RepresentationManager.Instance.Representations[adapRepresentation.Code];

            return(matchingRepresentation != null
                ? matchingRepresentation.Ddi
                : null);
        }
      protected override void Append(Representation.RepresentationSystem.NumericRepresentation representation, StringBuilder stringBuilder)
      {
         string representationName = representation.DomainId.Replace("\r", "")
                                                         .Replace("[", "")
                                                         .Replace("]", "")
                                                         .Replace("(", "")
                                                         .Replace(")", "")
                                                         .Replace("-", "")
                                                         .Replace("–", "")
                                                         .Replace(" ", "");

         stringBuilder.Append(String.Format(RepresentationPattern, typeof(NumericRepresentation).Name, representation.DomainId));
         stringBuilder.Append("\n\n");
      }
Exemplo n.º 4
0
        public AdaptRepresentation Map(int ddi)
        {
            if (_ddis.ContainsKey(ddi))
            {
                var matchingDdi    = _ddis[ddi];
                var representation = RepresentationManager.Instance.Representations.FirstOrDefault(x => x.Ddi.GetValueOrDefault() == matchingDdi.Id);

                AdaptRepresentation adaptRep = GetADAPTRepresentation(representation);
                if (adaptRep != null)
                {
                    return(adaptRep);
                }

                return(new ApplicationDataModel.Representations.NumericRepresentation {
                    Code = ddi.ToString("X4"), CodeSource = RepresentationCodeSourceEnum.ISO11783_DDI
                });
            }
            return(null);
        }
 protected override void Append(Representation.RepresentationSystem.EnumeratedRepresentation definedRepresentation, StringBuilder stringBuilder)
 {
    stringBuilder.Append(String.Format(RepresentationPattern, typeof(EnumeratedRepresentation).Name, definedRepresentation.DomainId));
    stringBuilder.Append("\n\n");
 }