/// <summary> /// Costruttore della classe. /// </summary> /// <param name="richiesta">E' la richiesta di assistenza a cui si aggiunge l'evento</param> /// <param name="istante">L'istante in cui avviene l'evento.</param> /// <param name="codiceFonte">Il codice della fonte informativa dell'evento.</param> public Evento(RichiestaAssistenza richiesta, DateTime istante, string codiceFonte, string tipoEvento, string SedeOperatore = "") { if (richiesta == null) { throw new ArgumentNullException(nameof(richiesta)); } if (istante == DateTime.MinValue) { throw new ArgumentOutOfRangeException(nameof(istante)); } if (string.IsNullOrWhiteSpace(codiceFonte)) { throw new ArgumentException("Cannot be null or whitespace", nameof(CodiceFonte)); } this.Istante = istante; this.CodiceFonte = codiceFonte; this.IstanteCreazione = DateTime.UtcNow; this.CodiceRichiesta = richiesta.Codice; this.TipoEvento = tipoEvento; this.SedeOperatore = SedeOperatore; this.DataOraInserimento = DateTime.Now; richiesta.AddEvento(this); }
/// <summary> /// Costruttore della classe. /// </summary> /// <param name="richiesta">E' la richiesta di assistenza a cui si aggiunge l'evento</param> /// <param name="istante">L'istante in cui avviene l'evento.</param> /// <param name="codiceFonte">Il codice della fonte informativa dell'evento.</param> public Evento(RichiestaAssistenza richiesta, DateTime Istante, string CodiceFonte) { if (richiesta == null) { throw new ArgumentNullException(nameof(richiesta)); } //if (istante == DateTime.MinValue) //{ // throw new ArgumentOutOfRangeException(nameof(istante)); //} //if (string.IsNullOrWhiteSpace(codiceFonte)) //{ // throw new ArgumentException("Cannot be null or whitespace", nameof(CodiceFonte)); //} this.Istante = Istante; this.CodiceFonte = CodiceFonte; richiesta.AddEvento(this); this.IstanteCreazione = DateTime.UtcNow; this.CodiceRichiesta = richiesta.Codice; }