protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                Page.Validate();
                if (Page.IsValid)
                {
                    string Adding_StudentFname  = adding_studentfname.Text.ToString();
                    string Adding_StudentLname  = adding_studentlname.Text.ToString();
                    string Adding_StudentNumber = adding_studentnumber.Text.ToString();
                    //string Adding_StudentEnrolmentDate = adding_studentenrolmentdate.Text.ToString();

                    Adding_Summary.InnerHtml  = "You have added the following student in the system: <br>";
                    Adding_Summary.InnerHtml += "First Name: " + Adding_StudentFname + "<br>";
                    Adding_Summary.InnerHtml += "Last Name: " + Adding_StudentLname + "<br>";
                    Adding_Summary.InnerHtml += "Student Number: " + Adding_StudentNumber + "<br>";
                    Adding_Summary.InnerHtml += "Please go back to " + "<a href=\"ListStudents.aspx\">" + "Students page " + "</a>" + "to check.";
                    //Adding_Summary.InnerHtml += "Student Enrolment Date: " + Adding_StudentEnrolmentDate + "<br>";

                    string query = "insert into students (STUDENTFNAME, STUDENTLNAME, STUDENTNUMBER) values (";


                    query += "'" + Adding_StudentFname + "'" + ", ";
                    query += "'" + Adding_StudentLname + "'" + ", ";
                    query += "'" + Adding_StudentNumber + "'" + ")";
                    //query += "'" + Adding_StudentEnrolmentDate + "'" + ")";

                    sql_debugger.InnerHtml = query;
                    var db  = new SCHOOLDB();
                    int add = db.Modify_Query(query);
                    List <Dictionary <String, String> > rs = db.List_Query(query);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool   valid     = true;
            string teacherid = Request.QueryString["teacherid"];

            if (String.IsNullOrEmpty(teacherid))
            {
                valid = false;
            }


            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> teacher_record = db.FindTeacher(Int32.Parse(teacherid));

                if (teacher_record.Count > 0)
                {
                    teacher_fname_edit.InnerHtml = teacher_record["TEACHERFNAME"] + " " + teacher_record["TEACHERLNAME"];
                }
                else
                {
                    valid = false;
                }
            }

            if (!valid)
            {
                teacher.InnerHtml = "There was an error finding that teacher.";
            }
            teachersubmit_btn.PostBackUrl = "~/Listteachers.aspx";
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //declare what we are looking for
            bool   valid    = true;
            string class_id = Request.QueryString["classid"];

            // validating if statements
            if (String.IsNullOrEmpty(class_id))
            {
                valid = false;
            }

            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> class_info = db.FindClass(Int32.Parse(class_id));

                if (class_info.Count > 0)
                {
                    class_name.InnerHtml = class_info["CLASSNAME"];
                    class_code.InnerHtml = class_info["CLASSCODE"];
                    start_date.InnerHtml = class_info["STARTDATE"];
                    end_date.InnerHtml   = class_info["FINISHDATE"];
                }
                else
                {
                    valid = false;
                }
            }

            if (!valid)
            {
                class_detail.InnerHtml = "There was an error finding that student.";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool   valid     = true;
            string studentid = Request.QueryString["studentid"];

            if (String.IsNullOrEmpty(studentid))
            {
                valid = false;
            }


            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> student_record = db.FindStudent(Int32.Parse(studentid));

                if (student_record.Count > 0)
                {
                    student_title_fname.InnerHtml = student_record["STUDENTFNAME"] + " " + student_record["STUDENTLNAME"];
                }
                else
                {
                    valid = false;
                }
            }

            if (!valid)
            {
                student.InnerHtml = "There was an error finding that student.";
            }
            studentsubmit_btn.PostBackUrl = "~/ShowStudent.aspx?studentid=" + studentid;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            /*
             *  An alternate way to fetch data without the SCHOOLDB.cs class
             *  https://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-sql-command.html
             */

            string query = "select * from students";
            var    db    = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                Button deleteButton = new Button();
                deleteButton.ID            = "deleteStudentWithID";
                deleteButton.Text          = "X";
                students_result.InnerHtml += "<div class=\"listitem\">";

                string studentfirstname = row["STUDENTFNAME"];
                students_result.InnerHtml += "<div class=\"col5\">" + studentfirstname + "</div>";

                string studentlastname = row["STUDENTLNAME"];
                students_result.InnerHtml += "<div class=\"col5\">" + studentlastname + "</div>";

                string studentnumber = row["STUDENTNUMBER"];
                students_result.InnerHtml += "<div class=\"col5\">" + studentnumber + "</div>";

                string enrolmentdate = row["ENROLMENTDATE"];
                students_result.InnerHtml += "<div class=\"col5\">" + enrolmentdate + "</div>";
                students_result.InnerHtml += "<div class=\"col5last\">" + "Update, Delete, View" + "</div>";
                //students_result.InnerHtml += "<div class=\"col5last\">" + deleteButton.ClientID + "</div>";
                students_result.InnerHtml += "</div>";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool   valid     = true;
            string teacherid = Request.QueryString["teacherid"];

            if (String.IsNullOrEmpty(teacherid))
            {
                valid = false;
            }

            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> teacher_record = db.FindTeacher(Int32.Parse(teacherid));

                if (teacher_record.Count > 0)
                {
                    teacher_title_fname.InnerHtml = teacher_record["TEACHERFNAME"] + " " + teacher_record["TEACHERLNAME"];
                    teacher_fname.InnerHtml       = teacher_record["TEACHERFNAME"];
                    teacher_lname.InnerHtml       = teacher_record["TEACHERLNAME"];
                    employee_number.InnerHtml     = teacher_record["EMPLOYEENUMBER"];
                    hire_date.InnerHtml           = teacher_record["HIREDATE"];
                    salary.InnerHtml = teacher_record["SALARY"];
                }
                else
                {
                    valid = false;
                }
            }
            //for the invalidate search input, show the error message:
            if (!valid)
            {
                teacher.InnerHtml = "There was an error finding that teacher.";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool   valid     = true;
            string studentid = Request.QueryString["studentid"];

            if (String.IsNullOrEmpty(studentid))
            {
                valid = false;
            }

            //We will attempt to get the record we need
            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> student_record = db.FindStudent(Int32.Parse(studentid));

                if (student_record.Count > 0)
                {
                    student_title_fname.InnerHtml = student_record["STUDENTFNAME"] + " " + student_record["STUDENTLNAME"];
                    student_fname.InnerHtml       = student_record["STUDENTFNAME"];
                    student_lname.InnerHtml       = student_record["STUDENTLNAME"];
                    student_number.InnerHtml      = student_record["STUDENTNUMBER"];
                    enrolment_date.InnerHtml      = student_record["ENROLMENTDATE"];
                }
                else
                {
                    valid = false;
                }
            }

            if (!valid)
            {
                student.InnerHtml = "There was an error finding that student.";
            }
        }
