public List <List <string> > GetGroupProjectSelectionSpreadsheetData(int courseId)
        {
            IProjectChoiceRepository    projectChoiceRepository = new ProjectChoiceRepository();
            IEnumerable <ProjectChoice> projectChoices          = new List <ProjectChoice>();
            List <string>         studentProjectChoices         = new List <string>();
            List <string>         rowData    = new List <string>();
            List <List <string> > columnData = new List <List <string> >();
            int totalNumberOfProjects        = new ProjectRepository().GetAvailableProjects(courseId).Count();

            try
            {
                using (var connection = GetConnection())
                {
                    var students = new StudentRepository().GetGroupSortedStudents(courseId);
                    foreach (Student s in students)
                    {
                        if (s.group_id == null && s.group_role == null)
                        {
                            continue;
                        }
                        var group = GetGroup((int)s.group_id);
                        studentProjectChoices = new List <string>();
                        if (s.group_role == "1")
                        {
                            projectChoices = projectChoiceRepository.GetProjectChoicesByStudentId(s.student_id);
                            foreach (ProjectChoice pc in projectChoices)
                            {
                                studentProjectChoices.Add(pc.ranking_precedence.ToString());
                            }
                        }
                        else
                        {
                            for (int i = 0; i < totalNumberOfProjects; ++i)
                            {
                                studentProjectChoices.Add("");
                            }
                        }
                        rowData = new List <string>();
                        rowData.Add(group.GetType().GetProperty("groupNumber").GetValue(group, null).ToString());
                        rowData.Add(s.admin_number);
                        rowData.Add(s.full_name);
                        rowData.Add(s.mobile_number);
                        rowData.Add(s.email_address);
                        rowData.AddRange(studentProjectChoices);
                        columnData.Add(rowData);
                    }
                    return(columnData);
                }
            }
            catch
            {
                throw;
            }
        }
        public List <List <string> > GetGroupProjectSelectionSpreadsheetData()
        {
            int courseId = 1; // Assume that this course id was retrieved from the session
            IStudentRepository          studentRepository       = new StudentRepository();
            IProjectChoiceRepository    projectChoiceRepository = new ProjectChoiceRepository();
            IEnumerable <ProjectChoice> projectChoices          = new List <ProjectChoice>();
            List <string>         studentProjectChoices         = new List <string>();
            List <string>         temporaryList = new List <string>();
            List <List <string> > allData       = new List <List <string> >();

            try
            {
                using (var conn = GetConnection())
                {
                    conn.Open();
                    var students = studentRepository.GetStudents(courseId);
                    foreach (Student s in students)
                    {
                        if (s.group_id == null && s.group_role == null)
                        {
                            continue;
                        }
                        var group = GetGroup((int)s.group_id);
                        studentProjectChoices = new List <string>();
                        if (s.group_role == "1")
                        {
                            projectChoices = projectChoiceRepository.GetProjectChoicesByStudentId(s.student_id);
                            foreach (ProjectChoice pc in projectChoices)
                            {
                                studentProjectChoices.Add(pc.ranking_precedence.ToString());
                            }
                        }
                        else
                        {
                            studentProjectChoices.AddRange(new string[] { "", "", "", "" });
                        }
                        temporaryList = new List <string>();
                        temporaryList.Add(group.GetType().GetProperty("groupNumber").GetValue(group, null).ToString());
                        temporaryList.Add(s.admin_number);
                        temporaryList.Add(s.full_name);
                        temporaryList.Add(s.mobile_number);
                        temporaryList.Add(s.email_address);
                        temporaryList.AddRange(studentProjectChoices);
                        allData.Add(temporaryList);
                    }
                    return(allData);
                }
            }
            catch
            {
                throw;
            }
        }