Esempio n. 1
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"];
            }
        }
    }
Esempio n. 2
0
    protected void btnSavePost_Click(object sender, EventArgs e)
    {
        try
        {
            int iFileID = 0;
            int.TryParse(Request["FileID"], out iFileID);

            BSPost bsPost = BSPost.GetPost(iFileID);

            bsPost.Content    = tmceContent.Content;
            bsPost.State      = (PostStates)Convert.ToInt16(ddState.SelectedValue);
            bsPost.AddComment = cblAddComment.Checked;
            bsPost.UpdateDate = DateTime.Now;

            Categories1.SaveData(bsPost.PostID);
            Tags1.SaveTags(bsPost.PostID);
            if (bsPost.Save())
            {
                Response.Redirect("Library.aspx?FileID=" + bsPost.PostID + "&Message=1");
            }
            else
            {
                MessageBox1.Message = "Error";
                MessageBox1.Type    = MessageBox.ShowType.Error;
            }
        }
        catch (Exception ex)
        {
            MessageBox1.Message = ex.Message;
            MessageBox1.Type    = MessageBox.ShowType.Error;
        }
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        btnDelete.OnClientClick = "return confirm('" + Language.Admin["CategoryDeleteConfirm"] + "');";
        HideAll();

        int iFileID = 0;

        int.TryParse(Request["FileID"], out iFileID);

        if (!string.IsNullOrEmpty(Request["p"]) && Request["p"].Equals("new"))
        {
            divAddMedia.Visible = true;
        }
        else if (iFileID != 0)
        {
            divEditMedia.Visible     = true;
            divEditMediaSide.Visible = true;

            divEditMedia.Visible     = true;
            divEditMediaSide.Visible = true;
            if (!IsPostBack)
            {
                BSPost bsPost = BSPost.GetPost(iFileID);
                if (bsPost != null)
                {
                    tmceContent.Content   = bsPost.Content;
                    txtTitle.Text         = bsPost.Title;
                    cblAddComment.Checked = bsPost.AddComment;
                    ddState.SelectedValue = bsPost.State.ToString();
                    Categories1.TermType  = TermTypes.Category;
                    Categories1.LoadData(bsPost.PostID);
                    Tags1.LoadTags(bsPost.PostID);
                    ddState.Items[0].Text = Language.Admin["HiddenFile"];
                    ddState.Items[1].Text = Language.Admin["PublicFile"];
                    cblAddComment.Text    = Language.Admin["CommentAdd"];

                    string strFolder = bsPost.Show == PostVisibleTypes.Hidden ? "Files/" : bsPost.Show == PostVisibleTypes.Public ? "Images/" : "Files/";

                    ltOpenAddress.Text    = "Upload/" + strFolder + bsPost.Title;
                    ltShowAddress.Text    = "?FileID=" + bsPost.PostID;
                    ltDownloadAdress.Text = "FileHandler.ashx?FileID=" + bsPost.PostID;
                }
                else
                {
                    Response.Redirect("Library.aspx");
                }
            }
        }
        else
        {
            if (!IsPostBack)
            {
                gvPosts.DataBind();
            }
            divLibrary.Visible = true;
        }
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Categories1.LoadData(0);

        rblDate.Items[0].Text = Language.Admin["NowPublish"];
        rblDate.Items[1].Text = Language.Admin["ChangeDateTime"];

        ddState.Items[0].Text = Language.Admin["Publish"];
        ddState.Items[1].Text = Language.Admin["Draft"];
        cblAddComment.Text    = Language.Admin["CommentAdd"];
    }
Esempio n. 5
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();
            }
        }
    }
    /// <summary>
    /// Page Load
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        gvhDefault.SearchButton.Click += new EventHandler(lbSearch_Click);

        GenerateHeaderButtons();

        if (!Page.IsPostBack)
        {
            HideAll();
            string PostID  = Request.QueryString["PostID"];
            int    iPostID = 0;

            int.TryParse(PostID, out iPostID);

            if (iPostID > 0)
            {
                BSPost bsPost = BSPost.GetPost(iPostID);

                divAddPost.Visible     = true;
                divAddPostSide.Visible = true;
                if (bsPost != null)
                {
                    tmceContent.Content   = bsPost.Content;
                    txtTitle.Text         = bsPost.Title;
                    cblAddComment.Checked = bsPost.AddComment;
                    ddState.SelectedValue = bsPost.State.ToString();
                    Categories1.TermType  = TermTypes.Category;
                    Categories1.LoadData(bsPost.PostID);
                    Tags1.LoadTags(bsPost.PostID);
                    rblDate.Items[0].Text = Language.Admin["NowPublish"];
                    rblDate.Items[1].Text = Language.Admin["ChangeDateTime"];

                    dtsDateTime.SelectedDateTime = bsPost.Date;
                }
                else
                {
                    Response.Redirect("Posts.aspx");
                }
            }
            else
            {
                divPosts.Visible = true;
                gvPosts.DataBind();
            }
        }
    }
    /// <summary>
    /// Save Post(s) click action.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSavePost_Click(object sender, EventArgs e)
    {
        try
        {
            string PostID  = Request.QueryString["PostID"];
            int    iPostID = 0;

            int.TryParse(PostID, out iPostID);

            BSPost bsPost = BSPost.GetPost(iPostID);

            bsPost.Title      = txtTitle.Text;
            bsPost.Code       = BSHelper.CreateCode(txtTitle.Text);
            bsPost.Content    = tmceContent.Content;
            bsPost.State      = (PostStates)Convert.ToInt16(ddState.SelectedValue);
            bsPost.AddComment = cblAddComment.Checked;
            bsPost.UpdateDate = DateTime.Now;

            if (rblDate.SelectedValue == "1")
            {
                bsPost.Date = dtsDateTime.SelectedDateTime;
            }

            Categories1.SaveData(bsPost.PostID);
            Tags1.SaveTags(bsPost.PostID);

            if (bsPost.Save())
            {
                Response.Redirect("Posts.aspx?PostID=" + PostID + "&Message=1");
            }
            else
            {
                MessageBox1.Message = Language.Admin["PostError"];
                MessageBox1.Type    = MessageBox.ShowType.Error;
            }
        }
        catch (Exception ex)
        {
            MessageBox1.Message = ex.Message;
            MessageBox1.Type    = MessageBox.ShowType.Error;
        }
    }
Esempio n. 8
0
 public void Save(int postId)
 {
     Categories1.SaveData(postId);
     Tags1.SaveTags(postId);
 }
Esempio n. 9
0
 //Post
 public static void AddCategory(Categories1 c)
 {
     Dal.CategoriesDal.AddCategory(DTO.Categories1.Todal(c));
 }
Esempio n. 10
0
 public static List <Categories1> GetAllCategories()
 {
     return(Categories1.ConvertToListDto(Dal.CategoriesDal.GetAll()));
 }
Esempio n. 11
0
 //Get
 public static Categories1 GetById(int id)
 {
     DTO.Categories1 cc = new Categories1(Dal.CategoriesDal.GetById(id));
     return(cc);
 }