示例#8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /*
             *  An alternate way to fetch data without the SCHOOLDB.cs class
             *  https://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-sql-command.html
             */

            var db = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query("select * from STUDENTS");

            foreach (Dictionary <String, String> row in rs)
            {
                students_result.InnerHtml += "<div class=\"listitem\">";

                string studentfirstname = row["STUDENTFNAME"];
                students_result.InnerHtml += "<div class=\"col4\">" + studentfirstname + "</div>";

                string studentlastname = row["STUDENTLNAME"];
                students_result.InnerHtml += "<div class=\"col4\">" + studentlastname + "</div>";

                string studentnumber = row["STUDENTNUMBER"];
                students_result.InnerHtml += "<div class=\"col4\">" + studentnumber + "</div>";

                string enrolmentdate = row["ENROLMENTDATE"];
                students_result.InnerHtml += "<div class=\"col4last\">" + enrolmentdate + "</div>";

                students_result.InnerHtml += "</div>";
            }
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var db = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query("select CLASSCODE, concat(teachers.teacherfname, ' ' , teachers.teacherlname) as 'Teacher', STARTDATE, FINISHDATE, CLASSNAME from classes join teachers on classes.TEACHERID = teachers.TEACHERID ");

            foreach (Dictionary <String, String> row in rs)
            {
                classes_result.InnerHtml += "<div class=\"listitem\">";

                string classcode = row["CLASSCODE"];
                classes_result.InnerHtml += "<div class=\"col4\">" + classcode + "</div>";

                string teacher = row["Teacher"];
                classes_result.InnerHtml += "<div class=\"col4\">" + teacher + "</div>";

                string startdate = row["STARTDATE"];
                classes_result.InnerHtml += "<div class=\"col4\">" + startdate + "</div>";

                string finishdate = row["FINISHDATE"];
                classes_result.InnerHtml += "<div class=\"col4last\">" + finishdate + "</div>";

                string classname = row["CLASSNAME"];
                classes_result.InnerHtml += "<div class=\"col4\">" + classname + "</div>";

                classes_result.InnerHtml += "</div>";
            }
        }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string query = "select * from teachers";
            var    db    = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                teachers_list.InnerHtml += "<div class=\"listitem\">";

                string teacherfirstname = row["TEACHERFNAME"];
                teachers_list.InnerHtml += "<div class=\"col5\">" + teacherfirstname + "</div>";

                string teacherlastname = row["TEACHERLNAME"];
                teachers_list.InnerHtml += "<div class=\"col5\">" + teacherlastname + "</div>";

                string employeenumber = row["EMPLOYEENUMBER"];
                teachers_list.InnerHtml += "<div class=\"col5\">" + employeenumber + "</div>";

                string hiredate = row["HIREDATE"];
                teachers_list.InnerHtml += "<div class=\"col5\">" + hiredate + "</div>";

                string salary = row["SALARY"];
                teachers_list.InnerHtml += "<div class=\"col5last\">" + salary + "</div>";


                teachers_list.InnerHtml += "</div>";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            teachers_result.InnerHtml = "";

            string search = "";

            if (Page.IsPostBack)
            {
                search = teacher_search.Text;
            }

            string query = "SELECT * FROM TEACHERS";

            if (search != "")
            {
                query += " WHERE TEACHERFNAME LIKE '%" + search + "%' ";
                query += " OR TEACHERLNAME LIKE '%" + search + "%' ";
                query += " OR  EMPLOYEENUMBER LIKE '%" + search + "%' ";
            }

            //sql_debugger.InnerHtml = query;

            var db = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            /*
             *  author: Christine ;
             *  site: https://github.com/christinebittle/crud_essentials ;
             *  date accessed: Nov 16 2019 ;
             *  using purpose: to access the school database;
             */

            foreach (Dictionary <String, String> row in rs)
            {
                teachers_result.InnerHtml += "<div class=\"listitem\">";

                string teacherid = row["TEACHERID"];
                teachers_result.InnerHtml += "<div class=\"col7\">" + teacherid + "</div>";

                string teacherfirstname = row["TEACHERFNAME"];
                teachers_result.InnerHtml += "<div class=\"col7\"><a href=\"ShowTeacher.aspx?teacherid=" + teacherid + "\">" + teacherfirstname + "</a></div>";

                string teacherlastname = row["TEACHERLNAME"];
                teachers_result.InnerHtml += "<div class=\"col7\">" + teacherlastname + "</div>";

                string employeenumber = row["EMPLOYEENUMBER"];
                teachers_result.InnerHtml += "<div class=\"col7\">" + employeenumber + "</div>";

                string hiredate = row["HIREDATE"];
                teachers_result.InnerHtml += "<div class=\"col7\">" + hiredate + "</div>";

                string salary = row["SALARY"];
                teachers_result.InnerHtml += "<div class=\"col7\">" + salary + "</div>";

                teachers_result.InnerHtml += "<div class=\"col7last\">" + "<a href=\"UpdateTeacher.aspx?teacherid=" + teacherid + "\"> Update </a>" + "<a href=\"DeleteTeacher.aspx?teacherid=" + teacherid + "\"> Delete </a>" + "<a href=\"ShowTeacher.aspx?teacherid=" + teacherid + "\"> View </a>" + "</div>";

                teachers_result.InnerHtml += "</div>";
            }
        }
