Example #1
0
        public IEnumerable <Tools.ModelView.ReportChartModel> ChartNumberArticleByReferee(
            IConnectionHandler connectionHandler, Guid congressId)
        {
            var models = new List <Tools.ModelView.ReportChartModel>();
            var list   = new RefereeCartableBO().GroupBy(connectionHandler,
                                                         new Expression <Func <RefereeCartable, object> >[] { c => c.RefereeId },
                                                         new GroupByModel <RefereeCartable>[]
            {
                new GroupByModel <RefereeCartable>()
                {
                    Expression           = c => c.ArticleId,
                    AggrigateFuntionType = AggrigateFuntionType.Count
                },
            }, c => c.Referee.CongressId == congressId);

            var refList = new RefereeBO().Select(connectionHandler,
                                                 new Expression <Func <Referee, object> >[]
            {
                x => x.Id,
                x =>
                x.EnterpriseNode.RealEnterpriseNode.FirstName + " " +
                x.EnterpriseNode.RealEnterpriseNode.LastName
            }, x => x.CongressId == congressId);

            foreach (var o in refList)
            {
                if (!(o.FirstNameAndLastName is string))
                {
                    continue;
                }
                var model = new Tools.ModelView.ReportChartModel {
                    Value = o.FirstNameAndLastName
                };
                var firstOrDefault = list.FirstOrDefault(x => x.RefereeId == o.Id);
                if (firstOrDefault != null && firstOrDefault.CountArticleId is int)
                {
                    model.Count = firstOrDefault.CountArticleId;
                }
                else
                {
                    model.Count = 0;
                }
                models.Add(model);
            }

            return(models);
        }
Example #2
0
        public void SetArticleCount(IConnectionHandler connectionHandler, List <Referee> list, Guid congressId)
        {
            var groupBy = new RefereeCartableBO().GroupBy(connectionHandler,
                                                          new Expression <Func <RefereeCartable, object> >[] { x => x.RefereeId },
                                                          new GroupByModel <RefereeCartable>[]
            {
                new GroupByModel <RefereeCartable>()
                {
                    Expression           = x => x.ArticleId,
                    AggrigateFuntionType = AggrigateFuntionType.Count
                }
            }, x => x.Referee.CongressId == congressId);


            var groupBy2 = new RefereeCartableBO().GroupBy(connectionHandler,
                                                           new Expression <Func <RefereeCartable, object> >[] { x => x.RefereeId },
                                                           new GroupByModel <RefereeCartable>[]
            {
                new GroupByModel <RefereeCartable>()
                {
                    Expression           = x => x.ArticleId,
                    AggrigateFuntionType = AggrigateFuntionType.Count
                }
            }, x => x.Referee.CongressId == congressId && x.Status == (byte)Enums.FinalState.WaitForAnswer);

            foreach (var item in list)
            {
                var firstOrDefault = groupBy.FirstOrDefault(x => x.RefereeId == item.Id);
                if (firstOrDefault != null)
                {
                    item.AllArticleCount = firstOrDefault.CountArticleId;
                }
                var @default = groupBy2.FirstOrDefault(x => x.RefereeId == item.Id);
                if (@default != null)
                {
                    item.WaitForAnswerArticleCount = @default.CountArticleId;
                }
            }
        }