/// <summary> /// Builds a <see cref="QueryResultDisplay"/> /// </summary> /// <param name="results"> /// The results. /// </param> /// <param name="currentPage"> /// The current page. /// </param> /// <param name="itemsPerPage"> /// The items per page. /// </param> /// <returns> /// The <see cref="QueryResultDisplay"/>. /// </returns> public QueryResultDisplay BuildQueryResult(ISearchResults results, long currentPage, long itemsPerPage) { return(new QueryResultDisplay() { Items = results.Select(_map).Skip((int)((currentPage - 1) * itemsPerPage)).Take((int)itemsPerPage), CurrentPage = currentPage, ItemsPerPage = itemsPerPage, TotalPages = ((results.Count() - 1) / itemsPerPage) + 1, TotalItems = results.Count() }); }
public void Can_Add_A_New_Product_To_The_Index() { PreTestDataWorker.DeleteAllProducts(); //// Arrange var provider = (ProductIndexer)ExamineManager.Instance.IndexProviderCollection["MerchelloProductIndexer"]; provider.RebuildIndex(); var searcher = ExamineManager.Instance.SearchProviderCollection["MerchelloProductSearcher"]; var productVariantService = PreTestDataWorker.ProductVariantService; //// Act var product = MockProductDataMaker.MockProductCollectionForInserting(1).First(); product.ProductOptions.Add(new ProductOption("Color")); product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Blue", "Blue")); product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Red", "Red")); product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Green", "Green")); product.ProductOptions.Add(new ProductOption("Size")); product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Small", "Sm")); product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Medium", "Med")); product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Large", "Lg")); product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("X-Large", "XL")); product.Height = 11M; product.Width = 11M; product.Length = 11M; product.CostOfGoods = 15M; product.OnSale = true; product.SalePrice = 18M; _productService.Save(product); var attributes = new ProductAttributeCollection() { product.ProductOptions.First(x => x.Name == "Color").Choices.First(x => x.Sku == "Blue"), product.ProductOptions.First(x => x.Name == "Size").Choices.First(x => x.Sku == "XL") }; productVariantService.CreateProductVariantWithKey(product, attributes); provider.AddProductToIndex(product); //// Assert var criteria = searcher.CreateSearchCriteria("productvariant", BooleanOperation.And); criteria.Field("productKey", product.Key.ToString()).And().Field("master", "true"); ISearchResults results = searcher.Search(criteria); Assert.IsTrue(results.Count() == 1); var result = results.First(); Assert.NotNull(result.Fields["productOptions"]); provider.RebuildIndex(); }
private int CountPendingUsers() { bool hasloggedin = (System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated; var userService = Services.MemberService; string usern = string.Empty; usern = System.Web.HttpContext.Current.User.Identity.Name; //UmbracoShipTac.Code.UiEnum.RolesId.shipcounselor var amember = userService.GetByEmail(usern); //get the rolid of the user.. from the isinrole string strRoleAssigned = amember.GetValue("roleAssigned").ToString(); string state = string.Empty; state = amember.GetValue("state").ToString(); // Use the already configured member searcher var memberSearcher = ExamineManager.Instance .SearchProviderCollection["InternalMemberSearcher"] .CreateSearchCriteria(BooleanOperation.Or); Examine.SearchCriteria.IBooleanOperation filter = null; filter = memberSearcher.Field("hasVerifiedEmail", "0"); //just to start a dummy this is OR ? I think It is AND filter = filter.And().Field("umbracoMemberApproved", "0"); if (state.ToUpper() != "ALL") { filter = filter.And().Field("state", state); } filter = filter.And().Range("roleAppliedFor", "1", strRoleAssigned, true, true); filter = filter.And().Field("isDenied", "0"); ISearchResults resultsAllMembers = ExamineManager.Instance .SearchProviderCollection["InternalMemberSearcher"] .Search(filter.Compile()); int pendingusers = resultsAllMembers.Count(); //do not include the loggedin user.. // if (id != amember.Id.ToString()) return(pendingusers); }
public static LatestUpdateList ObtainAllMessages(int pageNo = 1) { //Instantiate variables var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); LatestUpdateList lstLatestUpdates = new LatestUpdateList(); //try //{ //Get all ... BaseSearchProvider mySearcher = ExamineManager.Instance.SearchProviderCollection[Common.searchProviders.MessagesSearcher]; ISearchCriteria criteria = mySearcher.CreateSearchCriteria(IndexTypes.Content); IBooleanOperation query = criteria.Field(Common.NodeProperties.indexType, Common.NodeProperties.content); //gets all items query.And().OrderByDescending(Common.NodeProperties.publishDate); query.And().OrderBy(Common.NodeProperties.nodeName); query.And().OrderBy(Common.miscellaneous.Path); ISearchResults isResults = mySearcher.Search(query.Compile()); if (isResults.Any()) { //Instantiate variables DateTime msgDate = new DateTime(1900, 1, 1); DateTime prevDate = new DateTime(1900, 1, 1); latestUpdates latestUpdate = new latestUpdates(); visionary visionary = new visionary(); message message; IPublishedContent ipMsg; IPublishedContent ipVisionary; //Get item counts and total experiences. lstLatestUpdates.Pagination.itemsPerPage = 20; lstLatestUpdates.Pagination.totalItems = isResults.Count(); //Determine how many pages/items to skip and take, as well as the total page count for the search result. if (lstLatestUpdates.Pagination.totalItems > lstLatestUpdates.Pagination.itemsPerPage) { lstLatestUpdates.Pagination.totalPages = (int)Math.Ceiling((double)lstLatestUpdates.Pagination.totalItems / (double)lstLatestUpdates.Pagination.itemsPerPage); } else { lstLatestUpdates.Pagination.itemsPerPage = lstLatestUpdates.Pagination.totalItems; lstLatestUpdates.Pagination.totalPages = 1; } //Determine current page number if (pageNo <= 0 || pageNo > lstLatestUpdates.Pagination.totalPages) { pageNo = 1; } lstLatestUpdates.Pagination.pageNo = pageNo; //Determine how many pages/items to skip if (lstLatestUpdates.Pagination.totalItems > lstLatestUpdates.Pagination.itemsPerPage) { lstLatestUpdates.Pagination.itemsToSkip = lstLatestUpdates.Pagination.itemsPerPage * (pageNo - 1); } //Get top 'n' results and determine link structure //foreach (SearchResult srResult in isResults.Take(30)) foreach (SearchResult srResult in isResults.Skip(lstLatestUpdates.Pagination.itemsToSkip).Take(lstLatestUpdates.Pagination.itemsPerPage)) { //Obtain message's node ipMsg = umbracoHelper.TypedContent(Convert.ToInt32(srResult.Id)); if (ipMsg != null) { //Obtain date of message msgDate = ipMsg.GetPropertyValue <DateTime>(Common.NodeProperties.publishDate); //Create a new date for messages if (msgDate != prevDate) { //Update current date prevDate = msgDate; //Create new instances for updates and add to list of all updates. latestUpdate = new latestUpdates(); latestUpdate.datePublished = msgDate; lstLatestUpdates.LstLatestUpdates.Add(latestUpdate); //Reset the visionary class on every new date change. visionary = new visionary(); } //Obtain current visionary or webmaster if (ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.Visionary) != null) { if (visionary.id != ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.Visionary).Id) { //Obtain visionary node ipVisionary = ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.Visionary); //Create new visionary class and add to latest update class visionary = new visionary(); visionary.id = ipVisionary.Id; visionary.name = ipVisionary.Name; visionary.url = ipVisionary.Url; latestUpdate.lstVisionaries.Add(visionary); } } else if (ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.WebmasterMessageList) != null) { if (visionary.id != ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.WebmasterMessageList).Id) { //Obtain visionary node ipVisionary = ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.WebmasterMessageList); //Create new visionary class and add to latest update class visionary = new visionary(); visionary.id = ipVisionary.Id; visionary.name = ipVisionary.Name; visionary.url = ipVisionary.Url; latestUpdate.lstVisionaries.Add(visionary); } } //Create new message and add to existing visionary class. message = new message(); message.id = ipMsg.Id; message.title = ipMsg.Name; message.url = ipMsg.Url; visionary.lstMessages.Add(message); } } } //} //catch (Exception ex) //{ // //StringBuilder sb = new StringBuilder(); // //sb.AppendLine(@"MessageController.cs : RenderLatestMessages()"); // //sb.AppendLine("model:" + Newtonsoft.Json.JsonConvert.SerializeObject(lstLatestUpdates)); // //Common.SaveErrorMessage(ex, sb, typeof(MessageController)); // //ModelState.AddModelError("", "*An error occured while creating the latest message list."); // //return CurrentUmbracoPage(); //} //Return data to partialview return(lstLatestUpdates); }
//public ActionResult RenderMsgs_byVisionary(IPublishedContent ipVisionary) //{ // //Instantiate variables // MsgList msgList = new MsgList(); // var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); // try // { // msgList.VisionaryName = "working"; // //Get all prayers // BaseSearchProvider mySearcher = ExamineManager.Instance.SearchProviderCollection[Common.searchProviders.MessagesSearcher]; // ISearchCriteria criteria = mySearcher.CreateSearchCriteria(IndexTypes.Content); // IBooleanOperation query = criteria.Field(Common.NodeProperties.indexType, Common.NodeProperties.content); //gets all items when this exists for every record. // query.And().OrderByDescending(Common.NodeProperties.publishDate); // query.And().OrderBy(Common.NodeProperties.nodeName); // query.And().Field(Common.miscellaneous.Path, ipVisionary.Path.MultipleCharacterWildcard()); // ISearchResults isResults = mySearcher.Search(query.Compile()); // //Get item counts and total experiences. // msgList.Pagination.itemsPerPage = 30; // msgList.Pagination.totalItems = isResults.Count(); // //Determine how many pages/items to skip and take, as well as the total page count for the search result. // if (msgList.Pagination.totalItems > msgList.Pagination.itemsPerPage) // { // msgList.Pagination.totalPages = (int)Math.Ceiling((double)msgList.Pagination.totalItems / (double)msgList.Pagination.itemsPerPage); // } // else // { // msgList.Pagination.itemsPerPage = msgList.Pagination.totalItems; // msgList.Pagination.totalPages = 1; // } // //Determine current page number // var pageNo = 1; // if (!string.IsNullOrEmpty(Request.QueryString[Common.miscellaneous.PageNo])) // { // int.TryParse(Request.QueryString[Common.miscellaneous.PageNo], out pageNo); // if (pageNo <= 0 || pageNo > msgList.Pagination.totalPages) // { // pageNo = 1; // } // } // msgList.Pagination.pageNo = pageNo; // //Determine how many pages/items to skip // if (msgList.Pagination.totalItems > msgList.Pagination.itemsPerPage) // { // msgList.Pagination.itemsToSkip = msgList.Pagination.itemsPerPage * (pageNo - 1); // } // //Convert list of SearchResults to list of classes // foreach (SearchResult sRecord in isResults.Skip(msgList.Pagination.itemsToSkip).Take(msgList.Pagination.itemsPerPage)) // { // var msgLink = new Models.MsgLink(); // msgLink.Id = sRecord.Id; // msgLink.Title = sRecord.Fields[Common.NodeProperties.nodeName]; // msgLink.Subtitle = sRecord.Fields[Common.NodeProperties.subtitle]; // msgLink.Url = Umbraco.NiceUrl(sRecord.Id); // //msgLink.Date = Convert.ToDateTime(sRecord.Fields[Common.NodeProperties.publishDate]); // //Obtain list of all dates // var ipMsg = Umbraco.TypedContent(sRecord.Id); // List<DateTime> lstDateRange = ipMsg.GetPropertyValue<List<DateTime>>(Common.NodeProperties.dateOfMessages); // //Determine proper date range for messages // if (lstDateRange != null && lstDateRange.Count > 0) // { // if (lstDateRange.Count == 1) // { // msgLink.Dates = lstDateRange.First().ToString("MMM d"); // } // else // { // StringBuilder sbDateRange = new StringBuilder(); // sbDateRange.Append(lstDateRange.First().ToString("MMM d")); // sbDateRange.Append(" — "); // sbDateRange.Append(lstDateRange.Last().ToString("MMM d")); // msgLink.Dates = sbDateRange.ToString(); // } // } // else // { // msgLink.Dates = Convert.ToDateTime(sRecord.Fields[Common.NodeProperties.publishDate]).ToString("MMM d"); // } // msgList.lstMsgLinks.Add(msgLink); // } // } // catch (Exception ex) // { // StringBuilder sb = new StringBuilder(); // sb.AppendLine(@"MessageController.cs : RenderMsgs_byVisionary()"); // //sb.AppendLine("ipVisionary:" + Newtonsoft.Json.JsonConvert.SerializeObject(ipVisionary)); // sb.AppendLine("msgList:" + Newtonsoft.Json.JsonConvert.SerializeObject(msgList)); // Common.SaveErrorMessage(ex, sb, typeof(MessageController)); // ModelState.AddModelError("", "*An error occured while retrieving messages by visionary."); // } // //Return data to partialview // return PartialView("~/Views/Partials/MessagesFromHeaven/_msgList.cshtml", msgList); //} public ActionResult RenderMsgs_byVisionary(IPublishedContent ipVisionary) { //Instantiate variables MsgList msgList = new MsgList(); var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); try { msgList.VisionaryName = "working"; //Get all prayers BaseSearchProvider mySearcher = ExamineManager.Instance.SearchProviderCollection[Common.searchProviders.MessagesSearcher]; ISearchCriteria criteria = mySearcher.CreateSearchCriteria(IndexTypes.Content); IBooleanOperation query = criteria.Field(Common.NodeProperties.indexType, Common.NodeProperties.content); //gets all items when this exists for every record. query.And().OrderByDescending(Common.NodeProperties.publishDate); query.And().OrderBy(Common.NodeProperties.nodeName); query.And().Field(Common.miscellaneous.Path, ipVisionary.Path.MultipleCharacterWildcard()); ISearchResults isResults = mySearcher.Search(query.Compile()); //Get item counts and total experiences. msgList.Pagination.itemsPerPage = 30; msgList.Pagination.totalItems = isResults.Count(); //Determine how many pages/items to skip and take, as well as the total page count for the search result. if (msgList.Pagination.totalItems > msgList.Pagination.itemsPerPage) { msgList.Pagination.totalPages = (int)Math.Ceiling((double)msgList.Pagination.totalItems / (double)msgList.Pagination.itemsPerPage); } else { msgList.Pagination.itemsPerPage = msgList.Pagination.totalItems; msgList.Pagination.totalPages = 1; } //Determine current page number var pageNo = 1; if (!string.IsNullOrEmpty(Request.QueryString[Common.miscellaneous.PageNo])) { int.TryParse(Request.QueryString[Common.miscellaneous.PageNo], out pageNo); if (pageNo <= 0 || pageNo > msgList.Pagination.totalPages) { pageNo = 1; } } msgList.Pagination.pageNo = pageNo; //Determine how many pages/items to skip if (msgList.Pagination.totalItems > msgList.Pagination.itemsPerPage) { msgList.Pagination.itemsToSkip = msgList.Pagination.itemsPerPage * (pageNo - 1); } //Convert list of SearchResults to list of classes foreach (SearchResult sRecord in isResults) //.Skip(msgList.Pagination.itemsToSkip).Take(msgList.Pagination.itemsPerPage)) { var msgLink = new Models.MsgLink(); msgLink.Id = sRecord.Id; msgLink.Title = sRecord.Fields[Common.NodeProperties.nodeName]; msgLink.Subtitle = sRecord.Fields[Common.NodeProperties.subtitle]; msgLink.Url = Umbraco.NiceUrl(sRecord.Id); /* msgLink.Date = */ Convert.ToDateTime(sRecord.Fields[Common.NodeProperties.publishDate]); //Obtain list of all dates var ipMsg = Umbraco.TypedContent(sRecord.Id); List <DateTime> lstDateRange = ipMsg.GetPropertyValue <List <DateTime> >(Common.NodeProperties.dateOfMessages); //Determine proper date range for messages if (lstDateRange != null && lstDateRange.Count > 0) { if (lstDateRange.Count == 1) { msgLink.Dates = lstDateRange.First().ToString("MMM d"); } else { StringBuilder sbDateRange = new StringBuilder(); sbDateRange.Append(lstDateRange.First().ToString("MMM d")); sbDateRange.Append(" — "); sbDateRange.Append(lstDateRange.Last().ToString("MMM d")); msgLink.Dates = sbDateRange.ToString(); } msgLink.Date = lstDateRange.First(); //Used for resorting list before displaying } else { msgLink.Dates = Convert.ToDateTime(sRecord.Fields[Common.NodeProperties.publishDate]).ToString("MMM d"); msgLink.Date = Convert.ToDateTime(sRecord.Fields[Common.NodeProperties.publishDate]); //Used for resorting list before displaying } msgList.lstMsgLinks.Add(msgLink); } //Reorder messages by date and obtain only what is to be displayed. msgList.lstMsgLinks = msgList.lstMsgLinks.OrderByDescending(x => x.Date).Skip(msgList.Pagination.itemsToSkip).Take(msgList.Pagination.itemsPerPage).ToList(); } catch (Exception ex) { StringBuilder sb = new StringBuilder(); sb.AppendLine(@"MessageController.cs : RenderMsgs_byVisionary()"); //sb.AppendLine("ipVisionary:" + Newtonsoft.Json.JsonConvert.SerializeObject(ipVisionary)); sb.AppendLine("msgList:" + Newtonsoft.Json.JsonConvert.SerializeObject(msgList)); Common.SaveErrorMessage(ex, sb, typeof(MessageController)); ModelState.AddModelError("", "*An error occured while retrieving messages by visionary."); } //Return data to partialview return(PartialView("~/Views/Partials/MessagesFromHeaven/_msgList.cshtml", msgList)); }
public ActionResult RenderAllMessages() { //Instantiate variables MsgList msgList = new MsgList(); var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); try { //Get all prayers BaseSearchProvider mySearcher = ExamineManager.Instance.SearchProviderCollection[Common.searchProviders.MessagesSearcher]; ISearchCriteria criteria = mySearcher.CreateSearchCriteria(IndexTypes.Content); IBooleanOperation query = criteria.Field(Common.NodeProperties.indexType, Common.NodeProperties.content); //gets all items query.And().OrderByDescending(Common.NodeProperties.publishDate); query.And().OrderBy(Common.NodeProperties.nodeName); ISearchResults isResults = mySearcher.Search(query.Compile()); //Get item counts and total experiences. msgList.Pagination.itemsPerPage = 20; msgList.Pagination.totalItems = isResults.Count(); //Determine how many pages/items to skip and take, as well as the total page count for the search result. if (msgList.Pagination.totalItems > msgList.Pagination.itemsPerPage) { msgList.Pagination.totalPages = (int)Math.Ceiling((double)msgList.Pagination.totalItems / (double)msgList.Pagination.itemsPerPage); } else { msgList.Pagination.itemsPerPage = msgList.Pagination.totalItems; msgList.Pagination.totalPages = 1; } //Determine current page number var pageNo = 1; if (!string.IsNullOrEmpty(Request.QueryString[Common.miscellaneous.PageNo])) { int.TryParse(Request.QueryString[Common.miscellaneous.PageNo], out pageNo); if (pageNo <= 0 || pageNo > msgList.Pagination.totalPages) { pageNo = 1; } } msgList.Pagination.pageNo = pageNo; //Determine how many pages/items to skip if (msgList.Pagination.totalItems > msgList.Pagination.itemsPerPage) { msgList.Pagination.itemsToSkip = msgList.Pagination.itemsPerPage * (pageNo - 1); } //Convert list of SearchResults to list of classes foreach (SearchResult sRecord in isResults.Skip(msgList.Pagination.itemsToSkip).Take(msgList.Pagination.itemsPerPage)) { var msgLink = new Models.MsgLink(); msgLink.Id = sRecord.Id; msgLink.Title = sRecord.Fields[Common.NodeProperties.nodeName]; msgLink.Subtitle = sRecord.Fields[Common.NodeProperties.subtitle]; msgLink.Url = Umbraco.NiceUrl(sRecord.Id); //msgLink.Date = Convert.ToDateTime(sRecord.Fields[Common.NodeProperties.publishDate]); msgLink.Dates = (Convert.ToDateTime(sRecord.Fields[Common.NodeProperties.publishDate])).ToString("MMMM dd"); msgList.lstMsgLinks.Add(msgLink); } } catch (Exception ex) { StringBuilder sb = new StringBuilder(); sb.AppendLine(@"MessageController.cs : RenderAllMessages()"); sb.AppendLine("model:" + Newtonsoft.Json.JsonConvert.SerializeObject(msgList)); Common.SaveErrorMessage(ex, sb, typeof(MessageController)); ModelState.AddModelError("", "*An error occured while retrieving all messages."); return(CurrentUmbracoPage()); } //Return data to partialview return(PartialView("~/Views/Partials/MessagesFromHeaven/_msgList.cshtml", msgList)); }
public ActionResult RenderList() { //Instantiate variables var prayerList = new Models.PrayerList(); try { // var memberShipHelper = new Umbraco.Web.Security.MembershipHelper(UmbracoContext.Current); var CmPrayerList = new ContentModels.PrayerList(Umbraco.TypedContent((int)Common.siteNode.ThePrayerCorner)); //Get all prayers BaseSearchProvider mySearcher = ExamineManager.Instance.SearchProviderCollection[Common.searchProviders.PrayersSearcher]; ISearchCriteria criteria = mySearcher.CreateSearchCriteria(IndexTypes.Content); IBooleanOperation query = criteria.Field(Common.NodeProperties.indexType, Common.NodeProperties.content); //gets all items query.And().OrderByDescending(Common.NodeProperties.requestDate); query.And().OrderBy(Common.NodeProperties.prayerTitle); ISearchResults isResults = mySearcher.Search(query.Compile()); //Get item counts and total experiences. prayerList.Pagination.itemsPerPage = 10; prayerList.Pagination.totalItems = isResults.Count(); //Determine how many pages/items to skip and take, as well as the total page count for the search result. if (prayerList.Pagination.totalItems > prayerList.Pagination.itemsPerPage) { prayerList.Pagination.totalPages = (int)Math.Ceiling((double)prayerList.Pagination.totalItems / (double)prayerList.Pagination.itemsPerPage); } else { prayerList.Pagination.itemsPerPage = prayerList.Pagination.totalItems; prayerList.Pagination.totalPages = 1; } //Determine current page number var pageNo = 1; if (!string.IsNullOrEmpty(Request.QueryString[Common.miscellaneous.PageNo])) { int.TryParse(Request.QueryString[Common.miscellaneous.PageNo], out pageNo); if (pageNo <= 0 || pageNo > prayerList.Pagination.totalPages) { pageNo = 1; } } prayerList.Pagination.pageNo = pageNo; //Determine how many pages/items to skip if (prayerList.Pagination.totalItems > prayerList.Pagination.itemsPerPage) { prayerList.Pagination.itemsToSkip = prayerList.Pagination.itemsPerPage * (pageNo - 1); } //Convert list of SearchResults to list of classes foreach (SearchResult sRecord in isResults.Skip(prayerList.Pagination.itemsToSkip).Take(prayerList.Pagination.itemsPerPage)) { //Create new prayerLink class var prayerLink = new Models.PrayerLink(); prayerLink.Id = sRecord.Id; prayerLink.Title = sRecord.Fields[Common.NodeProperties.prayerTitle]; prayerLink.Url = Umbraco.NiceUrl(sRecord.Id); prayerLink.Date = Convert.ToDateTime(sRecord.Fields[Common.NodeProperties.requestDate]); //Determine current percentage prayerLink.currentPercentage = int.Parse(sRecord.Fields[Common.NodeProperties.currentPercentage]); prayerLink.baseCalculationDate = DateTime.Parse(sRecord.Fields[Common.NodeProperties.baseCalculationDate]); int daysSinceBaseDate = (DateTime.Now - prayerLink.baseCalculationDate).Days; if (daysSinceBaseDate > prayerLink.currentPercentage) { prayerLink.currentPercentage = 0; } else { prayerLink.currentPercentage = prayerLink.currentPercentage - daysSinceBaseDate; } //Determine proper candle based upon current percentage prayerLink.CandleUrl = CmPrayerList.CandleOut.Url; if (prayerLink.currentPercentage == 0) { prayerLink.CandleUrl = CmPrayerList.CandleOut.Url; } else if (prayerLink.currentPercentage >= 1 && prayerLink.currentPercentage <= 10) { prayerLink.CandleUrl = CmPrayerList.Candle10.Url; } else if (prayerLink.currentPercentage >= 11 && prayerLink.currentPercentage <= 20) { prayerLink.CandleUrl = CmPrayerList.Candle20.Url; } else if (prayerLink.currentPercentage >= 21 && prayerLink.currentPercentage <= 30) { prayerLink.CandleUrl = CmPrayerList.Candle30.Url; } else if (prayerLink.currentPercentage >= 31 && prayerLink.currentPercentage <= 40) { prayerLink.CandleUrl = CmPrayerList.Candle40.Url; } else if (prayerLink.currentPercentage >= 41 && prayerLink.currentPercentage <= 50) { prayerLink.CandleUrl = CmPrayerList.Candle50.Url; } else if (prayerLink.currentPercentage >= 51 && prayerLink.currentPercentage <= 60) { prayerLink.CandleUrl = CmPrayerList.Candle60.Url; } else if (prayerLink.currentPercentage >= 61 && prayerLink.currentPercentage <= 70) { prayerLink.CandleUrl = CmPrayerList.Candle70.Url; } else if (prayerLink.currentPercentage >= 71 && prayerLink.currentPercentage <= 80) { prayerLink.CandleUrl = CmPrayerList.Candle80.Url; } else if (prayerLink.currentPercentage >= 81 && prayerLink.currentPercentage <= 90) { prayerLink.CandleUrl = CmPrayerList.Candle90.Url; } else if (prayerLink.currentPercentage >= 91 && prayerLink.currentPercentage <= 100) { prayerLink.CandleUrl = CmPrayerList.Candle100.Url; } // IEnumerable <string> prayerSummary = sRecord.Fields[Common.NodeProperties.prayer].Split().Take(32); prayerLink.PrayerSummary = string.Join(" ", prayerSummary) + "..."; //Obtain member ContentModels.Member CmMember; int memberId; if (int.TryParse(sRecord.Fields[Common.NodeProperties.prayerRequestMember], out memberId)) { IPublishedContent ipMember = memberShipHelper.GetById(memberId); CmMember = new ContentModels.Member(ipMember); } else { CmMember = new ContentModels.Member(Udi.Parse(sRecord.Fields[Common.NodeProperties.prayerRequestMember]).ToPublishedContent()); } StringBuilder sbAuthor = new StringBuilder(); sbAuthor.Append(CmMember.FirstName); sbAuthor.Append(" "); sbAuthor.Append(CmMember.LastName); sbAuthor.Append("."); prayerLink.MemberName = sbAuthor.ToString(); // prayerList.lstPrayerLinks.Add(prayerLink); } } catch (Exception ex) { StringBuilder sb = new StringBuilder(); sb.AppendLine(@"PrayerController.cs : RenderList()"); sb.AppendLine("model:" + Newtonsoft.Json.JsonConvert.SerializeObject(prayerList)); Common.SaveErrorMessage(ex, sb, typeof(PrayerController)); ModelState.AddModelError("", "*An error occured while creating the prayer list."); return(CurrentUmbracoPage()); } //Return data to partialview return(PartialView("~/Views/Partials/PrayerCorner/_prayerList.cshtml", prayerList)); }
/// <summary> /// Test multi reader over an export stream. /// </summary> /// <typeparam name="T">Type of matching single reader</typeparam> /// <param name="multiReader">A multi reader</param> /// <param name="expectedCountResultSet"> /// Expected count of result set in the steam /// </param> private void TestExportMultiReader <T>( MultiResultsReader <T> multiReader, int expectedCountResultSet) where T : ResultsReader, System.IDisposable { using (multiReader) { ISearchResults firstResults = null; int indexResultSet = 0; foreach (var results in multiReader) { if (firstResults == null) { firstResults = results; } if (indexResultSet == expectedCountResultSet - 1) { Assert.IsFalse(results.IsPreview); } var indexEvent = 0; foreach (var ret in results) { if (indexResultSet == 1 && indexEvent == 1) { Assert.AreEqual("andy-pc", ret["host"]); Assert.AreEqual("3", ret["count"]); } if (indexResultSet == expectedCountResultSet - 2 && indexEvent == 3) { Assert.AreEqual("andy-pc", ret["host"]); Assert.AreEqual("135", ret["count"]); } indexEvent++; } switch (indexResultSet) { case 0: Assert.AreEqual(indexEvent, 1); break; case 1: Assert.AreEqual(indexEvent, 3); break; default: Assert.AreEqual(indexEvent, 5); break; } indexResultSet++; } Assert.AreEqual(indexResultSet, expectedCountResultSet); // firstResults should be empty since the multi-reader has passed it // and there should be no exception. Assert.AreEqual(0, firstResults.Count()); } }
//Search by private void ObtainByIlluminationStories(Models.SearchList searchList, int pageNo) { //Instantiate variables var memberShipHelper = new Umbraco.Web.Security.MembershipHelper(UmbracoContext.Current); searchList.ShowIlluminationStories = true; searchList.SearchInTitle = "Illumination Stories"; if (!string.IsNullOrWhiteSpace(searchList.SearchFor)) { //Set up search criteria BaseSearchProvider mySearcher = ExamineManager.Instance.SearchProviderCollection[Common.searchProviders.IlluminationStoriesSearcher]; ISearchCriteria criteria = mySearcher.CreateSearchCriteria(BooleanOperation.Or); //Setup up search fields by importance IBooleanOperation query = criteria.Field(Common.NodeProperties.title, searchList.SearchFor.MultipleCharacterWildcard()); query.Or().Field(Common.NodeProperties.story, searchList.SearchFor.MultipleCharacterWildcard()); query.Or().Field(Common.NodeProperties.experienceType, searchList.SearchFor.MultipleCharacterWildcard()); query.Or().Field(Common.NodeProperties.member, searchList.SearchFor.MultipleCharacterWildcard()); //IBooleanOperation query = criteria.Field(Common.NodeProperties.title, searchList.SearchFor.Boost(2)); //query.Or().Field(Common.NodeProperties.story, searchList.SearchFor.Boost(1)); //query.Or().Field(Common.NodeProperties.experienceType, searchList.SearchFor); //query.Or().Field(Common.NodeProperties.member, searchList.SearchFor); //Obtain result with query ISearchResults searchResults = mySearcher.Search(query.Compile()); //Get item counts and total experiences. searchList.Pagination.totalItems = searchResults.Count(); //Determine how many pages/items to skip and take, as well as the total page count for the search result. if (searchList.Pagination.totalItems > searchList.Pagination.itemsPerPage) { searchList.Pagination.totalPages = (int)Math.Ceiling((double)searchList.Pagination.totalItems / (double)searchList.Pagination.itemsPerPage); } else { searchList.Pagination.itemsPerPage = searchList.Pagination.totalItems; searchList.Pagination.totalPages = 1; } //Determine current page number if (pageNo <= 0 || pageNo > searchList.Pagination.totalPages) { pageNo = 1; } searchList.Pagination.pageNo = pageNo; //Determine how many pages/items to skip if (searchList.Pagination.totalItems > searchList.Pagination.itemsPerPage) { searchList.Pagination.itemsToSkip = searchList.Pagination.itemsPerPage * (pageNo - 1); } //Convert list of SearchResults to list of classes foreach (SearchResult sRecord in searchResults.Skip(searchList.Pagination.itemsToSkip).Take(searchList.Pagination.itemsPerPage)) { var storyLink = new Models.illuminationStoryLink(); storyLink.experienceType = sRecord.Fields[Common.NodeProperties.experienceType]; storyLink.id = sRecord.Id; storyLink.title = sRecord.Fields[Common.NodeProperties.title]; storyLink.url = Umbraco.NiceUrl(sRecord.Id); //Obtain member ContentModels.Member CmMember; int memberId; if (int.TryParse(sRecord.Fields[Common.NodeProperties.member], out memberId)) { IPublishedContent ipMember = memberShipHelper.GetById(memberId); CmMember = new ContentModels.Member(ipMember); } else { CmMember = new ContentModels.Member(Udi.Parse(sRecord.Fields[Common.NodeProperties.member]).ToPublishedContent()); } //var CmMember = new ContentModels.Member(Udi.Parse(sRecord.Fields[Common.NodeProperties.member]).ToPublishedContent()); StringBuilder sbAuthor = new StringBuilder(); sbAuthor.Append(CmMember.FirstName); sbAuthor.Append(" "); sbAuthor.Append(CmMember.LastName); sbAuthor.Append("."); storyLink.memberName = sbAuthor.ToString(); storyLink.memberId = CmMember.Id; searchList.lstStoryLink.Add(storyLink); } } }
private void ObtainByScripture(Models.SearchList searchList, int pageNo) { //Instantiate variables var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); searchList.ShowBible = true; searchList.SearchInTitle = "The Scriptures"; if (!string.IsNullOrWhiteSpace(searchList.SearchFor)) { //Get all prayers BaseSearchProvider mySearcher = ExamineManager.Instance.SearchProviderCollection[Common.searchProviders.ScriptureSearcher]; ISearchCriteria criteria = mySearcher.CreateSearchCriteria(IndexTypes.Content); ISearchResults searchResults = mySearcher.Search(searchList.SearchFor, true); //Get item counts and total experiences. searchList.Pagination.itemsPerPage = 30; searchList.Pagination.totalItems = searchResults.Count(); //Determine how many pages/items to skip and take, as well as the total page count for the search result. if (searchList.Pagination.totalItems > searchList.Pagination.itemsPerPage) { searchList.Pagination.totalPages = (int)Math.Ceiling((double)searchList.Pagination.totalItems / (double)searchList.Pagination.itemsPerPage); } else { searchList.Pagination.itemsPerPage = searchList.Pagination.totalItems; searchList.Pagination.totalPages = 1; } //Determine current page number if (pageNo <= 0 || pageNo > searchList.Pagination.totalPages) { pageNo = 1; } searchList.Pagination.pageNo = pageNo; //Determine how many pages/items to skip if (searchList.Pagination.totalItems > searchList.Pagination.itemsPerPage) { searchList.Pagination.itemsToSkip = searchList.Pagination.itemsPerPage * (pageNo - 1); } //Convert list of SearchResults to list of classes foreach (SearchResult sRecord in searchResults.Skip(searchList.Pagination.itemsToSkip).Take(searchList.Pagination.itemsPerPage)) { var scriptureLink = new Models.ScriptureLink(); IPublishedContent ipArticle = umbracoHelper.TypedContent(sRecord.Id); scriptureLink.Id = ipArticle.Id; scriptureLink.Url = ipArticle.Parent.Url + "?chapter=" + ipArticle.Name; scriptureLink.Breadcrumb = GetBreadcrumbForScripture(ipArticle); searchList.lstBibleLinks.Add(scriptureLink); } } }
private void ObtainByArticle(Models.SearchList searchList, int pageNo) { //Instantiate variables var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); searchList.ShowArticles = true; searchList.SearchInTitle = "All Articles"; if (!string.IsNullOrWhiteSpace(searchList.SearchFor)) { //Get all prayers BaseSearchProvider mySearcher = ExamineManager.Instance.SearchProviderCollection[Common.searchProviders.ArticleSearcher]; ISearchCriteria criteria = mySearcher.CreateSearchCriteria(BooleanOperation.Or); //Setup up search fields by importance IBooleanOperation query = criteria.Field(Common.NodeProperties.title, searchList.SearchFor.MultipleCharacterWildcard()); query.Or().Field(Common.NodeProperties.subtitle, searchList.SearchFor.MultipleCharacterWildcard()); query.Or().Field(Common.NodeProperties.content, searchList.SearchFor.MultipleCharacterWildcard()); query.Or().Field(Common.NodeProperties.originalSource, searchList.SearchFor.MultipleCharacterWildcard()); //IBooleanOperation query = criteria.Field(Common.NodeProperties.title, searchList.SearchFor.Boost(3)); //query.Or().Field(Common.NodeProperties.subtitle, searchList.SearchFor.Boost(2)); //query.Or().Field(Common.NodeProperties.content, searchList.SearchFor.Boost(1)); //query.Or().Field(Common.NodeProperties.originalSource, searchList.SearchFor); //Obtain result with query ISearchResults searchResults = mySearcher.Search(query.Compile()); //Get item counts and total experiences. searchList.Pagination.totalItems = searchResults.Count(); //Determine how many pages/items to skip and take, as well as the total page count for the search result. if (searchList.Pagination.totalItems > searchList.Pagination.itemsPerPage) { searchList.Pagination.totalPages = (int)Math.Ceiling((double)searchList.Pagination.totalItems / (double)searchList.Pagination.itemsPerPage); } else { searchList.Pagination.itemsPerPage = searchList.Pagination.totalItems; searchList.Pagination.totalPages = 1; } //Determine current page number if (pageNo <= 0 || pageNo > searchList.Pagination.totalPages) { pageNo = 1; } searchList.Pagination.pageNo = pageNo; //Determine how many pages/items to skip if (searchList.Pagination.totalItems > searchList.Pagination.itemsPerPage) { searchList.Pagination.itemsToSkip = searchList.Pagination.itemsPerPage * (pageNo - 1); } //Convert list of SearchResults to list of classes foreach (SearchResult sRecord in searchResults.Skip(searchList.Pagination.itemsToSkip).Take(searchList.Pagination.itemsPerPage)) { var msgLink = new Models.ArticleLink(); IPublishedContent ipArticle = umbracoHelper.TypedContent(sRecord.Id); msgLink.Id = ipArticle.Id; msgLink.Url = ipArticle.Url; msgLink.Breadcrumb = GetBreadcrumbForArticle(ipArticle); searchList.lstArticleLinks.Add(msgLink); } } }
private void ObtainByPrayerCorner(Models.SearchList searchList, int pageNo) { //Instantiate variables var memberShipHelper = new Umbraco.Web.Security.MembershipHelper(UmbracoContext.Current); searchList.ShowPrayers = true; searchList.SearchInTitle = "The Prayer Corner"; if (!string.IsNullOrWhiteSpace(searchList.SearchFor)) { // var CmPrayerList = new ContentModels.PrayerList(Umbraco.TypedContent((int)Common.siteNode.ThePrayerCorner)); //Get all prayers BaseSearchProvider mySearcher = ExamineManager.Instance.SearchProviderCollection[Common.searchProviders.PrayersSearcher]; ISearchCriteria criteria = mySearcher.CreateSearchCriteria(BooleanOperation.Or); //Setup up search fields by importance IBooleanOperation query = criteria.Field(Common.NodeProperties.prayerTitle, searchList.SearchFor.MultipleCharacterWildcard()); query.Or().Field(Common.NodeProperties.prayer, searchList.SearchFor.MultipleCharacterWildcard()); query.Or().Field(Common.NodeProperties.prayerRequestMember, searchList.SearchFor.MultipleCharacterWildcard()); //IBooleanOperation query = criteria.Field(Common.NodeProperties.prayerTitle, searchList.SearchFor.Boost(2)); //query.Or().Field(Common.NodeProperties.prayer, searchList.SearchFor.Boost(1)); //query.Or().Field(Common.NodeProperties.prayerRequestMember, searchList.SearchFor); //Obtain result with query ISearchResults searchResults = mySearcher.Search(query.Compile()); //Get total experiences. searchList.Pagination.itemsPerPage = 10; searchList.Pagination.totalItems = searchResults.Count(); //Determine how many pages/items to skip and take, as well as the total page count for the search result. if (searchList.Pagination.totalItems > searchList.Pagination.itemsPerPage) { searchList.Pagination.totalPages = (int)Math.Ceiling((double)searchList.Pagination.totalItems / (double)searchList.Pagination.itemsPerPage); } else { searchList.Pagination.itemsPerPage = searchList.Pagination.totalItems; searchList.Pagination.totalPages = 1; } //Determine current page number if (pageNo <= 0 || pageNo > searchList.Pagination.totalPages) { pageNo = 1; } searchList.Pagination.pageNo = pageNo; //Determine how many pages/items to skip if (searchList.Pagination.totalItems > searchList.Pagination.itemsPerPage) { searchList.Pagination.itemsToSkip = searchList.Pagination.itemsPerPage * (pageNo - 1); } //Convert list of SearchResults to list of classes foreach (SearchResult sRecord in searchResults.Skip(searchList.Pagination.itemsToSkip).Take(searchList.Pagination.itemsPerPage)) { //Create new prayerLink class var prayerLink = new Models.PrayerLink(); prayerLink.Id = sRecord.Id; prayerLink.Title = sRecord.Fields[Common.NodeProperties.prayerTitle]; prayerLink.Url = Umbraco.NiceUrl(sRecord.Id); prayerLink.Date = Convert.ToDateTime(sRecord.Fields[Common.NodeProperties.requestDate]); //Determine current percentage prayerLink.currentPercentage = int.Parse(sRecord.Fields[Common.NodeProperties.currentPercentage]); prayerLink.baseCalculationDate = DateTime.Parse(sRecord.Fields[Common.NodeProperties.baseCalculationDate]); int daysSinceBaseDate = (DateTime.Now - prayerLink.baseCalculationDate).Days; if (daysSinceBaseDate > prayerLink.currentPercentage) { prayerLink.currentPercentage = 0; } else { prayerLink.currentPercentage = prayerLink.currentPercentage - daysSinceBaseDate; } //Determine proper candle based upon current percentage prayerLink.CandleUrl = CmPrayerList.CandleOut.Url; if (prayerLink.currentPercentage == 0) { prayerLink.CandleUrl = CmPrayerList.CandleOut.Url; } else if (prayerLink.currentPercentage >= 1 && prayerLink.currentPercentage <= 10) { prayerLink.CandleUrl = CmPrayerList.Candle10.Url; } else if (prayerLink.currentPercentage >= 11 && prayerLink.currentPercentage <= 20) { prayerLink.CandleUrl = CmPrayerList.Candle20.Url; } else if (prayerLink.currentPercentage >= 21 && prayerLink.currentPercentage <= 30) { prayerLink.CandleUrl = CmPrayerList.Candle30.Url; } else if (prayerLink.currentPercentage >= 31 && prayerLink.currentPercentage <= 40) { prayerLink.CandleUrl = CmPrayerList.Candle40.Url; } else if (prayerLink.currentPercentage >= 41 && prayerLink.currentPercentage <= 50) { prayerLink.CandleUrl = CmPrayerList.Candle50.Url; } else if (prayerLink.currentPercentage >= 51 && prayerLink.currentPercentage <= 60) { prayerLink.CandleUrl = CmPrayerList.Candle60.Url; } else if (prayerLink.currentPercentage >= 61 && prayerLink.currentPercentage <= 70) { prayerLink.CandleUrl = CmPrayerList.Candle70.Url; } else if (prayerLink.currentPercentage >= 71 && prayerLink.currentPercentage <= 80) { prayerLink.CandleUrl = CmPrayerList.Candle80.Url; } else if (prayerLink.currentPercentage >= 81 && prayerLink.currentPercentage <= 90) { prayerLink.CandleUrl = CmPrayerList.Candle90.Url; } else if (prayerLink.currentPercentage >= 91 && prayerLink.currentPercentage <= 100) { prayerLink.CandleUrl = CmPrayerList.Candle100.Url; } // IEnumerable <string> prayerSummary = sRecord.Fields[Common.NodeProperties.prayer].Split().Take(32); prayerLink.PrayerSummary = string.Join(" ", prayerSummary) + "..."; //Obtain member ContentModels.Member CmMember; int memberId; if (int.TryParse(sRecord.Fields[Common.NodeProperties.prayerRequestMember], out memberId)) { IPublishedContent ipMember = memberShipHelper.GetById(memberId); CmMember = new ContentModels.Member(ipMember); } else { CmMember = new ContentModels.Member(Udi.Parse(sRecord.Fields[Common.NodeProperties.prayerRequestMember]).ToPublishedContent()); } StringBuilder sbAuthor = new StringBuilder(); sbAuthor.Append(CmMember.FirstName); sbAuthor.Append(" "); sbAuthor.Append(CmMember.LastName); sbAuthor.Append("."); prayerLink.MemberName = sbAuthor.ToString(); // searchList.lstPrayerLinks.Add(prayerLink); //prayerLink.currentPercentage = int.Parse(sRecord.Fields[Common.NodeProperties.currentPercentage]); //IEnumerable<string> prayerSummary = sRecord.Fields[Common.NodeProperties.prayer].Split().Take(32); //prayerLink.PrayerSummary = string.Join(" ", prayerSummary) + "..."; ////Obtain member //ContentModels.Member CmMember; //int memberId; //if (int.TryParse(sRecord.Fields[Common.NodeProperties.prayerRequestMember], out memberId)) //{ // IPublishedContent ipMember = memberShipHelper.GetById(memberId); // CmMember = new ContentModels.Member(ipMember); //} //else //{ // CmMember = new ContentModels.Member(Udi.Parse(sRecord.Fields[Common.NodeProperties.prayerRequestMember]).ToPublishedContent()); //} //StringBuilder sbAuthor = new StringBuilder(); //sbAuthor.Append(CmMember.FirstName); //sbAuthor.Append(" "); //sbAuthor.Append(CmMember.LastName); //sbAuthor.Append("."); //prayerLink.MemberName = sbAuthor.ToString(); //searchList.lstPrayerLinks.Add(prayerLink); } } }
private void ObtainByMessagesFromHeaven(Models.SearchList searchList, int pageNo) { //Instantiate variables searchList.ShowMsgsFromHeaven = true; searchList.SearchInTitle = "Messages from Heaven"; if (!string.IsNullOrWhiteSpace(searchList.SearchFor)) { //Get all prayers BaseSearchProvider mySearcher = ExamineManager.Instance.SearchProviderCollection[Common.searchProviders.MessagesSearcher]; ISearchCriteria criteria = mySearcher.CreateSearchCriteria(BooleanOperation.Or); //Setup up search fields by importance IBooleanOperation query = criteria.Field(Common.NodeProperties.nodeName, searchList.SearchFor.MultipleCharacterWildcard()); query.Or().Field(Common.NodeProperties.subtitle, searchList.SearchFor.MultipleCharacterWildcard()); //IBooleanOperation query = criteria.Field(Common.NodeProperties.nodeName, searchList.SearchFor.Boost(1)); //query.Or().Field(Common.NodeProperties.subtitle, searchList.SearchFor); //Obtain result with query ISearchResults searchResults = mySearcher.Search(query.Compile()); //Get item counts and total experiences. searchList.Pagination.totalItems = searchResults.Count(); //Determine how many pages/items to skip and take, as well as the total page count for the search result. if (searchList.Pagination.totalItems > searchList.Pagination.itemsPerPage) { searchList.Pagination.totalPages = (int)Math.Ceiling((double)searchList.Pagination.totalItems / (double)searchList.Pagination.itemsPerPage); } else { searchList.Pagination.itemsPerPage = searchList.Pagination.totalItems; searchList.Pagination.totalPages = 1; } //Determine current page number if (pageNo <= 0 || pageNo > searchList.Pagination.totalPages) { pageNo = 1; } searchList.Pagination.pageNo = pageNo; //Determine how many pages/items to skip if (searchList.Pagination.totalItems > searchList.Pagination.itemsPerPage) { searchList.Pagination.itemsToSkip = searchList.Pagination.itemsPerPage * (pageNo - 1); } //Convert list of SearchResults to list of classes foreach (SearchResult sRecord in searchResults.Skip(searchList.Pagination.itemsToSkip).Take(searchList.Pagination.itemsPerPage)) { var msgLink = new Models.MsgLink(); msgLink.Id = sRecord.Id; msgLink.Title = sRecord.Fields[Common.NodeProperties.nodeName]; msgLink.Subtitle = sRecord.Fields[Common.NodeProperties.subtitle]; msgLink.Url = Umbraco.NiceUrl(sRecord.Id); //msgLink.Date = Convert.ToDateTime(sRecord.Fields[Common.NodeProperties.publishDate]); msgLink.Dates = (Convert.ToDateTime(sRecord.Fields[Common.NodeProperties.publishDate])).ToString("MMMM dd"); searchList.lstMsgsFromHeavenLinks.Add(msgLink); } } }