示例#12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //code created by Christine Bittle, modified by Christopher Jones, initially accessed on November 15th, 2019
            //blanking results set, in case of search bar function rerunning rendering process
            classes_result.InnerHtml = "";
            //set the searchkey to be blank
            string searchkey = "";

            //if the page is postback, check to see if something was entered into the search field
            if (Page.IsPostBack)
            {
                //this method opens up the risk of sql injection, but we will use it for the purpose of this assignment
                searchkey = class_search.Text;
            }
            //set the default query to grab all columns from the CLASSES table
            string query = "select CLASSES.*, CONCAT(teachers.teacherfname, ' ', teachers.teacherlname) as `teachers full name` from CLASSES inner join TEACHERS on CLASSES.teacherid = TEACHERS.teacherid";

            //if the searchkey isn't a blank string, create a search query for 3 column conditions
            if (searchkey != "")
            {
                query += " WHERE CLASSCODE like '%" + searchkey + "%' ";
                query += " or CLASSNAME like '%" + searchkey + "%' ";
                query += " or STARTDATE like '%" + searchkey + "%' ";
            }
            //create a rendering loop using Christine Bittle's design to output the data gathered from the database into a webpage
            var db = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                classes_result.InnerHtml += "<div class=\"listitem\">";
                //grab the classid to act as a unique selector id, we do not need to render it
                string classid = row["CLASSID"];
                //grab the teacherid to act as the unique identifier for that as well
                string teacherid = row["TEACHERID"];

                string classcode = row["CLASSCODE"];
                //create a link for a viewpage to view the class info on a different page
                //classes_result.InnerHtml += "<div class=\"col6\"><a href=\"ShowClass.aspx?classid=" + classid + "\">" + classcode + "</a></div>";
                classes_result.InnerHtml += "<div class=\"col6\">" + classcode + "</div>";
                string teachername = row["teachers full name"];
                //selector to view the teacher's page
                classes_result.InnerHtml += "<div class=\"col6\"><a href=\"ShowTeacher.aspx?teacherid=" + teacherid + "\">" + teachername + "</a></div>";

                string startdate = row["STARTDATE"];
                classes_result.InnerHtml += "<div class=\"col6\">" + startdate + "</div>";

                string finishdate = row["FINISHDATE"];
                classes_result.InnerHtml += "<div class=\"col6\">" + finishdate + "</div>";

                string classname = row["CLASSNAME"];
                classes_result.InnerHtml += "<div class=\"col6\">" + classname + "</div>";

                classes_result.InnerHtml += "<div class=\"col6last\">" + "<a href =\"UpdateClass.aspx?classid=" + classid + "\">" + "Update" + "</a>" + " " + " " + " " + "<a href =\"DeleteClass.aspx?classid=" + classid + "\">" + "Delete" + "</a>" + " " + " " + " " + "<a href=\"ShowClass.aspx?classid=" + classid + "\">" + "View" + "</a></div>";

                classes_result.InnerHtml += "</div>";
            }
        }
示例#13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /*
             *  An alternate way to fetch data without the SCHOOLDB.cs class
             *  https://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-sql-command.html
             */

            //resets the result set window
            students_result.InnerHtml = "";

            string searchkey = "";

            if (Page.IsPostBack)
            {
                //WARNING: This technique is vulnerable to SQL injections
                //read more about SQL injections
                //https://www.csoonline.com/article/3257429/what-is-sql-injection-how-sqli-attacks-work-and-how-to-prevent-them.html
                //we will learn to defend against these attacks next semester
                searchkey = student_search.Text;
            }


            string query = "select * from STUDENTS";

            if (searchkey != "")
            {
                query += " WHERE STUDENTFNAME like '%" + searchkey + "%' ";
                query += " or STUDENTLNAME like '%" + searchkey + "%' ";
                query += " or STUDENTNUMBER like '%" + searchkey + "%' ";
            }
            //sql_debugger.InnerHtml = query;

            var db = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                students_result.InnerHtml += "<div class=\"listitem\">";

                string studentid = row["STUDENTID"];

                string studentfirstname = row["STUDENTFNAME"];
                students_result.InnerHtml += "<div class=\"col4\"><a href=\"ShowStudent.aspx?studentid=" + studentid + "\">" + studentfirstname + "</a></div>";

                string studentlastname = row["STUDENTLNAME"];
                students_result.InnerHtml += "<div class=\"col4\">" + studentlastname + "</div>";

                string studentnumber = row["STUDENTNUMBER"];
                students_result.InnerHtml += "<div class=\"col4\">" + studentnumber + "</div>";

                string enrolmentdate = row["ENROLMENTDATE"];
                students_result.InnerHtml += "<div class=\"col4last\">" + enrolmentdate + "</div>";

                students_result.InnerHtml += "</div>";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            class_results.InnerHtml = "";

            string searchterm = "";

            if (Page.IsPostBack)
            {
                searchterm = class_search.Text;
            } //end Page.IsPostBack


            string sqlquery = "select * from CLASSES";

            if (searchterm != "")
            {
                sqlquery += " WHERE CLASSCODE like '%" + searchterm + "%' ";
                sqlquery += " or CLASSNAME like '%" + searchterm + "%' ";
                sqlquery += " or STARTDATE like '%" + searchterm + "%' ";
                sqlquery += " or FINISHDATE like '%" + searchterm + "%' ";
            }

            sql_debugger.InnerHtml = sqlquery;

            //declare new db
            var db = new SCHOOLDB();

            //SQL query
            List <Dictionary <String, String> > rs = db.List_Query(sqlquery);

            //get each result, add it to our list
            foreach (Dictionary <String, String> row in rs)
            {
                //start the div
                class_results.InnerHtml += "<div class=\"listitem\">";

                //call the rows for data

                string classid = row["CLASSID"];

                string classname = row["CLASSNAME"];
                class_results.InnerHtml += "<div class=\"col4\"><a href=\"ShowClasses.aspx?classid=" + classid + "\">" + classname + "</a></div>";

                string classcode = row["CLASSCODE"];
                class_results.InnerHtml += "<div class=\"col4\">" + classcode + "</div>";

                string classstartdate = row["STARTDATE"];
                class_results.InnerHtml += "<div class=\"col4\">" + classstartdate + "</div>";

                string classenddate = row["FINISHDATE"];
                class_results.InnerHtml += "<div class=\"col4last\">" + classenddate + "</div>";

                //end the div
                class_results.InnerHtml += "</div>";
            } //end foreach
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            teachers_result.InnerHtml = "";

            string searchkey = "";

            if (Page.IsPostBack)
            {
                searchkey = teacher_search.Text;
            }


            string query = "select * from TEACHERS";

            if (searchkey != "")
            {
                query += " WHERE TEACHERFNAME like '%" + searchkey + "%' ";
                query += " or TEACHERLNAME like '%" + searchkey + "%' ";
                query += " or EMPLOYEENUMBER like '%" + searchkey + "%' ";
                query += " or HIREDATE like '%" + searchkey + "%'";
                query += " or SALARY like '%" + searchkey + "%'";
            }
            //sql_debugger.InnerHtml = query;

            var db = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                teachers_result.InnerHtml += "<div class=\"listitem\">";

                string teacherid = row["TEACHERID"];

                string teacherfirstname = row["TEACHERFNAME"];
                teachers_result.InnerHtml += "<div class=\"col5\"><a href=\"ShowTeacher.aspx?teacherid=" + teacherid + "\">" + teacherfirstname + "</a></div>";

                string teacherlastname = row["TEACHERLNAME"];
                teachers_result.InnerHtml += "<div class=\"col5\">" + teacherlastname + "</div>";

                string employeenumber = row["EMPLOYEENUMBER"];
                teachers_result.InnerHtml += "<div class=\"col5\">" + employeenumber + "</div>";

                string hiredate = row["HIREDATE"];
                teachers_result.InnerHtml += "<div class=\"col5\">" + hiredate + "</div>";

                string salary = row["SALARY"];
                teachers_result.InnerHtml += "<div class=\"col5last\">" + salary + "</div>";

                teachers_result.InnerHtml += "</div>";
            }
        }
