예제 #1
0
        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");
        }
예제 #2
0
        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");
        }
예제 #3
0
        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");
                        }
                    }
                }
            }
        }