protected void Page_Load(object sender, EventArgs e) { if (Request.Form["LoginID"] != null && Request.Form["Password"] != null) { string loginID = Request.Form["LoginID"]; //Textbox: LoginID string password = Request.Form["Password"]; //Textbox: Password PParent objParent = new PParent(); objParent.PEmailAddr = loginID; objParent.PPassword = password; bool ParentAuthenticate = objParent.checkParentLogin(); Tutor objTutor = new Tutor(); objTutor.TEmailAddr = loginID; objTutor.TPassword = password; bool TutorAuthenticate = objTutor.checkTutorLogin(); if (ParentAuthenticate == true) { Session["LoginID"] = objParent.PName; Session["LoginDateTime"] = DateTime.Now.ToString(); Session["UserType"] = "Parent"; Response.Redirect("Parent/ParentHomepage.aspx"); } else if (TutorAuthenticate == true) { Session["LoginID"] = objTutor.TName; Session["LoginDateTime"] = DateTime.Now.ToString(); Session["UserType"] = "Tutor"; Response.Redirect("Tutor/TutorHomepage.aspx"); } else if (loginID == "*****@*****.**" && password == "passAdmin") { Session["LoginID"] = "Administrator"; Session["LoginDateTime"] = DateTime.Now.ToString(); Session["UserType"] = "Admin"; Response.Redirect("Admin/AdminHomepage.aspx"); } else { lblError.Text = "Invalid Login Credentials!"; } } }
protected void btnConfirm_Click(object sender, EventArgs e) { if (Page.IsValid) { lblUpdatedPw.Text = ""; Tutor objTutor = new Tutor(); objTutor.TPassword = txtConfirmPw.Text; int errorCode = objTutor.updatePw(); if (errorCode == 0) { lblUpdatedPw.Text = "New Password has been updated succesfully. "; } } }
protected void btnSettingSubmit_Click(object sender, EventArgs e) { if (Page.IsValid) { Tutor objTutor = new Tutor(); objTutor.TutorID = Convert.ToInt32(Session["LoginID"]); objTutor.TName = txtName.Text; objTutor.TEmailAddr = txtEmailAddr.Text; objTutor.TTelNo = txtTelNo.Text; // Call the add method to update therecord to database. int errorCode = objTutor.updateSettings(); // Record has been inserted successfully if the returned code is 0. if (errorCode == 0) lblNewSettings.Text = "New particulars have been updated successfully"; } }