public virtual void AddHistoria(Direccion dir, Poligono pol, DateTime?desde, DateTime?hasta) { var vigencia = new Vigencia(); if (desde.HasValue) { vigencia.Inicio = desde.Value; } if (hasta.HasValue) { vigencia.Fin = hasta.Value; } var historia = from HistoriaGeoRef h in Historia orderby h.Vigencia != null ? h.Vigencia.Inicio : DateTime.MinValue select h; foreach (var h in historia) { if (h.Vigencia == null) { h.Vigencia = new Vigencia(); } if (desde.HasValue && h.Vigencia.Vigente(desde.Value)) { h.Vigencia.Fin = desde.Value; } else if (hasta.HasValue && h.Vigencia.Vigente(hasta.Value)) { h.Vigencia.Inicio = hasta.Value; } } var newHistoria = new HistoriaGeoRef { ReferenciaGeografica = this, Direccion = dir, Poligono = pol, Vigencia = vigencia }; Historia.Add(newHistoria); }
public virtual void AddHistoria(Direccion dir, Poligono pol, DateTime?desde) { AddHistoria(dir, pol, desde, null); }