public static void OnDeleting(BSLink link, CancelEventArgs e)
 {
     if (Deleting != null)
     {
         Deleting(link, e);
     }
 }
    private void SaveLink()
    {
        try
        {
            BSLink link = new BSLink();
            link.Name        = txtLinkTitle.Text;
            link.Description = txtLinkDescription.Text;
            link.Url         = txtLinkURL.Text;
            link.Target      = rblLinkTarget.SelectedValue;

            if (link.Save())
            {
                //Categories2.TermType = TermTypes.LinkCategory;
                //Categories2.SaveData(link.LinkID);
                Response.Redirect("Links.aspx?LinkID=" + link.LinkID + "&Message=1");
            }
            else
            {
                MessageBox1.Message = "Error";
                MessageBox1.Type    = MessageBox.ShowType.Error;
            }
        }
        catch (Exception ex)
        {
            MessageBox1.Message = ex.Message;
            MessageBox1.Type    = MessageBox.ShowType.Error;
        }
    }
 public static void OnDeleted(BSLink link, EventArgs e)
 {
     if (Deleted != null)
     {
         Deleted(link, e);
     }
 }
예제 #4
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"];
            }
        }
    }
 public static void OnSaving(BSLink link, CancelEventArgs e)
 {
     if (Saving != null)
     {
         Saving(link, e);
     }
 }
 public static void OnSaved(BSLink link, EventArgs e)
 {
     if (Saved != null)
     {
         Saved(link, e);
     }
 }
예제 #7
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();
        }
    }
 private static void FillLink(IDataReader dr, BSLink link)
 {
     link.LinkID       = (int)dr["LinkID"];
     link.Name         = (string)dr["Name"];
     link.Url          = (string)dr["Url"];
     link.Description  = (string)dr["Description"];
     link.Target       = (string)dr["Target"];
     link.LanguageCode = (string)dr["LanguageCode"];
 }
예제 #9
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();
            }
        }
    }
 public static BSLink GetLink(int iLinkID)
 {
     using (DataProcess dp = new DataProcess())
     {
         dp.AddParameter("LinkID", iLinkID);
         dp.ExecuteReader("SELECT * FROM Links WHERE [LinkID]=@LinkID");
         if (dp.Return.Status == DataProcessState.Success)
         {
             using (IDataReader dr = dp.Return.Value as IDataReader)
             {
                 if (dr != null && dr.Read())
                 {
                     BSLink link = new BSLink();
                     FillLink(dr, link);
                     return(link);
                 }
             }
         }
     }
     return(null);
 }
    public static List <BSLink> GetLinks()
    {
        List <BSLink> links = new List <BSLink>();

        using (DataProcess dp = new DataProcess())
        {
            dp.ExecuteReader("SELECT * FROM [Links]");
            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSLink link = new BSLink();
                        FillLink(dr, link);
                        links.Add(link);
                    }
                }
            }
        }
        return(links);
    }
    public static List <BSLink> GetLinks(int iTermID)
    {
        List <BSLink> links = new List <BSLink>();

        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("TermID", iTermID);
            dp.ExecuteReader("SELECT * FROM [Links] WHERE [LinkID] IN (SELECT [ObjectID] FROM [TermsTo] WHERE [TermID]=@TermID)");
            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSLink link = new BSLink();
                        FillLink(dr, link);
                        links.Add(link);
                    }
                }
            }
        }
        return(links);
    }
예제 #13
0
파일: BSLink.cs 프로젝트: Blogsa/blogsa
 private static void FillLink(IDataReader dr, BSLink link)
 {
     link.LinkID = (int)dr["LinkID"];
     link.Name = (string)dr["Name"];
     link.Url = (string)dr["Url"];
     link.Description = (string)dr["Description"];
     link.Target = (string)dr["Target"];
     link.LanguageCode = (string)dr["LanguageCode"];
 }
예제 #14
0
파일: BSLink.cs 프로젝트: Blogsa/blogsa
 public static void OnSaving(BSLink link, CancelEventArgs e)
 {
     if (Saving != null)
     {
         Saving(link, e);
     }
 }
