protected void Page_Load(object sender, EventArgs e) { if (Session["currentUser"] != null) { User currentUser = (User)Session["currentUser"]; Boolean superuser = false; foreach (String s in currentUser.getRoles()) { if (s.Equals("superuser")) { superuser = true; } } if (!superuser) { Response.Redirect("errorPage.aspx"); } else { if (!IsPostBack) { ChatBotInstructionDAO cbiDAO = new ChatBotInstructionDAO(); ChatBotInstruction currentInstruction = cbiDAO.getInstruction(); txtTitle.Text = currentInstruction.title; CKEditor1.Text = currentInstruction.instruction; } } } else { Response.Redirect("Login.aspx"); } }
protected void btnSave_Click(object sender, EventArgs e) { //to do validations ChatBotInstructionDAO cbiDAO = new ChatBotInstructionDAO(); cbiDAO.updateChatBotInstruction(txtTitle.Text, CKEditor1.Text); //set audit User currentUser = (User)Session["currentUser"]; setAudit(currentUser, "learny instructions", "update", null, "updated instruction title: " + txtTitle.Text); Response.Redirect("siteConfig.aspx"); }