Example #1
0
 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);
             }
         }
     }
 }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     base.Page_Load(sender, e);
     if (!IsPostBack)
     {
         CurrentPerson = null;
         CurrentEmployee = null;
         int x = 0;
         Int32.TryParse(Request["Code"], out x);
         if (x != 0)
         {
             BusinessLogicLayer.Entities.HumanResources.Employees emp = new BusinessLogicLayer.Components.HumanResources.EmployeesLogic().GetByID(x);
             if (emp != null)
             {
                 CurrentEmployee = emp;
                 CurrentPerson = emp.EmployeePerson;
                 LoadData();
             }
         }
     }
 }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                descLength = 32;
                LoadData();
                int idColumnist = 0;
                string code = Request["cl"];
                if (string.IsNullOrEmpty(code))
                {
                    code = Page.RouteData.Values["cl"].ToString();
                }
                Int32.TryParse(code, out idColumnist);
                BusinessLogicLayer.Entities.Persons.Person author = new BusinessLogicLayer.Entities.Persons.Person();
                if (idColumnist != 0)
                {
                    List<BusinessLogicLayer.Entities.ContentManagement.Article> articles = BusinessLogicLayer.Common.ArticleLogic.FindArticlesByAuthor(BusinessLogicLayer.Common.DefaultLanguageId, BusinessLogicLayer.Common.ManatiqID.ToString(), idColumnist.ToString());
                    var xlist = (from x in articles orderby x.PostDate descending select x).ToList();
                    int i = 0;
                    author = BusinessLogicLayer.Common.PersonLogic.GetByID(idColumnist);
                    foreach (BusinessLogicLayer.Entities.ContentManagement.Article a in xlist)
                    {
                        BusinessLogicLayer.Entities.ContentManagement.ContentModuleArticle cmArticles = new BusinessLogicLayer.Entities.ContentManagement.ContentModuleArticle();
                        cmArticles.ArticleID = a.ArticleId;
                        cmArticles.CurrentArticle = a;
                        cmArticles.ArticleOrder = i;
                        cmArticles.HomePageID = HomePageID;
                        Articles.Add(cmArticles);
                        i++;
                    }
                }
                else
                {
                    int id = 0;
                    code = Request["Code"];
                    if (string.IsNullOrEmpty(code))
                    {
                        code = Page.RouteData.Values["Id"].ToString();
                    }
                    Int32.TryParse(code, out id);
                    if (id != 0)
                    {
                        BusinessLogicLayer.Entities.ContentManagement.Article article = BusinessLogicLayer.Common.ArticleLogic.GetByID(id);
                        if (article != null)
                        {
                            author = BusinessLogicLayer.Common.PersonLogic.GetByID(article.AuthorId);
                            List<BusinessLogicLayer.Entities.ContentManagement.Article> articles = BusinessLogicLayer.Common.ArticleLogic.FindArticlesByAuthor(BusinessLogicLayer.Common.DefaultLanguageId,BusinessLogicLayer.Common.ManatiqID.ToString(),article.AuthorId.ToString());
                            var xlist = (from x in articles orderby x.PostDate descending select x).ToList();
                            int i = 0;
                            foreach (BusinessLogicLayer.Entities.ContentManagement.Article a in xlist)
                            {
                                BusinessLogicLayer.Entities.ContentManagement.ContentModuleArticle cmArticles = new BusinessLogicLayer.Entities.ContentManagement.ContentModuleArticle();
                                cmArticles.ArticleID = a.ArticleId;
                                cmArticles.CurrentArticle = a;
                                cmArticles.ArticleOrder = i;
                                cmArticles.HomePageID = HomePageID;
                                Articles.Add(cmArticles);
                                i++;
                            }
                        }
                    }
                }
                if (!author.NewRecord)
                {
                    MainImage.Src = GetWriterImagePath(author.PersonImage);
                    AuthorAlilas.InnerText = author.DisplayName;
                    BusinessLogicLayer.Entities.HumanResources.Employees emp = new BusinessLogicLayer.Components.HumanResources.EmployeesLogic().GetByID(author.BusinessEntityId);
                    if (emp != null)
                        PositionLabel.InnerText = emp.Position;

                }
                ArticlesRepeater.DataSource = Articles;
                ArticlesRepeater.DataBind();
            }
        }