public static List <Campaign> QueryLatestCampaignsForService(int amount) { try { List <Campaign> camps = new List <Campaign>(); SP.ListItemCollection coll = DAT.DataQuery.QueryListItems(CampaignModel.campaignsSiteUrl, CampaignModel.sayfalarListName, string.Format(CampaignModel.campaignsCamlQueryForService, amount * 3)); if (coll.Count > 0) { foreach (SP.ListItem item in coll) { Campaign camp = new Campaign(); string[] metaInfo = item["MetaInfo"].ToString().Split('\n'); foreach (var i in metaInfo) { if (i.Contains("vti_cachedcustomprops")) { continue; } if (i.Contains("PublishingPageContent:SW")) { camp.PublishingPageContent = HLP.TransformHtmlStringForMobile(i.Split('|')[1].Replace("\r", "")); } if (i.Contains("CampaignEndDate")) { camp.CampaignEndDate = Convert.ToDateTime(i.Split('|')[1].Replace("\r", "")); } if (i.Contains("ListImage")) { if (camp.CampaignEndDate != null && camp.CampaignEndDate >= DateTime.Now) { camp.ListImage = DAT.DataStatics.saportHostURL + HLP.TransformHtmlStringAndGetFileUrl(i.Split('|')[1].Replace("\r", "")); break; } } } if (camp.CampaignEndDate >= DateTime.Now) { if (camp.ListImage != string.Empty) { camp.ListImage = "/mobile/" + HLP.ResizeAndSaveFileToMobileFolder(HLP.GetNetworkCredential(), camp.ListImage); } camp.ID = Convert.ToInt32(item["ID"]); camp.Title = item["Title"].ToString(); camps.Add(camp); } } } return(camps.Take(amount).ToList()); } catch (Exception ex) { EXP.RedirectToErrorPage(ex.Message); return(null); } }