/// <summary> /// 保存关系人紧急联系人信息集合 /// </summary> /// <param name="emergencyContacts"></param> /// <param name="personId"></param> public void SaveEmergencyContacts(ICollection <EmergencyContact> emergencyContacts, string personId) { EmergencyContactAuditDAL ecdal = new EmergencyContactAuditDAL(); foreach (var ecmodel in emergencyContacts) { EmergencyContactAudit ecModel = new EmergencyContactAudit(); ecModel.ID = Guid.NewGuid().ToString(); ecModel.ContactType = ecmodel.ContactType; ecModel.ContactNumber = ecmodel.ContactNumber; ecModel.Name = ecmodel.Name; ecModel.PersonID = personId; ecmodel.Sequence = ecmodel.Sequence; ecdal.Add(ecModel); } }
public void SaveEmergencyContacts <T>(ICollection <EmergencyContact> emergencyContacts, string personId) where T : class, new() { Type type = typeof(T); if (type.Equals(typeof(EmergencyContactAudit))) { EmergencyContactAuditDAL ecdal = new EmergencyContactAuditDAL(); foreach (var ecmodel in emergencyContacts) { EmergencyContactAudit ecModel = new EmergencyContactAudit() { ID = Guid.NewGuid().ToString(), ContactType = ecmodel.ContactType, ContactNumber = ecmodel.ContactNumber, Name = ecmodel.Name, PersonID = personId, Sequence = ecmodel.Sequence }; ecdal.Add(ecModel); } } else if (type.Equals(typeof(EmergencyContact))) { EmergencyContactDAL ecdal = new EmergencyContactDAL(); foreach (var ecmodel in emergencyContacts) { EmergencyContact ecModel = new EmergencyContact() { ID = Guid.NewGuid().ToString(), ContactType = ecmodel.ContactType, ContactNumber = ecmodel.ContactNumber, Name = ecmodel.Name, PersonID = personId, Sequence = ecmodel.Sequence }; ecdal.Add(ecModel); } } }