コード例 #1
0
        protected void populateTableDisabledModules()
        {
            int lecturerID = Convert.ToInt32(Session["lecturerID"]);
            litAlert.Text = "";
            //generate a table to list all modules
            ModuleHandler moduleHandler = new ModuleHandler();

            int moduleID = 0;
            string htmlOutput = "<thead><tr><th>Module code <i class='fa fa-sort'></i></th><th>Student list</th><th>Enable module</th></tr></thead>";

            List<Module> listModules = moduleHandler.GetDisabledModuleList(lecturerID);

            //Check to make sure there is modules in the system assigned to the lecturer
            if (listModules == null)
                litAlert.Text = "<div class='alert alert-warning'>There are currently no modules disabled on the system</div>";

            else
            {
                //add modules to table as it is generated
                for (int i = 0; i < listModules.Count; i++)
                {
                    moduleID = listModules[i].ModuleID;
                    htmlOutput += "<tr><td>" + listModules[i].ModuleCode + "</td><td><a href=\"ViewStudents.aspx?module=" + listModules[i].ModuleID + "\"/>View</a></td><td><a href=\"EnableModule.aspx?id=" + listModules[i].ModuleID + "\"/>Enable</a></td></tr>\n";
                }
            }
            litModuleList.Text = htmlOutput;
        }