protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BusinessLogicLayer.Entities.ContentManagement.Article article = new BusinessLogicLayer.Entities.ContentManagement.Article(); int id = 0; string code = Request["Code"]; if (string.IsNullOrEmpty(code)) { code = Page.RouteData.Values["Id"].ToString(); } Int32.TryParse(code, out id); if (id != 0) { article = BusinessLogicLayer.Common.ArticleLogic.GetByID(id); if (article != null) { NewsBlock.Visible = true; NoNewsBlock.Visible = false; ArticleTitle.InnerText = article.ArticleName; ArticleTitleText = article.ArticleName; this.Page.Title = article.ArticleName; ArticleSubTitle.InnerText = article.SubTitle; MainImage.Src = GetImagePath(article.ArticleAttachment); if (!string.IsNullOrEmpty(article.ArticleArabic.AuthorAlias)) { AuthorAlilas.InnerText += article.ArticleArabic.AuthorAlias; WriterImage.Visible = false; } else AuthorAlilas.InnerText = article.AuthorName; Content.InnerHtml = article.ArticleContent; DateSpan.InnerText = GetDate(article.PostDate); ManatiqFrontEnd.News.Default defaultPage = this.Page as ManatiqFrontEnd.News.Default; if (defaultPage != null) { defaultPage.ogImage.Attributes.Add("content", GetImagePath(article.ArticleAttachment)); defaultPage.ogDescription.Attributes.Add("content", article.ArticleDescription); defaultPage.ogTitle.Attributes.Add("content", article.ArticleName); } WriterImage.Src = GetWriterImagePath(article.Author.PersonImage); ArticleViews.InnerText = CommonWeb.Common.BasePage.TranslateNumerals(article.ViewsCount.ToString("n0")); string sources = ""; foreach (BusinessLogicLayer.Entities.ContentManagement.ArticleSources source in article.ArticleSources) { sources += " " + source.CurrentSource.Name + " -"; } if (!string.IsNullOrEmpty(sources)) { sources = sources.Remove(sources.Length - 1, 1); } if(!string.IsNullOrEmpty(sources)) AuthorAlilas.InnerText += " - " + sources; new BusinessLogicLayer.Components.ContentManagement.ArticleViewsLogic().Insert(article.ArticleId, CommonWeb.Common.Tools.GetIPAddress(), DateTime.Now); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { descLength = 30; BusinessLogicLayer.Entities.ContentManagement.Article articleItem = new BusinessLogicLayer.Entities.ContentManagement.Article(); LoadData(); int id = 0; string code = Request["Code"]; if (string.IsNullOrEmpty(code)) { code = Page.RouteData.Values["Id"].ToString(); } Int32.TryParse(code, out id); int i = Articles.Count; if (id != 0) { articleItem = BusinessLogicLayer.Common.ArticleLogic.GetByID(id); if (articleItem != null) { List<BusinessLogicLayer.Entities.ContentManagement.Article> articles = BusinessLogicLayer.Common.ArticleLogic.GetAllBySectionIdandCountExcludingCurrent(articleItem.ArticleId, articleItem.SiteSectionId.ToString(), HomePage.ItemsNumber); foreach (BusinessLogicLayer.Entities.ContentManagement.Article article in articles) { if (i >= HomePage.ItemsNumber) break; BusinessLogicLayer.Entities.ContentManagement.ContentModuleArticle cmArticles = new BusinessLogicLayer.Entities.ContentManagement.ContentModuleArticle(); cmArticles.ArticleID = article.ArticleId; cmArticles.CurrentArticle = article; cmArticles.ArticleOrder = i; cmArticles.HomePageID = HomePageID; Articles.Add(cmArticles); i++; } } } LayoutNewsRepeater.DataSource = Articles; LayoutNewsRepeater.DataBind(); ModuleTitleText.InnerText = ModuleTitle; MoreLink.HRef = GetMoreLink(); if (!IsFirst) MainBlockContainer.Attributes.Add("class", "block-news international mrg-top"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BusinessLogicLayer.Entities.ContentManagement.Article article = new BusinessLogicLayer.Entities.ContentManagement.Article(); int id = 0; string code = Request["Code"]; if (string.IsNullOrEmpty(code)) { code = Page.RouteData.Values["Id"].ToString(); } Int32.TryParse(code, out id); if (id != 0) { article = BusinessLogicLayer.Common.ArticleLogic.GetByID(id); if (article != null) { ArticleTitle.InnerText = article.ArticleName; this.Page.Title = article.ArticleName; MainImage.Src = GetWriterImagePath(article.Author.PersonImage); AuthorAlilas.InnerText = article.AuthorName; BusinessLogicLayer.Entities.HumanResources.Employees emp = new BusinessLogicLayer.Components.HumanResources.EmployeesLogic().GetByID(article.Author.BusinessEntityId); if (emp != null) PositionLabel.InnerText = emp.Position; Content.InnerHtml = article.ArticleContent; columnistLink.HRef += article.AuthorId; DateSpan.InnerText = GetDate(article.PostDate); ManatiqFrontEnd.News.Default defaultPage = this.Page as ManatiqFrontEnd.News.Default; ArticleViews.InnerText = CommonWeb.Common.BasePage.TranslateNumerals(article.ViewsCount.ToString("n0")); if (defaultPage != null) { defaultPage.ogImage.Attributes.Add("content", GetWriterImagePath(article.ArticleAttachment)); defaultPage.ogDescription.Attributes.Add("content", article.ArticleDescription); defaultPage.ogTitle.Attributes.Add("content", article.ArticleName); } new BusinessLogicLayer.Components.ContentManagement.ArticleViewsLogic().Insert(article.ArticleId, CommonWeb.Common.Tools.GetIPAddress(), DateTime.Now); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { uploadHidden.Add("HaveWaterMark", false); SitePage = null; Session["UploadedFile"] = null; DevExpress.Web.ASPxEditors.ASPxListBox checkbox = categoriesDropDownEdit.FindControl("listBox") as DevExpress.Web.ASPxEditors.ASPxListBox; if (checkbox != null) { checkbox.DataBind(); checkbox.Items.Insert(0, new DevExpress.Web.ASPxEditors.ListEditItem("(Select All)", "0")); } pageSite.DataBind(); pageState.DataBind(); pageArticleType.DataBind(); pageAuthor.DataBind(); //pageAuthor.SelectedIndex = pageAuthor.Items.IndexOfValue(SecurityManager.getUser(this).BusinessEntityId); //pageSecurityAccess.DataBind(); pageLanguages.DataBind(); pageLanguages.SelectedIndex = pageLanguages.Items.IndexOfValue(BusinessLogicLayer.Common.DefaultLanguage.LanguageId); if (!string.IsNullOrEmpty(Request["Code"])) { int pageId = 0; Int32.TryParse(Request["Code"], out pageId); SitePage = BusinessLogicLayer.Common.ArticleLogic.GetByID(pageId); if (!SitePage.NewRecord) { SiteLink = pageId.ToString(); pageSite.SelectedIndex = pageSite.Items.IndexOfValue(SitePage.SiteId); pageArticleType.SelectedIndex = pageArticleType.Items.IndexOfValue(SitePage.ArticleTypeID); pageState.SelectedIndex = pageState.Items.IndexOfValue(SitePage.ArticleStatusId); //pageSecurityAccess.SelectedIndex = pageSecurityAccess.Items.IndexOfValue(SitePage.SecurityAccessTypeId); //pageAlias.Text = SitePage.UniquePageName; //chkIsMainPage.Checked = SitePage.IsMainPage; pageSection.DataBind(); ((DevExpress.Web.ASPxTreeList.ASPxTreeList)DropDownEdit.FindControl("SectionTreeView")).DataBind(); TreeListNode node = ((DevExpress.Web.ASPxTreeList.ASPxTreeList)DropDownEdit.FindControl("SectionTreeView")).FindNodeByKeyValue(SitePage.SiteSectionId.ToString()); node.Focus(); DropDownEdit.KeyValue = SitePage.SiteSectionId; DropDownEdit.Text = GetEntryText(node); pageSection.SelectedIndex = pageSection.Items.IndexOfValue(SitePage.SiteSectionId); List<BusinessLogicLayer.Entities.ContentManagement.ArticleCategory> cats = BusinessLogicLayer.Common.ArticleCategoryLogic.GetAllByArticleId(SitePage.ArticleId); foreach (BusinessLogicLayer.Entities.ContentManagement.ArticleCategory cat in cats) { foreach (DevExpress.Web.ASPxEditors.ListEditItem item in checkbox.Items) { if (item.Value.ToString() == cat.SiteCategoryId.ToString()) { categoriesDropDownEdit.Text += item.Text + ";"; item.Selected = true; } } } if (categoriesDropDownEdit.Text.Length > 0) categoriesDropDownEdit.Text = categoriesDropDownEdit.Text.Remove(categoriesDropDownEdit.Text.Length - 1, 1); if (checkbox != null) { foreach (DevExpress.Web.ASPxEditors.ListEditItem item in checkbox.Items) { if (item.Value.ToString() != "0") { BusinessLogicLayer.Common.ArticleCategoryLogic.Insert(Convert.ToInt32(item.Value), SitePage.ArticleId, DateTime.Now); } } } cmbCommentType.DataBind(); cmbCommentType.SelectedIndex = cmbCommentType.Items.IndexOfValue(SitePage.CommentsTypeId); pageLanguages.SelectedIndex = pageLanguages.Items.IndexOfValue(BusinessLogicLayer.Common.DefaultLanguage.LanguageId); BusinessLogicLayer.Entities.ContentManagement.ArticleLanguage splang = SitePage.GetArticlePageLanguageByLanguageId(Convert.ToInt32(pageLanguages.SelectedItem.Value)); pageTitle.Text = splang.ArticleName; pageSubTitle.Text = splang.ArticleSubTitle; pageShortTitle.Text = splang.ArticleShortTitle; pageContent.Html = splang.ArticleContent; txtAlias.Text = splang.ArticleAlias; txtAuthor.Text = splang.AuthorAlias; txtSummaryText.Text = splang.ArticleSummary; pageAuthor.SelectedIndex = pageAuthor.Items.IndexOfValue(SitePage.AuthorId); if(chkListSources.Items.Count == 0) chkListSources.DataBind(); foreach (BusinessLogicLayer.Entities.ContentManagement.ArticleSources source in SitePage.ArticleSources) { chkListSources.Items.FindByValue(source.SourceID).Selected = true; } //pageAlias.Text = splang.ArticleAlias; } } OldLanguageId = (int)pageLanguages.SelectedItem.Value; } }