Пример #1
0
 public static JObject ToJson(VegSample samp)
 {
     if (samp != null)
     {
         JObject o = new JObject();
         o.Add(JsonUtils.Id, JsonUtils.ToJson(samp.Identity));
         o.Add("vegsurveyid", JsonUtils.ToJson(samp.VegSurveyId));
         o.Add("siteid", JsonUtils.ToJson(samp.SiteId));
         if (samp.When != null)
         {
             o.Add("when", samp.When);
         }
         if (samp.Location != null)
         {
             o.Add("location", samp.Location.ToString());
         }
         if (samp.ElevationRange != null)
         {
             o.Add("elevationmin", samp.ElevationRange.Min);
             o.Add("elevationmax", samp.ElevationRange.Max);
         }
         return(o);
     }
     return(null);
 }
Пример #2
0
        //\"Id\", \"VegSampleId\", \"TaxaUnitSystemId\", \"TaxaUnitId\", \"Dbh\", \"Description\"
        public TreeSample Build(DbDataReader reader)
        {
            TreeSample tmp = new TreeSample((Guid)reader[0], DbReaderUtils.GetGuid(reader, 1), new CompoundIdentity(DbReaderUtils.GetGuid(reader, 2), DbReaderUtils.GetGuid(reader, 3)),
                                            DbReaderUtils.GetSingle(reader, 4), DbReaderUtils.GetString(reader, 5));

            if (!seen.Contains(tmp.VegSampleId))
            {
                seen.Add(tmp.VegSampleId);
                VegSample e = this.helperBuilder.Get(tmp.VegSampleId);
                if (e != null)
                {
                    got.Add(tmp.VegSampleId);
                }
            }

            if (!got.Contains(tmp.VegSampleId))
            {
                return(null);
            }

            return(tmp);
        }