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");
            }
        }
示例#3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            User    currentUser = (User)Session["currentUser"];
            string  link        = txtLink.Text;
            string  desc        = txtDesc.Text;
            Link    createThis  = new Link("http://" + link, desc, currentUser, DateTime.Now, "Active");
            LinkDAO linkdao     = new LinkDAO();
            int     linkID      = linkdao.createLink(createThis);

            //set audit
            setAudit(currentUser, "useful links", "create", linkID.ToString(), "link: " + link);

            Response.Redirect("manageUsefulLinks.aspx");
        }
示例#4
0
        // GET: Site
        public ActionResult Index(String slug = null)
        {
            LinkDAO LinkDAO = new LinkDAO();

            if (slug == null)
            {
                return(this.Home());
            }
            else
            {
                Link row_link = LinkDAO.getRow(slug);
                if (row_link != null)
                {
                    String linktype = row_link.table_name;
                    switch (linktype)
                    {
                    case "LoaiGiay":
                        return(this.ProductCategory(slug));

                    case "BaiViet":
                        return(this.PostDetail(slug));
                    }
                }
                else
                {
                    Giay row_product = productDAO.getRow(slug);
                    if (row_product != null)
                    {
                        return(ProductDetail(slug));
                    }
                    else
                    {
                        return(this.Product());
                    }
                }
            }
            return(Error404());
        }
        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");
        }
示例#6
0
 private LinkService()
 {
     //   _daoManager = ServiceConfig.GetInstance().DaoManager;
     //  _linkDao = _daoManager.GetDao(typeof(ILink)) as ILink;
     _linkDao = new LinkDAO();
 }