Ejemplo n.º 1
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        bool bRemove = false;

        for (int i = 0; i < gvLinks.Rows.Count; i++)
        {
            CheckBox cb = gvLinks.Rows[i].FindControl("cb") as CheckBox;
            if (cb.Checked)
            {
                Literal literal = gvLinks.Rows[i].FindControl("LinkID") as Literal;
                if (literal != null)
                {
                    int iLinkId = 0;
                    int.TryParse(literal.Text, out iLinkId);

                    BSLink link = BSLink.GetLink(iLinkId);

                    if (link != null)
                    {
                        bRemove = link.Remove();
                    }
                }
            }
        }
        if (bRemove)
        {
            MessageBox1.Message = Language.Admin["LinkDeleted"];
            MessageBox1.Type    = MessageBox.ShowType.Information;
            MessageBox1.Visible = true;
            gvLinks.DataBind();
        }
    }
Ejemplo n.º 2
0
    protected void btnSaveLink_Click(object sender, EventArgs e)
    {
        int iLinkID = 0;

        int.TryParse(Request["LinkID"], out iLinkID);

        if (iLinkID > 0)
        {
            BSLink link = BSLink.GetLink(iLinkID);
            link.Name         = txtLinkTitle.Text;
            link.Description  = txtLinkDescription.Text;
            link.Url          = txtLinkURL.Text;
            link.Target       = rblLinkTarget.SelectedValue;
            link.LanguageCode = lpLinkLanguage.LangaugeCode;

            if (link.Save())
            {
                Categories1.TermType = TermTypes.LinkCategory;
                Categories1.SaveData(link.LinkID);
                MessageBox1.Message = Language.Admin["LinkSaved"];
                MessageBox1.Type    = MessageBox.ShowType.Information;
            }
            else
            {
                MessageBox1.Message = Language.Admin["LinkError"];
            }
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        GenerateHeaderButtons();
        Categories1.TermType        = TermTypes.LinkCategory;
        rblLinkTarget.Items[0].Text = Language.Admin["Standard"];
        if (!Page.IsPostBack)
        {
            string Msg = Request.QueryString["Message"];
            switch (Msg)
            {
            case "1": MessageBox1.Message = Language.Admin["PostSaved"]; break;

            default: break;
            }
            HideAll();

            int iLinkID = 0;
            int.TryParse(Request["LinkID"], out iLinkID);

            if (iLinkID > 0)
            {
                BSLink link = BSLink.GetLink(iLinkID);

                if (link != null)
                {
                    Categories1.TermType = TermTypes.LinkCategory;
                    Categories1.LoadData(link.LinkID);
                    divAddLink.Visible     = true;
                    divAddPostSide.Visible = true;

                    txtLinkTitle.Text           = link.Name;
                    txtLinkDescription.Text     = link.Description;
                    txtLinkURL.Text             = link.Url;
                    rblLinkTarget.SelectedValue = link.Target;
                    lpLinkLanguage.LangaugeCode = link.LanguageCode;
                }
                else
                {
                    Response.Redirect("Links.aspx");
                }
            }
            else
            {
                divPosts.Visible = true;
                gvLinks.DataBind();
            }
        }
    }
Ejemplo n.º 4
0
    private static void FillMenu(IDataReader dr, BSMenu menu)
    {
        menu.Description = (string)dr["Description"];
        menu.MenuGroupID = (int)dr["MenuGroupID"];
        menu.MenuID      = (int)dr["MenuID"];
        menu.MenuType    = (MenuTypes)dr["MenuType"];
        menu.ObjectID    = (int)dr["ObjectID"];
        menu.ObjectType  = (ObjectTypes)dr["ObjectType"];
        menu.ParentID    = (int)dr["ParentID"];
        menu.Sort        = (short)dr["Sort"];
        menu.Target      = (string)dr["Target"];
        menu.Title       = (string)dr["Title"];
        menu.Url         = (string)dr["Url"];

        if (menu.Url.StartsWith("~/"))
        {
            menu.Url = Blogsa.Url + menu.Url.Substring(2);
        }

        switch (menu.ObjectType)
        {
        case ObjectTypes.Article:
            BSPost article = BSPost.GetPost(menu.ObjectID);
            if (article != null)
            {
                menu.Title = article.Title;
                menu.Url   = article.Link;
            }
            break;

        case ObjectTypes.Page:
            BSPost page = BSPost.GetPost(menu.ObjectID);
            if (page != null)
            {
                menu.Title = page.Title;
                menu.Url   = page.Link;
            }
            break;

        case ObjectTypes.File:
            BSPost file = BSPost.GetPost(menu.ObjectID);
            if (file != null)
            {
                menu.Title = file.Title;
                menu.Url   = file.Link;
            }
            break;

        case ObjectTypes.Link:
            BSLink link = BSLink.GetLink(menu.ObjectID);
            if (link != null)
            {
                menu.Title = link.Name;
                menu.Url   = link.Url;
            }
            break;

        case ObjectTypes.Term:
            BSTerm term = BSTerm.GetTerm(menu.ObjectID);
            if (term != null)
            {
                menu.Title = term.Name;
                menu.Url   = term.Link;
            }
            break;

        case ObjectTypes.Comment:
            BSComment comment = BSComment.GetComment(menu.ObjectID);
            if (comment != null)
            {
                menu.Title = comment.Content;
                menu.Url   = comment.Link;
            }
            break;

        default:
            break;
        }
    }