public void SetMailDestinatari(IEnumerable <ContactsApplicationMapping> rows, AddresseeType addType) { if (rows != null && rows.Count() > 0) { if (this.RubricaEntitaUsed == null) { this.RubricaEntitaUsed = new List <RubrEntitaUsed>(); } try { rows.Select(cnt => { RubrEntitaUsed r = new RubrEntitaUsed(); if (cnt.IdContact > 0) { r.IdEntUsed = cnt.IdContact; } else { r.IdEntUsed = null; } r.Mail = cnt.Mail; r.Fax = cnt.Fax; r.Telefono = cnt.Telefono; if (cnt.RefIdReferral > 0) { r.IdReferral = cnt.RefIdReferral; } else { r.IdReferral = null; } r.TipoContatto = addType; return(r); }).ToList().ForEach(re => this.RubricaEntitaUsed.Add(re)); } catch { this.RubricaEntitaUsed = null; } this.AppCode = this.CodAppInserimento = rows.ElementAt(0).AppCode; this.ComCode = rows.ElementAt(0).ComCode; this.RefIdSottotitolo = rows.ElementAt(0).IdSottotitolo; this.Sottotitolo = rows.ElementAt(0).Sottotitolo; this.Titolo = rows.ElementAt(0).Titolo; } }
public RubrEntitaUsed(RubrEntitaUsed reu) { if (reu == null) { return; } Type t = this.GetType(); foreach (System.Reflection.PropertyInfo p in t.GetProperties()) { if (p.CanWrite) { p.SetValue(this, p.GetValue(reu, null), null); } } }