private void LoadContacts(ISheet sheet, int rowStartIndex, List <Contact> contacts) { ICell organizationCell = sheet.GetRow(rowStartIndex).GetCell(0); ICell assignmentCell = sheet.GetRow(rowStartIndex).GetCell(1); ICell nameCell = sheet.GetRow(rowStartIndex).GetCell(2); ICell emailCell = sheet.GetRow(rowStartIndex).GetCell(3); ICell phoneCell = sheet.GetRow(rowStartIndex).GetCell(4); ICell skypeCell = sheet.GetRow(rowStartIndex).GetCell(5); while (GetCellValue(organizationCell) != null) { Contact contact = new Contact(); contact.Organization = GetCellValue(organizationCell); while (GetCellValue(assignmentCell) != null) { ContactAssignment contactAssignment = new ContactAssignment(); contactAssignment.Assignment = GetCellValue(assignmentCell); while (GetCellValue(nameCell) != null) { ContactItem contactItem = new ContactItem(); contactItem.Name = GetCellValue(nameCell); contactItem.Email = GetCellValue(emailCell); contactItem.Phone = GetCellValue(phoneCell); contactItem.Skype = GetCellValue(skypeCell); contactAssignment.ContactList.Add(contactItem); rowStartIndex++; IRow rowObj = sheet.GetRow(rowStartIndex); if (rowObj == null) { nameCell = null; break; } organizationCell = sheet.GetRow(rowStartIndex).GetCell(0); assignmentCell = sheet.GetRow(rowStartIndex).GetCell(1); nameCell = sheet.GetRow(rowStartIndex).GetCell(2); emailCell = sheet.GetRow(rowStartIndex).GetCell(3); phoneCell = sheet.GetRow(rowStartIndex).GetCell(4); skypeCell = sheet.GetRow(rowStartIndex).GetCell(5); if (GetCellValue(assignmentCell) != null) { break; } } contact.ContactAssignment.Add(contactAssignment); if (GetCellValue(organizationCell) != null) { break; } } contacts.Add(contact); } }
private void LoadContacts(ISheet sheet, int rowStartIndex, List<Contact> contacts) { ICell organizationCell = sheet.GetRow(rowStartIndex).GetCell(0); ICell assignmentCell = sheet.GetRow(rowStartIndex).GetCell(1); ICell nameCell = sheet.GetRow(rowStartIndex).GetCell(2); ICell emailCell = sheet.GetRow(rowStartIndex).GetCell(3); ICell phoneCell = sheet.GetRow(rowStartIndex).GetCell(4); ICell skypeCell = sheet.GetRow(rowStartIndex).GetCell(5); while (GetCellValue(organizationCell) != null) { Contact contact = new Contact(); contact.Organization = GetCellValue(organizationCell); while (GetCellValue(assignmentCell) != null) { ContactAssignment contactAssignment= new ContactAssignment(); contactAssignment.Assignment = GetCellValue(assignmentCell); while (GetCellValue(nameCell) != null) { ContactItem contactItem = new ContactItem(); contactItem.Name = GetCellValue(nameCell); contactItem.Email = GetCellValue(emailCell); contactItem.Phone = GetCellValue(phoneCell); contactItem.Skype = GetCellValue(skypeCell); contactAssignment.ContactList.Add(contactItem); rowStartIndex++; IRow rowObj = sheet.GetRow(rowStartIndex); if (rowObj == null) { nameCell = null; break; } organizationCell = sheet.GetRow(rowStartIndex).GetCell(0); assignmentCell = sheet.GetRow(rowStartIndex).GetCell(1); nameCell = sheet.GetRow(rowStartIndex).GetCell(2); emailCell = sheet.GetRow(rowStartIndex).GetCell(3); phoneCell = sheet.GetRow(rowStartIndex).GetCell(4); skypeCell = sheet.GetRow(rowStartIndex).GetCell(5); if (GetCellValue(assignmentCell) != null) { break; } } contact.ContactAssignment.Add(contactAssignment); if (GetCellValue(organizationCell) != null) { break; } } contacts.Add(contact); } }