Exemple #1
0
        private void LoadCommitteDataAdv(long idCall, Int32 idCommunity, long idCommittee, long idMember, dtoEvaluationsFilters filters)
        {
            EvaluationType evalType = EvaluationType.Sum;

            List <dtoCommitteeEvaluationsInfo> committees = ServiceCall.GetCommitteesEvaluationInfoAdv(idCall, idMember, idCommittee, ref evalType);

            View.CurrentFilters = filters;
            View.CurrentOrderBy = filters.OrderBy;
            //View.CurrentFilterBy = filters.Status;
            View.CurrentAscending = filters.Ascending;
            if (committees.Any())
            {
                String name = View.GetItemEncoded(filters.SearchForName);
                foreach (dtoCommitteeEvaluationsInfo c in committees)
                {
                    c.NavigationUrl = RootObject.ViewSubmissionsToEvaluate(
                        c.IdCommittee,
                        CallForPaperType.CallForBids,
                        idCall,
                        idCommunity,
                        View.PreloadView,
                        SubmissionsOrder.ByUser,
                        true,
                        filters.IdSubmitterType,
                        filters.Status,
                        name);
                }
                View.AllowExportAll     = (committees.Count > 1);
                View.AllowExportCurrent = true;

                View.CurrentEvaluationType = evalType;



                if (!committees.Where(c => c.IdCommittee == idCommittee).Any())
                {
                    idCommittee = committees.Select(c => c.IdCommittee).FirstOrDefault();
                }
                View.IdCurrentCommittee = idCommittee;

                //dtoEvaluatorCommitteeStatistic statistic = Service.GetEvaluatorCommitteeStatistics(View.CurrentEvaluationType, filters, View.AnonymousDisplayname, View.UnknownDisplayname, idCommittee, idEvaluator);
                dtoEvaluatorCommitteeStatistic statistic =
                    ServiceCall.GetEvaluatorCommitteeStatistics(
                        View.CurrentEvaluationType,
                        filters,
                        View.AnonymousDisplayname,
                        View.UnknownDisplayname,
                        idCommittee, idMember);


                Dictionary <SubmissionsOrder, Boolean> allowedReorder = new Dictionary <SubmissionsOrder, Boolean>(); //{{ SubmissionsOrder.ByEvaluationIndex, true}};
                Boolean allow = (statistic != null && statistic.Evaluations != null && statistic.Evaluations.Count > 1);
                allowedReorder.Add(SubmissionsOrder.ByEvaluationIndex, allow);
                allowedReorder.Add(SubmissionsOrder.ByUser, allow);
                allowedReorder.Add(SubmissionsOrder.ByEvaluationPoints, allow);
                allowedReorder.Add(SubmissionsOrder.ByType, allow && statistic.Evaluations.Select(t => t.SubmitterType).Distinct().Count() > 1);
                View.AvailableOrderBy = allowedReorder;

                View.CriteriaCount = statistic.Criteria.Where(c => c.Deleted == BaseStatusDeleted.None).Count();


                dtoBaseEvaluatorStatistics globalStat = new dtoBaseEvaluatorStatistics();
                globalStat.Counters[Domain.Evaluation.EvaluationStatus.Evaluated]  = committees.Where(c => c.Counters.ContainsKey(Domain.Evaluation.EvaluationStatus.Evaluated)).Select(c => c.Counters[Domain.Evaluation.EvaluationStatus.Evaluated]).Sum();
                globalStat.Counters[Domain.Evaluation.EvaluationStatus.Evaluating] = committees.Where(c => c.Counters.ContainsKey(Domain.Evaluation.EvaluationStatus.Evaluating)).Select(c => c.Counters[Domain.Evaluation.EvaluationStatus.Evaluating]).Sum();
                globalStat.Counters[Domain.Evaluation.EvaluationStatus.None]       = committees.Where(c => c.Counters.ContainsKey(Domain.Evaluation.EvaluationStatus.None)).Select(c => c.Counters[Domain.Evaluation.EvaluationStatus.None]).Sum();

                try
                {
                    globalStat.Counters[Domain.Evaluation.EvaluationStatus.Confirmed] = committees.Where(c => c.Counters.ContainsKey(Domain.Evaluation.EvaluationStatus.Confirmed)).Select(c => c.Counters[Domain.Evaluation.EvaluationStatus.Confirmed]).Sum();
                } catch { }

                View.LoadEvaluationData(globalStat, committees, statistic, filters.IdSubmitterType, filters.Status, (String.IsNullOrEmpty(filters.SearchForName) ? "" : View.GetItemEncoded(filters.SearchForName)));
            }
            else
            {
                View.AllowEvaluate = false;
                View.DisplayEvaluationUnavailable();
            }
        }