protected void Button2_Click(object sender, EventArgs e)
        {
            HogwartsDatabaseModelDataContext db = new HogwartsDatabaseModelDataContext();
            int StudentID = Convert.ToInt32(GridView1.Rows[0].Cells[0].Text);

            var NewStu = (from nstu in db.StudentRequests
                          where nstu.StudentID == StudentID
                          select nstu).First();

            string NewHouseName = NewStu.NewHouseName;

            var house = (from h in db.Houses
                         where h.HouseName == NewHouseName
                         select h).First();
            var stu = (from s in db.Students
                       where s.StudentID == StudentID
                       select s).First();

            stu.FirstName = NewStu.NewFirstName;
            stu.LastName = NewStu.NewLastName;
            stu.Nationality = NewStu.NewNationality;
            stu.MmailAddress = NewStu.NewMMailAddress;
            stu.HouseID = house.HouseID;
            db.SubmitChanges();
            deleteStudentRequest();
            //give notification to the student in charge
            Staff staff = Classes.HogwartsDataAccess.GetStaff(Context.User.Identity.Name);
            Classes.TableDataContract.AddNotice(staff.StaffID, StudentID, "accepted", 0, true, false);
            Response.Redirect("ProcessStudentRequests.aspx");
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = Label2.Text = Label3.Text = Label4.Text = "";
            if (TextBox1.Text == "")
                Label1.Text = "Field can't be nill";
            if (TextBox2.Text == "")
                Label2.Text = "Field can't be nill";
            if (TextBox3.Text == "")
                Label3.Text = "Field can't be nill";
            if (TextBox4.Text == "")
                Label4.Text = "Field can't be nill";
            if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "" || TextBox4.Text == "")
                return;

            //update username + password
            string OldUserName = Context.User.Identity.Name;
            HogwartsDatabaseModelDataContext db = new HogwartsDatabaseModelDataContext();
            var NeededStu = (from st in db.Students
                             where st.UserName == OldUserName
                             select st).First();
            StudentRequest sr = new StudentRequest();
            sr.StudentID = NeededStu.StudentID;
            sr.NewFirstName = TextBox1.Text;
            sr.NewLastName = TextBox2.Text;
            sr.NewNationality = TextBox3.Text;
            sr.NewMMailAddress = TextBox4.Text;
            sr.NewHouseName = DropDownList1.SelectedValue;
            db.StudentRequests.InsertOnSubmit(sr);
            db.SubmitChanges();

            //NOTICE TO ALL ONLINE STAFF
            List<Staff> lst = db.Staffs.ToList();
            for(int i=0;i<lst.Count;i++)
                Classes.TableDataContract.AddStudentRequest(Classes.HogwartsDataAccess.GetStudentID(Context.User.Identity.Name), lst[i].StaffID, false);
            Response.Redirect("./StudentInfo.aspx");
        }
 protected void deleteStudentRequest()
 {
     HogwartsDatabaseModelDataContext db = new HogwartsDatabaseModelDataContext();
     int StudentID = Convert.ToInt32(GridView1.Rows[0].Cells[0].Text);
     var Stu = (from stu in db.StudentRequests
                where stu.StudentID == StudentID
                select stu).First();
     db.StudentRequests.DeleteOnSubmit(Stu);
     db.SubmitChanges();
     GridView1.DataSource = null;
     GridView1.DataBind();
     GridView2.DataSource = null;
     GridView2.DataBind();
     DropDownList1.Items.Remove(Convert.ToString(StudentID));
     Button2.Visible = false;
     Button3.Visible = false;
 }