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 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";
        }
Ejemplo n.º 3
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";
            }
        }
Ejemplo n.º 4
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)
        {
            {
                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;
            }
        }
Ejemplo n.º 6
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));

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

                if (teacher_record.Count > 0)
                {
                    teacher_fullname.InnerHtml       = teacher_record["TEACHERFNAME"] + " " + teacher_record["TEACHERLNAME"];
                    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)
                    {
                        string Update_Teacherfname   = update_teacherfname.Text.ToString();
                        string Update_Teacherlname   = update_teacherlname.Text.ToString();
                        string Update_Employeenumber = update_employeenumber.Text.ToString();
                        string Update_Hiredate       = update_hiredate.Text.ToString();
                        string Update_Salary         = update_salary.Text.ToString();

                        update_summary.InnerHtml = "You have changed the following information about " + teacher_fullname.InnerHtml + ":<br>";
                        //next step: use loop to simlify the following code:
                        if (Update_Teacherfname != "")
                        {
                            update_summary.InnerHtml += "First name: " + Update_Teacherfname + "<br>";
                        }
                        else
                        {
                            update_summary.InnerHtml += "First name: unchanged <br>";
                        }
                        if (Update_Teacherlname != "")
                        {
                            update_summary.InnerHtml += "Last name: " + Update_Teacherlname + "<br>";
                        }
                        else
                        {
                            update_summary.InnerHtml += "Last name: unchanged <br>";
                        }
                        if (Update_Employeenumber != "")
                        {
                            update_summary.InnerHtml += "Employee number: " + Update_Employeenumber + "<br>";
                        }
                        else
                        {
                            update_summary.InnerHtml += "Employee number unchanged <br>";
                        }
                        if (Update_Hiredate != "")
                        {
                            update_summary.InnerHtml += "Hire date: " + Update_Hiredate + "<br>";
                        }
                        else
                        {
                            update_summary.InnerHtml += "Hire date: unchanged <br>";
                        }
                        if (Update_Salary != "")
                        {
                            update_summary.InnerHtml += "Salary: " + Update_Salary + "<br>";
                        }
                        else
                        {
                            update_summary.InnerHtml += "Salary: unchanged <br>";
                        }
                    }
                }
            }
        }