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_info = db.FindClass(int.Parse(classid));

                if (class_info.Count > 0)
                {
                    class_code.InnerHtml   = class_info["CLASSCODE"];
                    class_name.InnerHtml   = class_info["CLASSNAME"];
                    class_start.InnerHtml  = class_info["STARTDATE"];
                    class_end.InnerHtml    = class_info["FINISHDATE"];
                    teacher_name.InnerHtml = class_info["TEACHERNAME"];
                }
                else
                {
                    valid = false;
                }
            }
            if (!valid)
            {
                classinfo.InnerHtml = "Wrong details entered!!";
            }
        }
        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_data = db.FindTeacher(Int32.Parse(teacherid));

                if (teacher_data.Count > 0)
                {
                    teacher_fname.InnerHtml   = teacher_data["TEACHERFNAME"];
                    teacher_lname.InnerHtml   = teacher_data["TEACHERLNAME"];
                    employee_number.InnerHtml = teacher_data["EMPLOYEENUMBER"];
                    hire_date.InnerHtml       = teacher_data["HIREDATE"];
                    salary.InnerHtml          = teacher_data["SALARY"];
                }
                else
                {
                    valid = false;
                }
            }
            if (!valid)
            {
                teacher_data.InnerHtml = "Wrong details entered!!";
            }
        }
        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_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 = "Wrong details entered!!";
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            classes_result.InnerHtml = "";
            string Semester   = "all";
            string search_key = "";


            if (Page.IsPostBack)
            {
                search_key = classes_search.Text;
                Semester   = semester.SelectedValue;
            }
            string query = "select * from CLASSES";

            if (Semester != "all")
            {
                query += " WHERE (MONTH(STARTDATE) = " + Semester + ")";

                //INITIAL WHERE SO BOTH  SEARCH AND SEMESTER CAN RUN WITHOUT REPEATING THE WHERE IN THE SEARCH KEY IF
            }
            else
            {
                query += " WHERE (MONTH(STARTDATE) =01 OR MONTH(STARTDATE) =09) ";
            }

            if (search_key != "")
            {
                query += " AND (CLASSID LIKE '%" + search_key + "%'";
                query += " OR CLASSCODE LIKE '%" + search_key + "%'";
                query += " OR CLASSNAME LIKE '%" + search_key + "%')";
            }
            //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=\"col4\"><a href=\"ClassInfo.aspx?classid=" + classid + "\">" + classcode + "</a></div>";;

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

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

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

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

            string search_key = "";

            if (Page.IsPostBack)
            {
                search_key = teachers_search.Text;
            }
            string query = "select TEACHERID, concat(TEACHERFNAME,\", \",TEACHERLNAME) AS 'TEACHERNAME',EMPLOYEENUMBER,HIREDATE,SALARY  from TEACHERS ";

            if (search_key != "")
            {
                query += " WHERE TEACHERID LIKE '%" + search_key + "%'";
                query += " OR TEACHERFNAME LIKE '%" + search_key + "%'";
                query += " OR TEACHERLNAME LIKE '%" + search_key + "%'";
                query += " OR EMPLOYEENUMBER LIKE '%" + search_key + "%'";
                query += " OR HIREDATE LIKE '%" + search_key + "%'";
                query += " OR SALARY LIKE '%" + search_key + "%'";
            }


            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"];
                //  teachers_result.InnerHtml += "<div class=\"col4\">" + teacherid + "</div>";

                string teachername = row["TEACHERNAME"];
                teachers_result.InnerHtml += "<div class=\"col4\"><a href=\"teacherData.aspx?teacherid=" + teacherid + "\">" + teachername + "</a></div>";

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

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

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

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

                teachers_result.InnerHtml += "</div>";
            }
        }
Beispiel #6
0
        //refference taken from in class example done by chrintine bittle
        protected void Page_Load(object sender, EventArgs e)
        {
            students_result.InnerHtml = "";

            string search_key = "";

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

            if (search_key != "")
            {
                query += " WHERE STUDENTFNAME LIKE '%" + search_key + "%'";
                query += " OR STUDENTLNAME LIKE '%" + search_key + "%'";
                query += " OR STUDENTNUMBER LIKE '%" + search_key + "%'";
            }

            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>";
            }
        }