public static List <MLNewsInfo> LocalizedNewsList(List <NewsInfo> News, string Locale, bool FromCache)
        {
            System.Collections.Generic.Dictionary <string, StringInfo> dicHeadline    = effority.Ealo.Controller.GetStringsByQualifier(NewsHeadlineQualifier, Locale, FromCache);
            System.Collections.Generic.Dictionary <string, StringInfo> dicDescription = effority.Ealo.Controller.GetStringsByQualifier(NewsDescriptionQualifier, Locale, FromCache);
            System.Collections.Generic.Dictionary <string, StringInfo> dicContent     = effority.Ealo.Controller.GetStringsByQualifier(NewsContentQualifier, Locale, FromCache);
            System.Collections.Generic.List <MLNewsInfo> neueListe = new System.Collections.Generic.List <MLNewsInfo>();
            foreach (NewsInfo info in News)
            {
                StringInfo localizedHeadline    = null;
                StringInfo localizedDescription = null;
                StringInfo localizedContent     = null;

                MLNewsInfo MLNewsInfo = new MLNewsInfo(info);
                if (dicHeadline.TryGetValue(info.ID.ToString(), out localizedHeadline))
                {
                    MLNewsInfo.MLHeadline = localizedHeadline;
                }

                if (dicDescription.TryGetValue(info.ID.ToString(), out localizedDescription))
                {
                    MLNewsInfo.MLDescription = localizedDescription;
                }

                if (dicContent.TryGetValue(info.ID.ToString(), out localizedContent))
                {
                    MLNewsInfo.MLContent = localizedContent;
                }
                neueListe.Add(MLNewsInfo);
            }
            return(neueListe);
        }
        public static System.Collections.Generic.List <MLNewsInfo> GetNewsAsListeByCat(string CatId, string Locale, bool FromCache)
        {
            System.Collections.Generic.Dictionary <string, StringInfo> dicHeadline    = effority.Ealo.Controller.GetStringsByQualifier(NewsHeadlineQualifier, Locale, FromCache);
            System.Collections.Generic.Dictionary <string, StringInfo> dicDescription = effority.Ealo.Controller.GetStringsByQualifier(NewsDescriptionQualifier, Locale, FromCache);
            System.Collections.Generic.Dictionary <string, StringInfo> dicContent     = effority.Ealo.Controller.GetStringsByQualifier(NewsContentQualifier, Locale, FromCache);

            NewsController newsController = new NewsController();

            System.Collections.Generic.Dictionary <int, NewsInfo> newsDic   = newsController.GetNewsByCat(CatId);
            System.Collections.Generic.List <MLNewsInfo>          neueListe = new System.Collections.Generic.List <MLNewsInfo>();

            foreach (NewsInfo info in newsDic.Values)
            {
                StringInfo localizedHeadline    = null;
                StringInfo localizedDescription = null;
                StringInfo localizedContent     = null;

                MLNewsInfo MLNewsInfo = new MLNewsInfo(info);

                if (dicHeadline.TryGetValue(info.ID.ToString(), out localizedHeadline))
                {
                    if (!string.IsNullOrEmpty(localizedHeadline.StringText))
                    {
                        localizedHeadline.FallBack       = MLNewsInfo.Headline;
                        localizedHeadline.FallbackIsNull = false;
                        MLNewsInfo.MLHeadline            = localizedHeadline;
                    }
                }

                if (dicDescription.TryGetValue(info.ID.ToString(), out localizedDescription))
                {
                    if (!string.IsNullOrEmpty(localizedDescription.StringText))
                    {
                        localizedDescription.FallBack       = MLNewsInfo.Description;
                        localizedDescription.FallbackIsNull = false;
                        MLNewsInfo.MLDescription            = localizedDescription;
                    }
                }

                if (dicContent.TryGetValue(info.ID.ToString(), out localizedContent))
                {
                    if (!string.IsNullOrEmpty(localizedContent.StringText))
                    {
                        localizedContent.FallBack       = MLNewsInfo.Content;
                        localizedContent.FallbackIsNull = false;
                        MLNewsInfo.MLContent            = localizedContent;
                    }
                }
                neueListe.Add(MLNewsInfo);
            }
            return(neueListe);
        }
        public static MLNewsInfo GetNews(int ID, string Locale, bool FromCache)
        {
            StringInfo     Headline    = effority.Ealo.Controller.GetStringByQualifierAndStringName(NewsHeadlineQualifier, ID.ToString(), Locale, FromCache);
            StringInfo     Description = effority.Ealo.Controller.GetStringByQualifierAndStringName(NewsDescriptionQualifier, ID.ToString(), Locale, FromCache);
            StringInfo     Content     = effority.Ealo.Controller.GetStringByQualifierAndStringName(NewsContentQualifier, ID.ToString(), Locale, FromCache);
            MLNewsInfo     fMLNewsInfo = null;
            NewsController newsCont    = new NewsController();
            NewsInfo       newsInfo    = newsCont.LoadNoML(ID);

            fMLNewsInfo = new MLNewsInfo(newsInfo);
            if (Headline != null)
            {
                if (!String.IsNullOrEmpty(Headline.StringText))
                {
                    fMLNewsInfo.MLHeadline = Headline;
                }
            }
            if (Description != null)
            {
                if (!String.IsNullOrEmpty(Description.StringText))
                {
                    fMLNewsInfo.MLDescription = Description;
                }
            }
            if (Content != null)
            {
                if (!String.IsNullOrEmpty(Content.StringText))
                {
                    fMLNewsInfo.MLContent = Content;
                }
            }
            //if (Headline != null && String.IsNullOrEmpty(Headline.StringText))
            //{
            //    Headline.StringText = newsInfo.Headline;
            //}
            //if (Description != null && String.IsNullOrEmpty(Description.StringText))
            //{
            //    Description.StringText = newsInfo.Description;
            //}
            //if (Content != null && String.IsNullOrEmpty(Content.StringText))
            //{
            //    Content.StringText = newsInfo.Content;
            //}
            //fMLNewsInfo.MLHeadline = Headline;
            //fMLNewsInfo.MLDescription = Description;
            //fMLNewsInfo.MLContent = Content;
            return(fMLNewsInfo);
        }
