protected void Page_Load(object sender, EventArgs e) { if (Session["Email"] == null) { Response.Redirect("LoginPage.aspx"); } else { string email = Session["Email"].ToString(); string id = ClassDefault.getid(email); if (Request.QueryString["impsubmit"] != null) { int Q1 = Convert.ToInt32(Request.Form["Q1"]); int Q2 = Convert.ToInt32(Request.Form["Q2"]); int Q3 = Convert.ToInt32(Request.Form["Q3"]); int Q4 = Convert.ToInt32(Request.Form["Q4"]); int Q5 = Convert.ToInt32(Request.Form["Q5"]); int Q6 = Convert.ToInt32(Request.Form["Q6"]); int Q7 = Convert.ToInt32(Request.Form["Q7"]); int Q8 = Convert.ToInt32(Request.Form["Q8"]); int Q9 = Convert.ToInt32(Request.Form["Q9"]); int Q10 = Convert.ToInt32(Request.Form["Q10"]); int[] numbers = { Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, Q10 }; long sum = SumOfNumbers(numbers); string result = showCategory(sum); string query = "insert into survey_result (user_id, result, survey_type, score) values (" + id + ", '" + result + "', 'Identify Methodology', '" + sum + "')"; ClassDefault.executeQuery(query); Response.Redirect("MethodologiesPage.aspx?category=" + result + "&result=" + sum + ""); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["feedback"] != null) { string name = (Request.Form["fullname"]); string email = (Request.Form["email"]); string subject = (Request.Form["subject"]); string message = (Request.Form["message"]); string query = "insert into feedback_table (name, subject, message, email) values ('" + name + "', '" + subject + "', '" + message + "', '" + email + "')"; ClassDefault.executeQuery(query); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Email"] != null) { string email = Session["Email"].ToString(); string query = "select * from user_table where email = '" + email + "'"; SqlConnection conn = ClassDefault.getConnection(); conn.Open(); SqlCommand cm = new SqlCommand(query, conn); sdr = cm.ExecuteReader(); while (sdr.Read()) { first_name = sdr["first_name"].ToString(); last_name = sdr["last_name"].ToString(); Email = sdr["email"].ToString(); contact = sdr["contact"].ToString(); } if (Request.QueryString["personalinfo"] != null) { string first_name = Request.Form["first_name"]; string last_name = Request.Form["last_name"]; string Email = Request.Form["email"]; string contact = Request.Form["contact"]; string query2 = "update user_table set first_name = '" + first_name + "', last_name = '" + last_name + "', email = '" + Email + "', contact = '" + contact + "' where email = '" + Email + "'"; ClassDefault.executeQuery(query2); Response.Redirect("UserDetailsPage.aspx"); } if (Request.QueryString["password"] != null) { string currentpass = Request.Form["currentpass"]; string newpass = Request.Form["newpass"]; string confirmpass = Request.Form["confirmpass"]; if (newpass == confirmpass) { string query3 = "update user_table set password = '******' where email = '" + Email + "'"; ClassDefault.executeQuery(query3); Response.Redirect("UserDetailsPage.aspx"); } else { Response.Write("<script>alert('Password Mismatch')</script>"); } } } else { Response.Redirect("LoginPage.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["register"] != null) { string password = Request.Form["password"]; string confirm_password = Request.Form["confirm_password"]; if (password == confirm_password) { if (password.Length < 6) { Response.Write("<script>alert('Password must be more than 6 characters')</script>"); } else { string fname = Request.Form["fname"]; string lname = Request.Form["lname"]; string email = Request.Form["email"]; bool checkEmail = ClassDefault.isEmailExists(email); if (!checkEmail) { string contact = Request.Form["contact"]; string query = "insert into user_table (PASSWORD, FIRST_NAME, LAST_NAME, EMAIL, CONTACT, USER_TYPE) values ('" + password + "','" + fname + "','" + lname + "','" + email + "','" + contact + "','user')"; ClassDefault.executeQuery(query); Response.Write("<script>alert('Register Success')</script>"); } else { Response.Write("<script>alert('Email already exists')</script>"); } } } else { Response.Write("<script>alert('Password Mismatch')</script>"); } } if (Request.QueryString["login"] != null) { string password = Request.Form["password"]; string email = Request.Form["email"]; bool result = ClassDefault.loginstate(email, password); if (result == true) { string usertype = System.Web.HttpContext.Current.Session["UserType"].ToString(); if (usertype == "user") { Response.Redirect("HomePage.aspx"); } if (usertype == "admin") { Response.Redirect("AdminPage.aspx"); } } else { Response.Write("<script>alert('Information Entered is Incorrect')</script>"); } } }