예제 #15
0
파일: BSLink.cs 프로젝트: Blogsa/blogsa
 public static void OnSaved(BSLink link, EventArgs e)
 {
     if (Saved != null)
     {
         Saved(link, e);
     }
 }
예제 #16
0
파일: BSLink.cs 프로젝트: Blogsa/blogsa
 public static void OnDeleting(BSLink link, CancelEventArgs e)
 {
     if (Deleting != null)
     {
         Deleting(link, e);
     }
 }
예제 #17
0
파일: BSLink.cs 프로젝트: Blogsa/blogsa
 public static void OnDeleted(BSLink link, EventArgs e)
 {
     if (Deleted != null)
     {
         Deleted(link, e);
     }
 }
예제 #18
0
파일: BSLink.cs 프로젝트: Blogsa/blogsa
 public static List<BSLink> GetLinks(int iTermID)
 {
     List<BSLink> links = new List<BSLink>();
     using (DataProcess dp = new DataProcess())
     {
         dp.AddParameter("TermID", iTermID);
         dp.ExecuteReader("SELECT * FROM [Links] WHERE [LinkID] IN (SELECT [ObjectID] FROM [TermsTo] WHERE [TermID]=@TermID)");
         if (dp.Return.Status == DataProcessState.Success)
         {
             using (IDataReader dr = dp.Return.Value as IDataReader)
             {
                 while (dr != null && dr.Read())
                 {
                     BSLink link = new BSLink();
                     FillLink(dr, link);
                     links.Add(link);
                 }
             }
         }
     }
     return links;
 }
예제 #19
0
파일: BSLink.cs 프로젝트: Blogsa/blogsa
 public static List<BSLink> GetLinks()
 {
     List<BSLink> links = new List<BSLink>();
     using (DataProcess dp = new DataProcess())
     {
         dp.ExecuteReader("SELECT * FROM [Links]");
         if (dp.Return.Status == DataProcessState.Success)
         {
             using (IDataReader dr = dp.Return.Value as IDataReader)
             {
                 while (dr != null && dr.Read())
                 {
                     BSLink link = new BSLink();
                     FillLink(dr, link);
                     links.Add(link);
                 }
             }
         }
     }
     return links;
 }
예제 #20
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;
        }
    }
예제 #21
0
    protected void gvLinks_DataBinding(object sender, EventArgs e)
    {
        GridView gv = (GridView)sender;

        gv.DataSource = BSLink.GetLinks();
    }
예제 #22
0
파일: BSLink.cs 프로젝트: Blogsa/blogsa
 public static BSLink GetLink(int iLinkID)
 {
     using (DataProcess dp = new DataProcess())
     {
         dp.AddParameter("LinkID", iLinkID);
         dp.ExecuteReader("SELECT * FROM Links WHERE [LinkID]=@LinkID");
         if (dp.Return.Status == DataProcessState.Success)
         {
             using (IDataReader dr = dp.Return.Value as IDataReader)
             {
                 if (dr != null && dr.Read())
                 {
                     BSLink link = new BSLink();
                     FillLink(dr, link);
                     return link;
                 }
             }
         }
     }
     return null;
 }
예제 #23
0
파일: Add.aspx.cs 프로젝트: Blogsa/blogsa
    private void SaveLink()
    {
        try
        {
            BSLink link = new BSLink();
            link.Name = txtLinkTitle.Text;
            link.Description = txtLinkDescription.Text;
            link.Url = txtLinkURL.Text;
            link.Target = rblLinkTarget.SelectedValue;

            if (link.Save())
            {
                //Categories2.TermType = TermTypes.LinkCategory;
                //Categories2.SaveData(link.LinkID);
                Response.Redirect("Links.aspx?LinkID=" + link.LinkID + "&Message=1");
            }
            else
            {
                MessageBox1.Message = "Error";
                MessageBox1.Type = MessageBox.ShowType.Error;
            }
        }
        catch (Exception ex)
        {
            MessageBox1.Message = ex.Message;
            MessageBox1.Type = MessageBox.ShowType.Error;
        }
    }