protected void btnaddprogramme_Click(object sender, EventArgs e) { DBFunctions db = new DBFunctions(); var checkcourse = db.getcourselist().Where(x => x.CourseCode == CourseCode.Text).FirstOrDefault(); if (checkcourse == null) { //Program_tbl prgram = new Program_tbl { ProgramName = ProgrammeNametxt.Text, SecondChoice = int.Parse(dropdownSecondChoise.SelectedValue), HasCampus = int.Parse(dropdownCampus.SelectedValue), ApplicationFee = txtApplicationFee.Text, FormNumber = txtFormCh.Text, ProgrameType = dropdownPrograms.SelectedValue, HasJambData = int.Parse(dropdownJamb.SelectedValue), HasBioDataSection = int.Parse(dropdownBioData.SelectedValue), HasPreviousRecord = int.Parse(dropdownPreviousRecord.SelectedValue), HasCBTSchedule = int.Parse(dropdownCbtSchedule.SelectedValue), HasOlevelResult = int.Parse(dropdownOlevel.SelectedValue), Enable = true, DeptID = int.Parse(DropDownDept.SelectedValue), CutoffPoints = Cuttofpointstxt.Text, DateCreated = DateTime.Now.Date, AcceptenceFee = txtAcceptenceFee.Text, FormCh = txtFormCh.Text }; Courses_tbl course = new Courses_tbl { Course = coursename.Text, Fee = Feetxt.Text, Marks = Markstxt.Text, Credit_Hours = int.Parse(CreditHours.Text), CourseCode = CourseCode.Text }; int cid = db.addcourse(course); foreach (ListItem chck in CheckBoxPrgramlist.Items) { if (chck.Selected) { ProgrammeCourses_tbl prgcrs = new ProgrammeCourses_tbl { ProgramID = int.Parse(chck.Value), CourseID = cid }; db.addprogrammecourse(prgcrs); } } messagae.Text = "Course Successfully Added"; messagae.Visible = true; // Response.Redirect("ManageCourses.aspx"); } else { messagae.Text = "Course Code Already Exist"; messagae.Visible = true; } }
protected void btnupdatecourse_Click(object sender, EventArgs e) { DBFunctions db = new DBFunctions(); //Program_tbl prgram = new Program_tbl { ID = id, ProgramName = ProgrammeNametxt.Text, SecondChoice = int.Parse(dropdownSecondChoise.SelectedValue), HasCampus = int.Parse(dropdownCampus.SelectedValue), ApplicationFee = txtApplicationFee.Text, FormNumber = txtFormNum.Text, ProgrameType = dropdownPrograms.SelectedValue, HasJambData = int.Parse(dropdownJamb.SelectedValue), HasBioDataSection = int.Parse(dropdownBioData.SelectedValue), HasPreviousRecord = int.Parse(dropdownPreviousRecord.SelectedValue), HasCBTSchedule = int.Parse(dropdownCbtSchedule.SelectedValue), HasOlevelResult = int.Parse(dropdownOlevel.SelectedValue), Enable = true, DeptID = int.Parse(DropDownDept.SelectedValue), CutoffPoints = Cuttofpointstxt.Text, DateCreated = DateTime.Now.Date, AcceptenceFee = txtAcceptenceFee.Text, FormCh = txtFormCh.Text }; Courses_tbl course = new Courses_tbl { ID = int.Parse(Request.QueryString["Courseid"]), Course = coursename.Text, Fee = Feetxt.Text, Marks = Markstxt.Text, CourseCode = CourseCode.Text, Credit_Hours = int.Parse(CreditHours.Text) }; db.updatecourse(course); db.clearprogramcourses(int.Parse(Request.QueryString["Courseid"])); foreach (ListItem item in checkbocprogamlist.Items) { if (item.Selected) { ProgrammeCourses_tbl programcourse = new ProgrammeCourses_tbl { CourseID = int.Parse(Request.QueryString["Courseid"]), ProgramID = int.Parse(item.Value) }; db.addprogrammecourse(programcourse); } } Response.Redirect("ManageCourses.aspx"); }
protected void btnaddprogramme_Click(object sender, EventArgs e) { DBFunctions db = new DBFunctions(); var checkcourse= db.getcourselist().Where(x => x.CourseCode == CourseCode.Text).FirstOrDefault(); if (checkcourse == null) { //Program_tbl prgram = new Program_tbl { ProgramName = ProgrammeNametxt.Text, SecondChoice = int.Parse(dropdownSecondChoise.SelectedValue), HasCampus = int.Parse(dropdownCampus.SelectedValue), ApplicationFee = txtApplicationFee.Text, FormNumber = txtFormCh.Text, ProgrameType = dropdownPrograms.SelectedValue, HasJambData = int.Parse(dropdownJamb.SelectedValue), HasBioDataSection = int.Parse(dropdownBioData.SelectedValue), HasPreviousRecord = int.Parse(dropdownPreviousRecord.SelectedValue), HasCBTSchedule = int.Parse(dropdownCbtSchedule.SelectedValue), HasOlevelResult = int.Parse(dropdownOlevel.SelectedValue), Enable = true, DeptID = int.Parse(DropDownDept.SelectedValue), CutoffPoints = Cuttofpointstxt.Text, DateCreated = DateTime.Now.Date, AcceptenceFee = txtAcceptenceFee.Text, FormCh = txtFormCh.Text }; Courses_tbl course = new Courses_tbl { Course = coursename.Text, Fee = Feetxt.Text, Marks = Markstxt.Text, Credit_Hours = int.Parse(CreditHours.Text), CourseCode = CourseCode.Text }; int cid = db.addcourse(course); foreach (ListItem chck in CheckBoxPrgramlist.Items) { if (chck.Selected) { ProgrammeCourses_tbl prgcrs = new ProgrammeCourses_tbl { ProgramID = int.Parse(chck.Value), CourseID = cid }; db.addprogrammecourse(prgcrs); } } messagae.Text = "Course Successfully Added"; messagae.Visible = true; // Response.Redirect("ManageCourses.aspx"); } else { messagae.Text = "Course Code Already Exist"; messagae.Visible = true; } }
public void addprogrammecourse(ProgrammeCourses_tbl prgcrs) { db = new CollegeERPDBEntities(); db.ProgrammeCourses_tbl.Add(prgcrs); db.SaveChanges(); }