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

            int moduleID = 0;
            string htmlOutput = "";

            List<Module> listModules = moduleHandler.GetModuleList(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 enabled on the system</div>";
            else
            {
                htmlOutput = "<thead><tr><th>Module code <i class='fa fa-sort'></i></th><th>Start month & year <i class='fa fa-sort'></i></th><th>Student list</th><th>Disable module</th></tr></thead>";
                //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>" + listModules[i].Date.ToString("MM / yyyy") + " </td><td><a href=\"ViewStudents.aspx?module=" + listModules[i].ModuleID + "\">View</a></td><td><a href=\"DisableModule.aspx?id=" + listModules[i].ModuleID + "\"/>Disable</a></td></tr>\n";
                }
            }
            litModuleList.Text = htmlOutput;
        }
        protected void btnAddModule_Click(object sender, EventArgs e)
        {
            if (lstLecturers.SelectedIndex == -1)
            {
                lblLecturer.Text = "You must first select a lecturer from the box above.";
            }
            else
            {
                int lecturerID = Convert.ToInt32(lstLecturers.SelectedValue);
                int lastID = 0;

                Module newModule = new Module();
                newModule.ModuleCode = txtModuleCode.Value;
                newModule.LecturerID = lecturerID;
                newModule.Date = Convert.ToDateTime(dateSelect.Value);

                ModuleHandler moduleHandler = new ModuleHandler();

                lastID = moduleHandler.AddNewModule(newModule);
                if (lastID > 0)
                {
                    litAlert.Text = "<div class='alert alert-success'>Module added</div>";

                    Response.Redirect("AddStudents.aspx?module=" + lastID);
                }
                else
                {
                    litAlert.Text = "<div class='alert alert-danger'>Failed to add module</div>";
                }

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string htmlOutput = "";
            int moduleID = Convert.ToInt32(Request.QueryString["module"]);

            //get module name
            ModuleHandler moduleHandler = new ModuleHandler();
            Module module = new Module();
            module = moduleHandler.GetModuleDetails(Convert.ToInt32(moduleID));

            litHeader.Text = "<div class='alert alert-info'>" + module.ModuleCode + "</div>";

            StudentHandler studentHandler = new StudentHandler();
            List<Student> listStudents = studentHandler.GetStudentList(moduleID);

            //Check to make sure there is students in the system assigned to the module
            if (listStudents == null)
                litHeader.Text = "<h3>There are currently no students linked to this module</h3>";
            else
            {
                htmlOutput = "<tr><th>Student number</th><th>Firstname</th><th>Surname</th></tr>\n";
                //add modules to table as it is generated
                for (int i = 0; i < listStudents.Count; i++)
                {
                    htmlOutput += "<tr><td>" + listStudents[i].StudentNumber + "</td><td>" + listStudents[i].FirstName + "</td><td>" + listStudents[i].Surname + "</td></tr>\n";
                }
            }
            litStudentList.Text = htmlOutput;
        }
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            ModuleHandler moduleHandler = new ModuleHandler();

            moduleHandler.DisableModule(moduleID);
            Response.Redirect("Modules.aspx");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            moduleID = Convert.ToInt32(Request.QueryString["id"]);

            //get module name
            ModuleHandler moduleHandler = new ModuleHandler();
            Module module = new Module();
            module = moduleHandler.GetModuleDetails(Convert.ToInt32(moduleID));

            litHeader.Text = "<div class='alert alert-info'>" + module.ModuleCode + "</div>";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //display list of modules linked to the lecturer
            int lecturerID = Convert.ToInt32(Session["LecturerID"]);
            ModuleHandler moduleHandler = new ModuleHandler();

            if (!Page.IsPostBack)
            {
                dlModules.DataSource = moduleHandler.GetModuleList(lecturerID);
                dlModules.DataTextField = "ModuleCode";
                dlModules.DataValueField = "ModuleID";
                dlModules.DataBind();
            }
        }
        //get module roll calls
        // GET api/mobile/1
        public List<TempModule> Get(string lecturer)
        {
            int lecturerID = Convert.ToInt32(lecturer);

            //generate a table to list all modules
            ModuleHandler moduleHandler = new ModuleHandler();

            List<Module> listModules = moduleHandler.GetModuleList(lecturerID);
            List<TempModule> newTempModules = new List<TempModule>();
            TempModule tempModule;
            //add modules to table as it is generated
            for (int i = 0; i < listModules.Count; i++)
            {
                tempModule = new TempModule();
                tempModule.ModuleID = listModules[i].ModuleID;
                tempModule.ModuleCode = listModules[i].ModuleCode;
                newTempModules.Add(tempModule);
                //moduleID = listModules[i].ModuleID;
                //htmlOutput += "<tr><td>" + listModules[i].ModuleCode + "</td><td>" + listModules[i].Date.ToString("MM / yyyy") + " </td><td><a href=\"ViewStudents.aspx?module=" + listModules[i].ModuleID + "\">View</a></td><td><a href=\"DisableModule.aspx?id=" + listModules[i].ModuleID + "\"/>Disable</a></td></tr>\n";
            }

            return newTempModules;
        }
예제 #8
0
        protected void btnAddModule_Click(object sender, EventArgs e)
        {
            int lastID = 0;

            Module newModule = new Module();
            newModule.ModuleCode = txtModuleCode.Value;
            newModule.LecturerID = Convert.ToInt32(Session["lecturerID"]);
            newModule.Date = DateTime.Now;

            ModuleHandler moduleHandler = new ModuleHandler();

            lastID = moduleHandler.AddNewModule(newModule);
            if (lastID > 0)
            {
                litHeader.Text = "Module added";

                Response.Redirect("AddStudents.aspx?module=" + lastID);
            }
            else
            {
                litHeader.Text = "Failed to add module";
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     int lecturerID = Convert.ToInt32(Session["LecturerID"]);
     ModuleHandler moduleHandler = new ModuleHandler();
     //litAutoDisable.Text = "<input id='txtTime' runat='server' class='form - control required - field' placeholder='Minutes' type='time' required='required'/> <input id = 'txtDate' runat = 'server' class='form - control required - field' placeholder='Date' type='date' required='required'/><br /><br />";
     if (!Page.IsPostBack)
     {
         dlModules.DataSource = moduleHandler.GetModuleList(lecturerID);
         dlModules.DataTextField = "ModuleCode";
         dlModules.DataValueField = "ModuleID";
         dlModules.DataBind();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            //get list of modules to select from
            int lecturerID = Convert.ToInt32(Session["LecturerID"]);
            ModuleHandler moduleHandler = new ModuleHandler();

            if (!Page.IsPostBack)
            {
                dlModules.DataSource = moduleHandler.GetModuleList(lecturerID);
                dlModules.DataTextField = "ModuleCode";
                dlModules.DataValueField = "ModuleID";
                dlModules.DataBind();

                dlModules_SelectedIndexChanged(null, null);
            }
        }