示例#16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            classes_result.InnerHtml = "";

            string searchkey = "";

            if (Page.IsPostBack)
            {
                searchkey = class_search.Text;
            }


            string query = "select * from CLASSES";

            if (searchkey != "")
            {
                query += " WHERE CLASSCODE like '%" + searchkey + "%' ";
                query += " or TEACHERID like '%" + searchkey + "%' ";
                query += " or STARTDATE like '%" + searchkey + "%' ";
                query += " or FINISHDATE like '%" + searchkey + "%' ";
                query += " or CLASSNAME like '%" + searchkey + "%' ";
            }
            //sql_debugger.InnerHtml = query;

            var db = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                classes_result.InnerHtml += "<div class=\"listitem\">";

                string classid = row["CLASSID"];

                string classcode = row["CLASSCODE"];
                classes_result.InnerHtml += "<div class=\"col5\"><a href=\"ShowClass.aspx?classid=" + classid + "\">" + classcode + "</a></div>";

                string teacherid = row["TEACHERID"];
                classes_result.InnerHtml += "<div class=\"col5\">" + teacherid + "</div>";

                string startdate = row["STARTDATE"];
                classes_result.InnerHtml += "<div class=\"col5\">" + startdate + "</div>";

                string finishdate = row["FINISHDATE"];
                classes_result.InnerHtml += "<div class=\"col5\">" + finishdate + "</div>";

                string classname = row["CLASSNAME"];
                classes_result.InnerHtml += "<div class=\"col5last\">" + classname + "</div>";

                classes_result.InnerHtml += "</div>";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool   valid     = true;
            string studentid = Request.QueryString["studentid"];

            if (String.IsNullOrEmpty(studentid))
            {
                valid = false;
            }

            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> student_record = db.FindStudent(Int32.Parse(studentid));

                if (student_record.Count > 0)
                {
                    student_fullname.InnerHtml = student_record["STUDENTFNAME"] + " " + student_record["STUDENTLNAME"];
                    student_fname.InnerHtml    = student_record["STUDENTFNAME"];
                    student_lname.InnerHtml    = student_record["STUDENTLNAME"];
                    student_number.InnerHtml   = student_record["STUDENTNUMBER"];
                    enrolment_date.InnerHtml   = student_record["ENROLMENTDATE"];
                }
                else
                {
                    valid = false;
                }
                if (Page.IsPostBack)
                {
                    Page.Validate();
                    if (Page.IsValid)
                    {
                        deleting_summary.InnerHtml  = "You have successfully deleted the following student: <br>";
                        deleting_summary.InnerHtml += "First name: " + student_fname.InnerHtml + "<br>";
                        deleting_summary.InnerHtml += "Last name: " + student_lname.InnerHtml + "<br>";
                        deleting_summary.InnerHtml += "Student number: " + student_number.InnerHtml + "<br>";
                        deleting_summary.InnerHtml += "Enrolment date: " + enrolment_date.InnerHtml + "<br>";
                        deleting_summary.InnerHtml += "Please go back to " + "<a href=\"ListStudents.aspx\">" + "Students page " + "</a>" + "to check.";

                        string query = "Delete from students where studentid = " + studentid;
                        sql_debugger.InnerHtml = query;


                        int delete = db.Modify_Query(query);
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            /*
             *  An alternate way to fetch data without the SCHOOLDB.cs class
             *  https://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-sql-command.html
             */
            students_result.InnerHtml = "";

            string searchkey = "";

            if (Page.IsPostBack)
            {
                searchkey = student_search.Text;
            }
            string query = "select * from STUDENTS";

            if (searchkey != "")
            {
                query += " WHERE STUDENTFNAME like '%" + searchkey + "%' ";
                query += " or STUDENTLNAME like '%" + searchkey + "%' ";
                query += " or STUDENTNUMBER like '%" + searchkey + "%' ";
            }
            sql_debugger.InnerHtml = query;

            var db = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                students_result.InnerHtml += "<div class=\"listitem\">";

                string studentid = row["STUDENTID"];

                string studentfirstname = row["STUDENTFNAME"];
                students_result.InnerHtml += "<div class=\"col4\"><a href=\"ShowStudent.aspx?studentid=" + studentid + "\">" + studentfirstname + "</a></div>";

                string studentlastname = row["STUDENTLNAME"];
                students_result.InnerHtml += "<div class=\"col4\">" + studentlastname + "</div>";

                string studentnumber = row["STUDENTNUMBER"];
                students_result.InnerHtml += "<div class=\"col4\">" + studentnumber + "</div>";

                string enrolmentdate = row["ENROLMENTDATE"];
                students_result.InnerHtml += "<div class=\"col4last\">" + enrolmentdate + "</div>";

                students_result.InnerHtml += "</div>";
            }
        }
