Ejemplo n.º 1
0
        public static string filteredNews(string _url, string _xpath, int _qty, string _categories, string _colleges, string _tags, string _fromDate, string _toDate, int _pageStart)
        {
            LocalItems xml = new LocalItems(_url, _xpath);

            // get count for pagination

            // start filtering ....

            List <EtsuRssItem> EtsuItemList = new List <EtsuRssItem>();

            string o = "<ul class=\"rss_hidelist\">";

            xml.items.ToList().ForEach(
                x =>
                { EtsuRssItem currentEtsuItem = x.ToEtsuRssItem();
                  if (currentEtsuItem.dateIsGood(_fromDate, _toDate) &&
                      currentEtsuItem.hasCategory(_categories) &&
                      currentEtsuItem.hasAllColleges(_colleges) &&
                      currentEtsuItem.hasAllTags(_tags))
                  {
                      EtsuItemList.Add(currentEtsuItem);
                  }
                }
                );

            EtsuItemList.Take(_qty).ToList().ForEach(
                x =>
            {
                o += x.ToDefault();
            });
            o += "</ul>";
            return(o);
        }
        public static string filteredNews(string _url, string _xpath, int _qty, string _categories, string _colleges, string _tags, string _fromDate, string _toDate, int _pageStart)
        {
            LocalItems xml = new LocalItems(_url, _xpath);

            // get count for pagination

            // start filtering ....

            List<EtsuRssItem> EtsuItemList = new List<EtsuRssItem>();

            string o = "<ul class=\"rss_hidelist\">";

            xml.items.ToList().ForEach(
                x =>
                    { EtsuRssItem currentEtsuItem = x.ToEtsuRssItem();
                        if (currentEtsuItem.dateIsGood(_fromDate, _toDate) &&
                            currentEtsuItem.hasCategory(_categories) &&
                            currentEtsuItem.hasAllColleges(_colleges) &&
                            currentEtsuItem.hasAllTags(_tags))
                        { EtsuItemList.Add(currentEtsuItem); }
                    }
             );

            EtsuItemList.Take(_qty).ToList().ForEach(
                x =>
                {
                    o += x.ToDefault();
                });
            o += "</ul>";
            return o;
        }
Ejemplo n.º 3
0
        public static string rss_sample_7(string _url, string _xpath, int _qty)
        {
            LocalItems xml = new LocalItems(_url, _xpath);
            string     o   = "<div style=\"overflow:hidden;\">";

            xml.items.Take(_qty).ToList().ForEach(x => { o += x.ToEtsuRssItem().ToListSample7(); });
            o += "</div>";
            return(o);
        }
Ejemplo n.º 4
0
        public static string rss_sample_6(string _url, string _xpath, int _qty)
        {
            LocalItems xml = new LocalItems(_url, _xpath);
            string     o   = "<ul class=\"rss_hidelist\">";

            xml.items.Take(_qty).ToList().ForEach(x => { o += x.ToEtsuRssItem().ToListSample6(); });
            o += "</ul>";
            return(o);
        }
 public static string rss_sample_7(string _url, string _xpath, int _qty)
 {
     LocalItems xml = new LocalItems(_url, _xpath);
     string o = "<div style=\"overflow:hidden;\">";
     xml.items.Take(_qty).ToList().ForEach(x => { o += x.ToEtsuRssItem().ToListSample7(); });
     o += "</div>";
     return o;
 }
 public static string rss_sample_6(string _url, string _xpath, int _qty)
 {
     LocalItems xml = new LocalItems(_url, _xpath);
     string o = "<ul class=\"rss_hidelist\">";
     xml.items.Take(_qty).ToList().ForEach(x => { o += x.ToEtsuRssItem().ToListSample6(); });
     o += "</ul>";
     return o;
 }
Ejemplo n.º 7
0
        public static string filteredNewsWithPagination(string _url, string _xpath, int _qty, string _categories, string _colleges, string _tags, string _fromDate, string _toDate, int _pageStart)
        {
            double number_items_to_show = 10.0;
            double number_pages_to_show = 10.0;
            string o = "";
            // get count for pagination

            LocalItems xml = new LocalItems(_url, _xpath);
            int count = xml.items.Count();

            // get counts for pagination

            int pages_count = Convert.ToInt32(Math.Ceiling(count / number_items_to_show));
            int groups_of_pages_count = Convert.ToInt32(Math.Ceiling(pages_count / number_pages_to_show));
            int last_data_source_index = Convert.ToInt32((pages_count * number_items_to_show) - number_pages_to_show);

            o += OUC.WnlDisplayMethods.customNewsPaginationRow(count, pages_count, groups_of_pages_count, Convert.ToInt32(number_items_to_show), _pageStart,Convert.ToInt32(number_pages_to_show), last_data_source_index);

            // empty list to store items matching filters
            List<EtsuRssItem> EtsuItemList = new List<EtsuRssItem>();

            o += "<ul class=\"rss_hidelist\">";

            // start filtering xml elements list
            // for each xelement, turn into etsu item
            // add matching items to to etus item list
            xml.items.ToList().ForEach(
                // x represents the current item in the foreach loop
                x =>
                {
                    EtsuRssItem currentEtsuItem = x.ToEtsuRssItem();
                    if (currentEtsuItem.dateIsGood(_fromDate, _toDate) &&
                        currentEtsuItem.hasCategory(_categories) &&
                        currentEtsuItem.hasAllColleges(_colleges) &&
                        currentEtsuItem.hasAllTags(_tags))
                    { EtsuItemList.Add(currentEtsuItem); }
                }
             );

            // now all the correct items in the EtsuItemList,
            // take how many you want and do something with each one

            EtsuItemList.Take(Convert.ToInt32(number_items_to_show)).ToList().ForEach(
                // x represents the current item in the foreach loop
                x =>
                {
                 // o is the global string variable that we are building up to return
                 // ToDefault() is a class method of EtsuRssItem.cs in App_Code
                    o += x.ToDefault();
                });
            o += "</ul>";
            return o;
        }