protected void btnConfirmSubmit_Click(object sender, EventArgs e) { //To do validations ChatBotHelpQuestionDAO cbhqDAO = new ChatBotHelpQuestionDAO(); int questionID = cbhqDAO.insertQuestion(txtHelpInput.Text); //set audit User currentUser = (User)Session["currentUser"]; setAudit(currentUser, "learny help questions", "create", questionID.ToString(), "created question: " + txtHelpInput.Text); Response.Redirect("askLearnyHelpQn.aspx"); }
protected void btnCfmDelete_Click(object sender, EventArgs e) { //To do validations ChatBotHelpQuestionDAO cbhqDAO = new ChatBotHelpQuestionDAO(); ChatBotHelpQuestion currentQuestion = cbhqDAO.getChatBotHelpQuestionByID(Convert.ToInt32(Request.QueryString["id"])); cbhqDAO.deleteQuestionByID(currentQuestion.questionID); //set audit User currentUser = (User)Session["currentUser"]; setAudit(currentUser, "learny help questions", "delete", currentQuestion.questionID.ToString(), "deleted question: " + currentQuestion.question); Response.Redirect("askLearnyHelpQn.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["currentUser"] == null) { Response.Redirect("/Login.aspx"); } else { if (!IsPostBack) { User currentUser = (User)Session["currentUser"]; Boolean superuser = false; foreach (String s in currentUser.getRoles()) { if (s.Equals("superuser")) { superuser = true; } } if (!currentUser.getDepartment().Equals("hr")) { if (!superuser) { Response.Redirect("errorPage.aspx"); } } else { ChatBotHelpQuestionDAO cbhqDAO = new ChatBotHelpQuestionDAO(); ChatBotHelpQuestion currentQuestion = cbhqDAO.getChatBotHelpQuestionByID(Convert.ToInt32(Request.QueryString["id"])); if (currentQuestion.question != null) { txtHelpInput.Text = currentQuestion.question; } else { Response.Redirect("errorPage.aspx"); } } } } }