示例#19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool   valid   = true;
            string classid = Request.QueryString["classid"];

            if (String.IsNullOrEmpty(classid))
            {
                valid = false;
            }

            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> class_record = db.FindClass(Int32.Parse(classid));


                if (class_record.Count > 0)
                {
                    class_title.InnerHtml  = class_record["CLASSCODE"] + " " + class_record["CLASSNAME"];
                    class_code.InnerHtml   = class_record["CLASSCODE"];
                    class_name.InnerHtml   = class_record["CLASSNAME"];
                    class_start.InnerHtml  = class_record["STARTDATE"];
                    class_finish.InnerHtml = class_record["FINISHDATE"];
                    //teacher_name.InnerHtml = class_record["concat(teachers.TEACHERFNAME, ' ', teachers.TEACHERLNAME)"];
                }

                string teacherid = class_record["TEACHERID"];

                Dictionary <String, String> teacher_record = db.FindTeacher(Int32.Parse(teacherid));

                if (teacher_record.Count > 0)
                {
                    teacher_name.InnerHtml = teacher_record["TEACHERFNAME"] + " " + teacher_record["TEACHERLNAME"];
                }

                else
                {
                    valid = false;
                }
            }

            if (!valid)
            {
                class_div.InnerHtml = "There was an error finding that class";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //using modification of code written by Christine Bittle for HTTP5101, modified on Nov. 18 2019 by Christopher Jones for educational purposes
            bool   valid   = true;
            string classid = Request.QueryString["classid"];

            if (String.IsNullOrEmpty(classid))
            {
                valid = false;
            }

            //We will attempt to get the record we need
            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> class_record = db.FindClass(Int32.Parse(classid));

                if (class_record.Count > 0)
                {
                    classcode_title.InnerHtml   = class_record["CLASSCODE"];
                    classcode_display.InnerHtml = class_record["CLASSCODE"];
                    teacherid.InnerHtml         = class_record["TEACHERID"];
                    startdate.InnerHtml         = class_record["STARTDATE"].Substring(0, 10);
                    finishdate.InnerHtml        = class_record["FINISHDATE"].Substring(0, 10);
                    classname.InnerHtml         = class_record["CLASSNAME"];
                    if (Page.IsPostBack)
                    {
                        string query    = "DELETE from `classes` where classid = " + classid;
                        var    deletedb = new SCHOOLDB();
                        int    delete   = deletedb.Modify_Query(query);
                        Response.Redirect("~/ListClasses.aspx");
                    }
                }
                else
                {
                    valid = false;
                }
            }

            if (!valid)
            {
                schoolclass.InnerHtml = "There was an error finding that class.";
            }
        }
示例#21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool   valid     = true;
            string teacherid = Request.QueryString["teacherid"];

            if (String.IsNullOrEmpty(teacherid))
            {
                valid = false;
            }

            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> teacher_record = db.FindTeacher(Int32.Parse(teacherid));

                if (teacher_record.Count > 0)
                {
                    teacher_fname.InnerHtml          = teacher_record["TEACHERFNAME"];
                    teacher_lname.InnerHtml          = teacher_record["TEACHERLNAME"];
                    teacher_employeenumber.InnerHtml = teacher_record["EMPLOYEENUMBER"];
                    teacher_hiredate.InnerHtml       = teacher_record["HIREDATE"];
                    teacher_salary.InnerHtml         = teacher_record["SALARY"];
                }
                else
                {
                    valid = false;
                }
                if (Page.IsPostBack)
                {
                    Page.Validate();
                    if (Page.IsValid)
                    {
                        delete_summary.InnerHtml = "The current teacher record has been deleted.";
                    }
                }
            }

            /*
             *  author: Christine ;
             *  site: https://github.com/christinebittle/crud_essentials ;
             *  date accessed: Nov 18 2019 ;
             *  using purpose: to access the selected information from school database;
             */
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // clear result
            student_result.InnerHtml = "";
            // what user input
            string searchkey = "";

            if (Page.IsPostBack)
            {
                searchkey = student_search.Text;
            }

            // query
            string query = "select * from STUDENTS";

            if (searchkey != "")
            {
                query += " WHERE STUDENTFNAME like '%" + searchkey + "%' ";
                query += " or STUDENTLNAME like '%" + searchkey + "%' ";
                query += " or STUDENTNUMBER like '%" + searchkey + "%' ";
            }

            var db = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                student_result.InnerHtml += "<div class=\"listitem\">";

                string studentid        = row["STUDENTID"];
                string studentfirstname = row["STUDENTFNAME"];
                string studentlastname  = row["STUDENTLNAME"];
                string studentfullname  = studentfirstname + " " + studentlastname;
                string studentnumber    = row["STUDENTNUMBER"];
                string enrolmentdate    = row["ENROLMENTDATE"];

                student_result.InnerHtml += "<div class=\"col3\"><a href=\"DetailPage.aspx?studentid=" + studentid + "\">" + studentfullname + "</a></div>";

                student_result.InnerHtml += "<div class=\"col3\">" + studentnumber + "</div>";

                student_result.InnerHtml += "<div class=\"col3last\">" + enrolmentdate + "</div>" + "</div>";
            }
        }
