public string GetNewsDetail(int id, string secretKey) { try { string jsonString = string.Empty; if (secretKey != null) { byte[] data = Convert.FromBase64String(secretKey); if (DataStatics.SecretKey == System.Text.Encoding.UTF8.GetString(data)) { #region Retrieve News Detail //NewsModel.News newsDetail = NewsService.QueryNewsDetails(id); NewsModel.News news = new NewsModel.News(); Microsoft.SharePoint.Client.ListItemCollection coll = QueryListItems(NewsModel.newsSiteUrl, NewsModel.sayfalarListName, string.Format(NewsModel.newsDetailCamlQuery, id)); ListItem item = coll[0]; news.ID = id; news.Modified = Convert.ToDateTime(item["Modified"]); news.Title = item["Title"].ToString(); string[] metaInfo = item["MetaInfo"].ToString().Split('\n'); foreach (var i in metaInfo) { if (i.Contains("vti_cachedcustomprops")) { continue; } if (i.Contains("PublishingPageContent:SW")) { news.PublishingPageContent = HLP.TransformHtmlStringForMobile(i.Split('|')[1].Replace("\r", "")); } } #endregion System.Web.Script.Serialization.JavaScriptSerializer jsonSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); jsonString = jsonSerializer.Serialize(news); } } return(jsonString); } catch (Exception ex) { EXP.RedirectToErrorPage(ex.Message); return(null); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { #region Load News details int?newsId = Convert.ToInt32(Request.QueryString["NewsId"]); if (newsId.HasValue && newsId > 0) { NewsModel.News thisNews = NewsService.QueryNewsDetails((int)newsId); ltrModified.Text = Shared.Helpers.GetDateTurkishCulture(thisNews.Modified); ltrTitle.Text = thisNews.Title; ltrPageContent.Text = thisNews.PublishingPageContent; } #endregion } } catch (Exception ex) { EXP.RedirectToErrorPage(ex.Message); } }