protected void ModifySubmit_Click2(object sender, EventArgs e) { if (!IsPostBack) { Student s = RequestDirector.FindStudent(Student_ID.Text); if (s != null) { FirstName.Text = s.FirstName; LastName.Text = s.LastName; Email.Text = s.Email; Response.Write("<script>alert(\"Successfully Found Student\")</script>"); } else { Response.Write("<script>alert(\"Did not find Student\")</script>"); } } else { Student s = RequestDirector.FindStudent(Student_ID.Text); if (s != null) { s.FirstName = FirstName.Text; s.LastName = LastName.Text; s.Email = Email.Text; RequestDirector.ModifyStudent(s); Response.Write("<script>alert(\"Student Modified Successfully\")</script>"); } else { Response.Write("<script>alert(\"Did not modify student\")</script>"); } } }
protected void Remove_Click(object sender, EventArgs e) { Student s = RequestDirector.FindStudent(Student_ID.Text); RequestDirector.RemoveStudent(s); Response.Write("Student Removed"); }
protected void submit_Click(object sender, EventArgs e) { Student s = new Student(); s.StudentID = Student_ID.Text; s.FirstName = FirstName.Text; s.LastName = LastName.Text; s.Email = Email.Text; //should add a check to see if program exists. Either here of the called procedure RequestDirector.EnrollStudent(s, Program_Code.Text); Response.Write("<script> alert(\"Student Enrolled Successfully\")</script>"); }
protected void submit_Click(object sender, EventArgs e) { try { Program p = new Program(); p.ProgramCode = Program_Code.Text; p.Description = Description.Text; RequestDirector.CreateProgram(Program_Code.Text, Description.Text); Response.Write("<script>alert(\"Successfully added Program\")</script>"); } catch (SqlException ex) { Response.Write(ex.StackTrace); } }
protected void Find_Click(object sender, EventArgs e) { try { Student s = RequestDirector.FindStudent(Student_ID.Text); if (s != null) { Response.Write("<script>alert(\"" + s.ProgramCode + " was found in the system\")"); } else { Response.Write("<script>alert(\"Student was not found in the system\")"); } } catch (SqlException ex) { Response.Write("<script>alert(\"Student was not found in the system\")"); } }
protected void ModifySubmit_Click(object sender, EventArgs e) { //modify by using a common student object in the session? Student s = new Classes.Student(); if (s != null) { details.Visible = true; s.StudentID = Student_ID.Text; s.FirstName = FirstName.Text; s.LastName = LastName.Text; s.Email = Email.Text; RequestDirector.ModifyStudent(s); Response.Write("<script>alert(\"Student Modified Successfully\")</script>"); } else { Response.Write("<script>alert(\"Did not modify student\")</script>"); } }
protected void Locate_Student(object sender, EventArgs e) { try { Student s = RequestDirector.FindStudent(target_student.Text); if (s != null) { details.Visible = true; Response.Write("<script>alert(\"Found the Queryed student\")</script>"); Student_ID.Text = s.StudentID; FirstName.Text = s.FirstName; LastName.Text = s.LastName; Email.Text = s.Email; } else { Response.Write("<script>alert(\"Couldn't find the Queryed student\")</script>"); } } catch (SqlException ex) { Response.Write("<script>alert(\"Did not modify student, There was a backed error\")</script>"); } }
protected void Find_Click(object sender, EventArgs e) { try { Program prog = RequestDirector.FindProgram(Program_Code.Text); if (prog != null) { Session.Add("Found_Program", prog); Response.Write("<script>alert(\"Successfully Found Program: " + prog.ProgramCode + "\")</script>"); } else { Response.Write("Program not found"); } } catch (SqlException err) { Response.Write(err.Message); } catch (Exception ex) { Response.Write(ex.StackTrace); } }