示例#23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                Page.Validate();

                if (Page.IsValid)
                {
                    string ClassCode  = classcode.Text.ToString();
                    string TeacherId  = teacherid.Text.ToString();
                    string StartDate  = startdate.Text.ToString();
                    string FinishDate = finishdate.Text.ToString();
                    string ClassName  = classname.Text.ToString();
                    string query      = "INSERT INTO classes (CLASSCODE, TEACHERID, STARTDATE, FINISHDATE, CLASSNAME) values ('" + ClassCode + "'," + TeacherId + ",'" + StartDate + "','" + FinishDate + "','" + ClassName + "');";
                    var    db         = new SCHOOLDB();
                    int    add        = db.Modify_Query(query);
                    Response.Redirect("~/ListClasses.aspx");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            {
                bool   valid     = true;
                string teacherid = Request.QueryString["teacherid"];
                if (String.IsNullOrEmpty(teacherid))
                {
                    valid = false;
                }

                //We will attempt to get the record we need
                if (valid)
                {
                    var db = new SCHOOLDB();
                    Dictionary <String, String> teacher_record = db.FindTeacher(Int32.Parse(teacherid));

                    if (teacher_record.Count > 0)
                    {
                        teacher_title_fname.InnerHtml = teacher_record["TEACHERFNAME"] + " " + teacher_record["TEACHERLNAME"];
                        teacher_fname.InnerHtml       = teacher_record["TEACHERFNAME"];
                        teacher_lname.InnerHtml       = teacher_record["TEACHERLNAME"];
                        teacher_number.InnerHtml      = teacher_record["EMPLOYEENUMBER"];
                        hire_date.InnerHtml           = teacher_record["HIREDATE"];
                        Salary.InnerHtml = "$" + teacher_record["SALARY"] + " " + "CAD per hour";
                    }

                    else
                    {
                        valid = false;
                    }
                }

                if (!valid)
                {
                    teacher.InnerHtml = "There was an error finding that teacher.";
                }

                teacheredit_btn.PostBackUrl = "~/TeacherEdit.aspx?teacherid=" + teacherid;
            }
        }
示例#25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool   valid     = true;
            string studentid = Request.QueryString["studentid"];

            if (String.IsNullOrEmpty(studentid))
            {
                valid = false;
            }

            //We will attempt to get the record we need
            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> student_record = db.FindStudent(Int32.Parse(studentid));

                if (student_record.Count > 0)
                {
                    student_title_fname.InnerHtml = student_record["STUDENTFNAME"] + " " + student_record["STUDENTLNAME"];
                    student_fname.InnerHtml       = student_record["STUDENTFNAME"];
                    student_lname.InnerHtml       = student_record["STUDENTLNAME"];
                    student_number.InnerHtml      = student_record["STUDENTNUMBER"];
                    enrolment_date.InnerHtml      = student_record["ENROLMENTDATE"];
                }
                else
                {
                    valid = false;
                }
            }

            if (!valid)
            {
                student.InnerHtml = "There was an error finding that student.";
            }
            /*https://stackoverflow.com/questions/23976683/asp-net-button-to-redirect-to-another-page */
            studentedit_btn.PostBackUrl = "~/StudentEdit.aspx?studentid=" + studentid;
        }
示例#26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //RESET RESULT SET
            teachers_result.InnerHtml = "";

            string searchkey = "";

            if (Page.IsPostBack)
            {
                searchkey = teacher_search.Text;
            }

            string query = "select * from TEACHERS";

            if (searchkey != "")
            {
                query += " WHERE LOWER(TEACHERFNAME) like '%" + searchkey + "%' ";
                query += " OR LOWER(TEACHERLNAME) like '%" + searchkey + "%' ";
                query += " OR LOWER(EMPLOYEENUMBER) like '%" + searchkey + "%' ";
                query += " OR HIREDATE like '%" + searchkey + "%' ";
                query += " OR SALARY like '%" + searchkey + "%' ";
            }
            // sql_debugger.InnerHtml = query;
            // COMMENT OUT THE ABOVE LINE AFTER DEBUGGING COMPLETE



            var db = new SCHOOLDB();  // call a database to run the query on
            List <Dictionary <String, String> > rs = db.List_Query(query);

            // running the query, running the List_Query function
            // can run List_Query function on a class (SCHOOLDB();)
            // rs is my result set
            // row is synonymous to TEACHER (for context)

            foreach (Dictionary <String, String> row in rs)
            {
                teachers_result.InnerHtml += "<div class=\"listitem\">";
                // \ escaping ; to ensure that the quotations are captured in the HTML; in this particular case, single quotations would also work

                string teacherid = row["TEACHERID"];

                string teacherfirstname = row["TEACHERFNAME"];
                teachers_result.InnerHtml += "<div class=\"col7\"><a href=\"ShowTeacher.aspx?teacherid=" + teacherid + "\">" + teacherfirstname + "</a></div>";

                string teacherlastname = row["TEACHERLNAME"];
                teachers_result.InnerHtml += "<div class=\"col7\">" + teacherlastname + "</div>";

                string employeenumber = row["EMPLOYEENUMBER"];
                teachers_result.InnerHtml += "<div class=\"col7\">" + employeenumber + "</div>";

                string salary = row["SALARY"];
                teachers_result.InnerHtml += "<div class=\"col7\">" + salary + "</div>";

                string   hiredate     = row["HIREDATE"];
                DateTime hiredatetime = Convert.ToDateTime(hiredate);
                DateTime hiredateonly = hiredatetime.Date;
                teachers_result.InnerHtml += "<div class=\"col7\">" + hiredateonly.ToString("d") + "</div>";
                // SRC: HOW TO REMOVE TIME STAMP
                // https://docs.microsoft.com/en-us/dotnet/api/system.datetime.date?redirectedfrom=MSDN&view=netframework-4.8#System_DateTime_Date

                teachers_result.InnerHtml += "<div class=\"col7\"><div class=\"editbutton\">Edit</div></div>";

                teachers_result.InnerHtml += "<div class=\"col7last\"><div class=\"deletebutton\">Delete</div></div>";

                teachers_result.InnerHtml += "</div>";
            }
        }
