private static void AddBusiness(SqlDataReader reader, FamilyMemberBusinessEthicsForConflict conflict) { conflict.familyMemberEthics.Add(new FamilyMemberBusinessWithEthics( reader["FamilyMember"].ToString() , reader["Description"].ToString() , reader["Business"].ToString() , reader["ConflictStatus"].ToString() )); }
private static void AddEthics(SqlDataReader reader, List <FamilyMemberBusinessEthicsForConflict> ethicsInfos) { var conflictId = reader["ConflictId"].ToString(); var business = reader["Business"].ToString(); var familyMember = reader["FamilyMember"].ToString(); if (business == "TRIBOROUGH NY BRIDGE & TUNNEL AUTH REVENUES GEN SER A RMKT, bonds") { business = "TRIBOROUGH NY BRIDGE & TUNNEL AUTH REVENUES GEN SER A RMKT, bonds"; } FamilyMemberBusinessEthicsForConflict lastConflict = (ethicsInfos.Count == 0) ? null : ethicsInfos.Last(); bool addConflict = ((lastConflict == null) || (lastConflict.conflictId != conflictId)); if (addConflict) { AddFamilyMemberBusinessEthicsForConflict(reader, ethicsInfos); lastConflict = ethicsInfos.Last(); } FamilyMemberBusinessWithEthics lastBusiness = null; if (lastConflict != null) { lastBusiness = (ethicsInfos.Last().familyMemberEthics.Count == 0) ? null : ethicsInfos.Last().familyMemberEthics.Last(); } bool addBusiness = ((lastBusiness == null) || ((lastConflict.familyMemberEthics.Last().business != business || (lastConflict.familyMemberEthics.Last().familyMember != familyMember)))); if (addBusiness) { AddBusiness(reader, ethicsInfos.Last()); lastBusiness = ethicsInfos.Last().familyMemberEthics.Last(); } lastBusiness.ethicsDocuments.Add(new EthicsDocumentForJson( reader["EthicsDocument"].ToString() , reader["EthicsDocumentDate"].ToString() , reader["EthicsDocumentLink"].ToString() )); //lastBusiness.ownerships.Add(new BusinessOwnershipForJson("1", "1", "1")); }