protected void Page_Load(object sender, EventArgs e)
        {
            User currentUser = (User)Session["currentUser"];

            if (currentUser == null)
            {
                Response.Redirect("login.aspx");
            }
            Boolean authenticate = authenticateAccess(currentUser);

            if (!authenticate)
            {
                Response.Redirect("errorPage.aspx");
            }
            else
            {
                if (!IsPostBack)
                {
                    string  id     = Request.QueryString["id"];
                    int     id_num = Convert.ToInt32(id);
                    LinkDAO adao   = new LinkDAO();
                    Link    a      = adao.getLinksById(id_num);
                    txtLink.Text = a.link_path;
                    txtDesc.Text = a.description;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            User    currentUser  = (User)Session["currentUser"];
            Boolean authenticate = authenticateAccess(currentUser);

            if (Request.QueryString["id"] != null)
            {
                if (!authenticate)
                {
                    Response.Redirect("errorPage.aspx");
                }
                else
                {
                    //TestimonialDAO tdao = new TestimonialDAO();
                    string  id     = Request.QueryString["id"];
                    int     id_num = Convert.ToInt32(id);
                    LinkDAO adao   = new LinkDAO();
                    Link    link   = adao.getLinksById(id_num);
                    adao.deactivateArticle(id_num);

                    //set audit
                    setAudit(currentUser, "useful links", "delete", id, "deleted link: " + link.link_path);

                    Response.Redirect("manageUsefulLinks.aspx");
                }
            }
            else
            {
                Response.Redirect("errorPage.aspx");
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            LinkDAO  ldao     = new LinkDAO();
            string   link     = txtLink.Text;
            string   desc     = txtDesc.Text;
            string   id       = Request.QueryString["id"];
            int      id_num   = Convert.ToInt32(id);
            Link     article  = ldao.getLinksById(id_num);
            int      id_edit  = article.link_id;
            DateTime start    = article.upload_datetime;
            User     u        = article.user;
            string   status   = article.status;
            Link     toChange = new Link(id_edit, link, desc, u, start, status);

            ldao.updateLink(toChange);

            //set audit
            User currentUser = (User)Session["currentUser"];

            setAudit(currentUser, "useful links", "update", id, "updated link: " + link);

            Response.Redirect("manageUsefulLinks.aspx");
        }