示例#27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            classes_header.InnerHtml = "";
            classes_result.InnerHtml = "";
            //This code is provided by Christine Bittle, modified by Paul Tran
            bool   valid     = true;
            string studentid = Request.QueryString["studentid"];

            //string classid = Request.QueryString["classid"];
            if (String.IsNullOrEmpty(studentid))
            {
                valid = false;
            }

            //We will attempt to get the record we need
            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> student_record = db.FindStudent(Int32.Parse(studentid));

                if (student_record.Count > 0)
                {
                    student_title_fname.InnerHtml = student_record["STUDENTFNAME"] + " " + student_record["STUDENTLNAME"];
                    student_fname.InnerHtml       = student_record["STUDENTFNAME"];
                    student_lname.InnerHtml       = student_record["STUDENTLNAME"];
                    student_number.InnerHtml      = student_record["STUDENTNUMBER"];
                    enrolment_date.InnerHtml      = student_record["ENROLMENTDATE"];
                    //WHAT IF user want to see which class the student enrolled  in
                    //enrolled_class.InnerHtml = "";
                    //string query = "SELECT classes.classname, classes.classcode from classes inner join studentsxclasses on classes.classid = studentsxclasses.classid inner join students on studentsxclasses.studentid = students.studentid where students.studentid = " + studentid;
                    if (Page.IsPostBack)
                    {
                        classes_header.InnerHtml = "<div class=\"listitem\"><div class=\"col4\">Class code</div><div class=\"col4\">Class name</div><div class=\"col4\">Start date</div><div class=\"col4last\">Finish date</div></div>";
                        string query = "SELECT classes.* from classes inner join studentsxclasses on classes.classid = studentsxclasses.classid inner join students on studentsxclasses.studentid = students.studentid where students.studentid =" + studentid;
                        List <Dictionary <String, String> > rs = db.List_Query(query);
                        foreach (Dictionary <String, String> row in rs)
                        {
                            classes_result.InnerHtml += "<div class=\"listitem\">";

                            string classid = row["CLASSID"];

                            string classcode = row["CLASSCODE"];
                            classes_result.InnerHtml += "<div class=\"col4\">" + classcode + "</div>";

                            string classname = row["CLASSNAME"];
                            classes_result.InnerHtml += "<div class=\"col4\">" + classname + "</div>";

                            string startdate = row["STARTDATE"];
                            classes_result.InnerHtml += "<div class=\"col4\">" + startdate + "</div>";

                            string finishdate = row["FINISHDATE"];
                            classes_result.InnerHtml += "<div class=\"col4last\">" + finishdate + "</div>";
                            classes_result.InnerHtml += "</div>";
                            //To test this, I add myself in the database and enrolled me in a class and the code actually show I am a student
                        }
                    }
                }


                else
                {
                    valid = false;
                }
            }
            if (!valid)
            {
                student.InnerHtml = "There was an error finding that student.";
            }
        }
示例#28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool   valid   = true;
            string classid = Request.QueryString["classid"];

            if (String.IsNullOrEmpty(classid))
            {
                valid = false;
            }

            //We will attempt to get the record we need
            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> class_record = db.FindClass(Int32.Parse(classid));

                if (class_record.Count > 0)
                {
                    class_title_name.InnerHtml = class_record["CLASSNAME"];
                    class_code.InnerHtml       = class_record["CLASSCODE"];
                    teacher_id.InnerHtml       = class_record["TEACHERID"];
                    start_date.InnerHtml       = class_record["STARTDATE"];
                    finish_date.InnerHtml      = class_record["FINISHDATE"];
                    class_name.InnerHtml       = class_record["CLASSNAME"];
                    if (teacher_id.InnerHtml == "0")
                    {
                        teacher_id.InnerHtml = "Not assigned";
                    }
                    else if (teacher_id.InnerHtml == "1")
                    {
                        teacher_id.InnerHtml = "Alexander Bennett";
                    }
                    else if (teacher_id.InnerHtml == "2")
                    {
                        teacher_id.InnerHtml = "Caitlin Cummings";
                    }
                    else if (teacher_id.InnerHtml == "3")
                    {
                        teacher_id.InnerHtml = "Linda Chan";
                    }
                    else if (teacher_id.InnerHtml == "4")
                    {
                        teacher_id.InnerHtml = "Lauren Smith";
                    }
                    else if (teacher_id.InnerHtml == "5")
                    {
                        teacher_id.InnerHtml = "Jessica Morris";
                    }
                    else if (teacher_id.InnerHtml == "6")
                    {
                        teacher_id.InnerHtml = "Thomas Hawkins";
                    }
                    else if (teacher_id.InnerHtml == "7")
                    {
                        teacher_id.InnerHtml = "Shannon Barton";
                    }
                    else if (teacher_id.InnerHtml == "8")
                    {
                        teacher_id.InnerHtml = "Dana Ford";
                    }
                    else if (teacher_id.InnerHtml == "9")
                    {
                        teacher_id.InnerHtml = "Cody Holland";
                    }
                    else if (teacher_id.InnerHtml == "10")
                    {
                        teacher_id.InnerHtml = "John Taram";
                    }
                    else
                    {
                        teacher_id.InnerHtml = "There was a mistake finding teacher's name";
                    };
                }
                else
                {
                    valid = false;
                }
            }

            if (!valid)
            {
                class_class.InnerHtml = "There was an error finding that class.";
            }
        }
