Пример #1
0
        public CategoryCollection(XmlNode node)
            : base(node)
        {
            XmlNodeList list = node.SelectNodes("category");

            Categories = new List <Category>(list.Count);
            foreach (XmlNode sub in list)
            {
                Categories.Add(Category.Create(sub));
            }
            mode = node.ReadEnum("@mode", CategoryMode.All);
        }
Пример #2
0
        private void FilterReport()
        {
            if (FilteredReport == null)
            {
                return;
            }
            FilteredReport = new List <Participant>(Report);
            if (CategoryMode != "No Filter")
            {
                FilteredReport.RemoveAll(p => p.category_mode.ToLower() != CategoryMode.ToLower());
            }
            if (CategoryOperator != "No Filter")
            {
                FilteredReport.RemoveAll(p => p.category_op.ToLower() != CategoryOperator.ToLower());
            }
            if (CategoryPower != "No Filter")
            {
                FilteredReport.RemoveAll(p => p.category_power.ToLower() != CategoryPower.ToLower());
            }
            if (CategoryOrigin == "Israeli")
            {
                FilteredReport.RemoveAll(p => !HolyLogParser.IsIsraeliStation(p.callsign));
            }
            else if (CategoryOrigin == "Foreign")
            {
                FilteredReport.RemoveAll(p => HolyLogParser.IsIsraeliStation(p.callsign));
            }

            if (CategoryStation != "No Filter")
            {
                if (CategoryStation == "Fixed")
                {
                    FilteredReport.RemoveAll(p => p.squers > 1 || p.callsign.ToLower().Contains(@"/p"));
                }
                else if (CategoryStation == "Mobile")
                {
                    FilteredReport.RemoveAll(p => p.squers < 2 || p.callsign.ToLower().Contains(@"/p"));
                }
                else if (CategoryStation == "Portable")
                {
                    FilteredReport.RemoveAll(p => p.squers > 1 || !p.callsign.ToLower().Contains(@"/p"));
                }
            }
            DataContext = FilteredReport.OrderByDescending(p => p.score).ToList();

            if (L_NUmOfParticipantsValue != null)
            {
                L_NUmOfParticipantsValue.Content = FilteredReport.Count();
            }
            //Console.WriteLine("Category: " + CategoryMode + " : " + CategoryOperator + " : " + CategoryPower + " : " + CategoryStation);
        }
Пример #3
0
        public async Task <ActionResult <IEnumerable <NewsPost> > > GetAll([FromQuery] PaginationDTO pagination,
                                                                           CategoryMode category = CategoryMode.All)
        {
            if (pagination == null)
            {
                throw new ArgumentNullException(nameof(pagination));
            }

            var postasDescending = newsServece.GetAll().OrderByDescending(news => news.Id);

            IQueryable <NewsPost> posts = category == CategoryMode.All
                ? postasDescending
                : postasDescending.Where(news => news.Category == category);

            await HttpContext.InsertPaginationsPerPage(posts, pagination.QuantityPerPage)
            .ConfigureAwait(true);

            return(Ok(posts.Pagination(pagination)
                      .ToList()));
        }
Пример #4
0
 public record Command(DateTimeOffset DateFrom, DateTimeOffset DateTo, long ChatId, CategoryMode CategoryMode = CategoryMode.Complete) : IRequest <Result>;