Advertisement
Guest User

Untitled

a guest
Oct 15th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 2.62 KB | None | 0 0
  1.  public Content GetContentDetails(SPWeb contentWeb, String lang, String ID)
  2.     {
  3.  
  4.             Content Content = new Model.Content();
  5.             SPListItem ContentItem = null;
  6.             try
  7.             {
  8.                 SPListItemCollection collListItems = SPListData.getSPItemsByValue(contentWeb, "Content", "ID", ID, "Text");
  9.  
  10.                 if (collListItems != null)
  11.                 {
  12.                     if (collListItems[0] != null)
  13.                     {
  14.                         ContentItem = collListItems[0];
  15.                     }
  16.                 }
  17.                 Content.ID = ContentItem["ID"] != null ? ContentItem["ID"].ToString() : "";
  18.                 Content.ContentKey = ContentItem["ContentKey"] != null ? ContentItem["ContentKey"].ToString() : "";
  19.                 Content.HasVideo = ContentItem["HasVideo"] != null ? ContentItem["HasVideo"].ToString() : "";
  20.                 Content.Like = ContentItem["Like"] != null ?  Convert.ToInt32(ContentItem["Like"].ToString()): 0;
  21.                 Content.DisLike = ContentItem["Dislike"] != null ? Convert.ToInt32(ContentItem["Dislike"].ToString()) : 0;
  22.                            
  23.                 if (lang=="ar")
  24.                 {
  25.                     Content.SubjectAR = ContentItem["SubjectAR"] != null ? ContentItem["SubjectAR"].ToString() : "";
  26.                     Content.BodyAR = ContentItem["BodyAR"] != null ? Common.Common.StripHTML(getStringValue(ContentItem["BodyAR"])) : "";
  27.                     Content.MediaLinkAR = ContentItem["MediaLinkAR"] != null ? ContentItem["MediaLinkAR"].ToString() : "";
  28.                     Content.CoverLinkAR = ContentItem["CoverLinkAR"] != null ? ContentItem["CoverLinkAR"].ToString() : "";
  29.  
  30.                 }
  31.  
  32.                 else
  33.                
  34.                 {
  35.  
  36.                 Content.SubjectEN = ContentItem["SubjectEN"] != null ? ContentItem["SubjectEN"].ToString() : "";
  37.                 Content.BodyEN = ContentItem["BodyEN"] != null ? Common.Common.StripHTML(getStringValue(ContentItem["BodyEN"])) : "";
  38.                 Content.MediaLinkEN = ContentItem["MediaLinkEN"] != null ? ContentItem["MediaLinkEN"].ToString() : "";
  39.                 Content.MediaType = ContentItem["MediaType"] != null ? ContentItem["MediaType"].ToString() : "";
  40.                 Content.CoverLinkEN = ContentItem["CoverLinkEN"] != null ? ContentItem["CoverLinkEN"].ToString() : "";
  41.                 }
  42.                
  43.    
  44.             }
  45.             catch (Exception exception)
  46.             {
  47.                 Common.Common.HandlExeptions(exception, (new StackTrace()).GetFrame(0).GetMethod().Name);
  48.             }
  49.  
  50.             return Content;
  51.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement