private void match() { foreach (Department d in _dicMenteeDepartment.Keys) { List <Mentor> lstmentors = _dicMentorDepartment[d]; List <Mentee> lstmentees = _dicMenteeDepartment[d]; int mentorCount = 0; for (int i = 0; i < lstmentees.Count; i++) { Mentee objMentee = lstmentees[i]; Mentor objMentor = null; if (mentorCount > lstmentors.Count - 1) { mentorCount = 0; } objMentor = lstmentors[mentorCount]; mentorCount++; Matched objMatched = new Matched(); objMatched.MenteeName = objMentee.Name; objMatched.MenteeDept = objMentee.Dept; objMatched.MenteeUscId = objMentee.UscId; objMatched.MenteeContact = objMentee.Contact; objMatched.MentorName = objMentor.Name; objMatched.MentorDept = objMentor.Dept; objMatched.MentorUscId = objMentor.UscId; objMatched.MentorContact = objMentor.Contact; _lstFinal.Add(objMatched); } } }
private void populateMentees(string path, RoleType rType) { OfficeOpenXml.ExcelWorksheet ws = readExcel(path); for (int rowNum = 2; rowNum <= ws.Dimension.End.Row; rowNum++)//foreach mentee { var wsRow = ws.Cells[rowNum, ws.Dimension.End.Column]; if (wsRow["B" + rowNum].Text.Trim() == string.Empty) { continue; } Mentee objMentee = new Mentee(); objMentee.Name = wsRow["B" + rowNum].Text.Trim(); objMentee.Dept = setDept(wsRow["C" + rowNum].Text.Trim()); objMentee.UscId = wsRow["D" + rowNum].Text.Trim(); objMentee.Contact = wsRow["E" + rowNum].Text.Trim(); if (!_dicMenteeDepartment.ContainsKey(objMentee.Dept)) { List <Mentee> lstMentees = new List <Mentee>(); lstMentees.Add(objMentee); _dicMenteeDepartment.Add(objMentee.Dept, lstMentees); } else { List <Mentee> lstMentees = _dicMenteeDepartment[objMentee.Dept]; lstMentees.Add(objMentee); } } }