Example #4
0
        protected void BindNews()
        {
            if (ddlNews.SelectedValue == "" || ddlCat.SelectedValue == "")
            {
                NewsId.Value = "0";
                return;
            }
            MLNewsInfo mlNews = MLNewsController.GetNews(int.Parse(ddlNews.SelectedValue), ddlLocale.SelectedValue, false);

            lblHeadline.Text = mlNews.Headline;

            //Headline
            bool HeadlineTranslated = false;

            if (mlNews.MLHeadline != null)
            {
                HeadlineTranslated = !mlNews.MLHeadline.StringTextIsNull;
            }
            else
            {
                HeadlineTranslated = false;
            }

            if (!HeadlineTranslated)
            {
                txtHeadline.Style.Add("border-color", "Red");
                txtHeadline.ToolTip = Localization.GetString("notTranslated", this.LocalResourceFile);
                txtHeadline.Text    = "";
            }

            if (mlNews.MLHeadline != null)
            {
                txtHeadline.Style.Remove("border-color");
                txtHeadline.ToolTip = "";
                txtHeadline.Text    = mlNews.MLHeadline.StringText;
            }

            //Description
            bool DescriptionTranslated = false;

            if (mlNews.MLDescription != null)
            {
                DescriptionTranslated = !mlNews.MLDescription.StringTextIsNull;
            }
            else
            {
                DescriptionTranslated = false;
            }

            if (!DescriptionTranslated)
            {
                pnlDescription.Style.Add("border-color", "Red");
                txtDescription.Text = "";
            }

            if (mlNews.MLDescription != null)
            {
                pnlDescription.Style.Remove("border-color");
                txtDescription.Text = mlNews.MLDescription.StringText;
            }

            //Content
            bool ContentTranslated = false;

            if (mlNews.MLContent != null)
            {
                ContentTranslated = !mlNews.MLContent.StringTextIsNull;
            }
            else
            {
                ContentTranslated = false;
            }
            if (!ContentTranslated)
            {
                pnlContent.Style.Add("border-color", "Red");
                txtContent.Text = "";
            }
            if (mlNews.MLContent != null)
            {
                pnlContent.Style.Remove("border-color");
                txtContent.Text = mlNews.MLContent.StringText;
            }
            NewsId.Value = mlNews.ID.ToString();
        }