示例#29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // resets the result window
            classes_result.InnerHtml = "";

            string searchkey = "";

            if (Page.IsPostBack)
            {
                searchkey = class_search.Text;
            }

            string query = "select CLASSCODE, concat(teachers.teacherfname, ' ', teachers.teacherlname) as TEACHERFULLNAME, STARTDATE, FINISHDATE, CLASSNAME, CLASSID from classes join teachers on classes.TEACHERID = teachers.TEACHERID ";


            if (searchkey != "")
            {
                query += " WHERE LOWER(CLASSCODE) like '%" + searchkey + "%' ";
                query += " OR LOWER(CLASSNAME) like '%" + searchkey + "%' ";
                query += " OR LOWER(Concat(teachers.teacherfname, ' ', teachers.teacherlname)) like '%" + searchkey + "%' ";
                query += " OR STARTDATE like '%" + searchkey + "%' ";
                query += " OR FINISHDATE like '%" + searchkey + "%' ";
            }

            //sql_debugger.InnerHtml = query;
            // COMMENT OUT THE ABOVE LINE AFTER DEBUGGING COMPLETE


            var db = new SCHOOLDB();
            List <Dictionary <String, String> > rs = db.List_Query(query);

            foreach (Dictionary <String, String> row in rs)
            {
                classes_result.InnerHtml += "<div class=\"listitem\">";

                string classid = row["CLASSID"];

                string classcode = row["CLASSCODE"];
                //classes_result.InnerHtml += "<div class=\"col7\">" + classcode + "</div>";
                classes_result.InnerHtml += "<div class=\"col7\"><a href=\"ShowClass.aspx?classid=" + classid + "\">" + classcode + "</a></div>";

                string classname = row["CLASSNAME"];
                classes_result.InnerHtml += "<div class=\"col7\">" + classname + "</div>";

                string teacher = row["TEACHERFULLNAME"];
                classes_result.InnerHtml += "<div class=\"col7\">" + teacher + "</div>";

                string   startdate     = row["STARTDATE"];
                DateTime startdatetime = Convert.ToDateTime(startdate);
                DateTime startdateonly = startdatetime.Date;
                classes_result.InnerHtml += "<div class=\"col7\">" + startdateonly.ToString("d") + "</div>";

                string   finishdate     = row["FINISHDATE"];
                DateTime finishdatetime = Convert.ToDateTime(finishdate);
                DateTime finishdateonly = finishdatetime.Date;
                classes_result.InnerHtml += "<div class=\"col7\">" + finishdateonly.ToString("d") + "</div>";
                // SRC: HOW TO REMOVE TIME STAMP
                // https://docs.microsoft.com/en-us/dotnet/api/system.datetime.date?redirectedfrom=MSDN&view=netframework-4.8#System_DateTime_Date

                classes_result.InnerHtml += "<div class=\"col7\"><div class=\"editbutton\">Edit</div></div>";

                classes_result.InnerHtml += "<div class=\"col7last\"><div class=\"deletebutton\">Delete</div></div>";

                classes_result.InnerHtml += "</div>";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //using modification of code written by Christine Bittle for HTTP5101, modified on Nov. 18 2019 by Christopher Jones for educational purposes
            bool   valid   = true;
            string classid = Request.QueryString["classid"];

            if (String.IsNullOrEmpty(classid))
            {
                valid = false;
            }

            //We will attempt to get the record we need
            if (valid)
            {
                var db = new SCHOOLDB();
                Dictionary <String, String> class_record = db.FindClass(Int32.Parse(classid));

                if (class_record.Count > 0)
                {
                    classcode_title.InnerHtml   = class_record["CLASSCODE"];
                    classcode_display.InnerHtml = class_record["CLASSCODE"];
                    teacherid.InnerHtml         = class_record["TEACHERID"];
                    startdate.InnerHtml         = class_record["STARTDATE"].Substring(0, 10);
                    finishdate.InnerHtml        = class_record["FINISHDATE"].Substring(0, 10);
                    classname.InnerHtml         = class_record["CLASSNAME"];
                    if (Page.IsPostBack)
                    {
                        string ClassCode  = new_classcode.Text.ToString();
                        string TeacherId  = new_teacherid.Text.ToString();
                        string StartDate  = new_startdate.Text.ToString();
                        string FinishDate = new_finishdate.Text.ToString();
                        string ClassName  = new_classname.Text.ToString();
                        //should probably do the handling with a function or a loop (nesting the data within a list and incremeting to check for blank input)
                        if (ClassCode == "")
                        {
                            ClassCode = class_record["CLASSCODE"];
                        }
                        if (TeacherId == "")
                        {
                            TeacherId = class_record["TEACHERID"];
                        }
                        if (StartDate == "")
                        {
                            StartDate = class_record["STARTDATE"].Substring(0, 10);
                        }
                        if (FinishDate == "")
                        {
                            FinishDate = class_record["FINISHDATE"].Substring(0, 10);
                        }
                        if (ClassName == "")
                        {
                            ClassName = class_record["CLASSNAME"];
                        }
                        string query = "UPDATE classes SET CLASSCODE ='" + ClassCode + "', TEACHERID =" + TeacherId + ", STARTDATE='" + StartDate + "', FINISHDATE='" + FinishDate + "', CLASSNAME='" + ClassName + "' WHERE CLASSID = " + classid;
                        var    edit  = new SCHOOLDB();
                        int    add   = edit.Modify_Query(query);
                        Response.Redirect("~/ShowClass.aspx?classid=" + classid);
                    }
                }
                else
                {
                    valid = false;
                }
            }

            if (!valid)
            {
                schoolclass.InnerHtml = "There was an error finding that class.";
            }
        }