Exemple #1
0
    private void BindArticleDetails(MyBuyList.Shared.Entities.Article article)
    {
        if (article != null && article.ArticleId != FOOTER_ARTICLE_ID)
        {
            this.lblTitle.Text    = article.Title;
            this.lblAbstract.Text = article.Abstract;
            this.lblAuthor2.Text  = article.Publisher;
            this.lblDate.Text     = "פורסם בתאריך " + article.ModifiedDate.ToShortDateString();

            this.articleBody.InnerHtml = article.Body;
        }
        else
        {
            this.lblTitle.Text       = "המאמר לא נמצא";
            this.lblAbstract.Visible = false;
            this.lblAuthor1.Visible  = false;
            this.lblAuthor2.Visible  = false;
            this.lblDate.Visible     = false;

            this.articleBody.Visible = false;
        }

        if (this.ArticleId != null && ((BasePage)this.Page).UserType == 1)
        {
            this.btnAdminEdit.Visible      = true;
            this.btnAdminEdit.NavigateUrl += string.Format("?ArticleId={0}", this.ArticleId.Value);
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            MyBuyList.Shared.Entities.Article article = null;

            if (this.ArticleId != null)
            {
                article = BusinessFacade.Instance.GetArticleById(this.ArticleId.Value);
            }

            this.BindArticleDetails(article);
        }
    }
    private void RebindArticleData(MyBuyList.Shared.Entities.Article article)
    {
        if (article != null)
        {
            this.hfArticleId.Value    = article.ArticleId.ToString();
            this.txtArticleTitle.Text = article.Title;
            this.txtPublisher.Text    = article.Publisher;
            this.txtAbstract.Text     = article.Abstract;
            this.lblModifiedDate.Text = article.ModifiedDate.ToShortDateString();

            this.txtBody.Text = article.Body; //change to FCKEditor
        }
        else
        {
            this.hfArticleId.Value = "-1";
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (((BasePage)this.Page).UserType != 1)
            {
                AppEnv.MoveToDefaultPage();
            }

            int id = -1;
            if (Request.QueryString["ArticleId"] != null && int.TryParse(Request.QueryString["ArticleId"], out id))
            {
            }
            else
            {
                id = FOOTER_ID;
            }

            MyBuyList.Shared.Entities.Article article = BusinessFacade.Instance.GetArticleById(id);

            if (article != null)
            {
                this.RebindArticleData(article);
            }

            MyBuyList.Shared.Entities.Article[] allArticles = BusinessFacade.Instance.GetArticlesList();

            Dictionary <int, string> articleList = new Dictionary <int, string>();

            foreach (MyBuyList.Shared.Entities.Article art in allArticles)
            {
                articleList.Add(art.ArticleId, art.Title);
            }
            articleList.Add(FOOTER_ID, BusinessFacade.Instance.GetArticleById(FOOTER_ID).Title);

            this.ddlArticles.DataSource     = articleList;
            this.ddlArticles.DataTextField  = "value";
            this.ddlArticles.DataValueField = "key";
            this.ddlArticles.DataBind();
            this.ddlArticles.SelectedValue = id.ToString();
        }
    }
 protected void ddlArticles_SelectedIndexChanged(object sender, EventArgs e)
 {
     MyBuyList.Shared.Entities.Article article = BusinessFacade.Instance.GetArticleById(int.Parse(this.ddlArticles.SelectedValue));
     this.RebindArticleData(article);
 }