protected void Page_Load(object sender, EventArgs e) { string pagename = Path.GetFileName(Request.PhysicalPath); if (Session["admin"] != null) { string action = Request.QueryString["action"]; id = int.Parse(Request.QueryString["programmeid"]); if (!IsPostBack) { DBFunctions db = new DBFunctions(); if (action == "Disable") { db.disableeprogmme(id); Response.Redirect("ManagePrograms.aspx"); } else if (action == "Enable") { db.Enableeprogmme(id); Response.Redirect("ManagePrograms.aspx"); } else if (action == "update") { DropDownDept.DataSource = db.getalldepartments(); DropDownDept.DataValueField = "ID"; DropDownDept.DataTextField = "Department"; DropDownDept.DataBind(); Program_tbl program = db.getprogram(id); DropDownDept.SelectedValue = program.DeptID.ToString(); ProgrammeNametxt.Text = program.ProgramName; dropdownSecondChoise.SelectedValue = program.SecondChoice.ToString(); Cuttofpointstxt.Text = program.CutoffPoints; dropdownCampus.SelectedValue = program.HasCampus.ToString(); txtApplicationFee.Text = program.ApplicationFee; txtAcceptenceFee.Text = program.AcceptenceFee; txtFormCh.Text = program.FormCh; txtFormNum.Text = program.FormNumber; dropdownPrograms.SelectedValue = program.ProgramType; dropdownJamb.SelectedValue = program.HasJambData.ToString(); dropdownOlevel.SelectedValue = program.HasOlevelResult.ToString(); dropdownPreviousRecord.SelectedValue = program.HasPreviousRecord.ToString(); dropdownBioData.SelectedValue = program.HasBioDataSection.ToString(); dropdownCbtSchedule.SelectedValue = program.HasCBTSchedule.ToString(); } else if (action == "viewdetail") { } } } else { Response.Redirect("Login.aspx?Redirecturl=" + pagename); } }
private void setdepartments() { DBFunctions db = new DBFunctions(); Department_tbl dept = new Department_tbl { Department = "Select Department" }; var department = db.getalldepartments(); department.Add(dept); department = department.OrderBy(x => x.ID).ToList(); DropDownDept.DataSource = department; ListItem item = new ListItem(); DropDownDept.DataTextField = "Department"; DropDownDept.DataValueField = "ID"; DropDownDept.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string pagename = Path.GetFileName(Request.PhysicalPath); if (Session["admin"] != null) { DBFunctions db = new DBFunctions(); List <Program_tbl> programs = db.getprogramslist(); foreach (Program_tbl prg in programs) { programstbl.Text += "<tr><td>" + prg.ProgramName + "</td><td>" + prg.ProgramType + "</td><td>" + prg.Department_tbl.Department + "</td><td>" + prg.ApplicationFee + "</td><td>" + prg.AcceptenceFee + "</td><td>"; if (prg.Enable == true) { programstbl.Text += "<a href='#0' class='btn btn-danger btn-action Disable' data-id=" + prg.ID + ">Disable</a> "; } else { programstbl.Text += "<a href='#0' class='btn btn-primary btn-action Enable' data-id=" + prg.ID + ">Enable</a> "; } programstbl.Text += "<a href='#0' class='btn btn-primary btn-action update' data-id=" + prg.ID + ">Update</a></td></tr>"; } DropDownDept.DataSource = db.getalldepartments(); ListItem item = new ListItem(); item.Text = "Select Department"; item.Value = ""; DropDownDept.Items.Add(item); DropDownDept.DataTextField = "Department"; DropDownDept.DataValueField = "ID"; DropDownDept.DataBind(); } else { Response.Redirect("Login.aspx?Redirecturl=" + pagename); } }