private void LoadItems(long idCall, EvaluationType type, Int32 idCommunity, dtoEvaluationsFilters filters, int pageIndex, int pageSize)
        {
            if (type == EvaluationType.Dss)
            {
                InitializeDssInfo(idCall);
            }
            else
            {
                View.HideDssWarning();
            }

            bool isAdvance = ServiceCall.CallIsAdvanced(idCall);

            List <dtoEvaluationSummaryItem> items =
                isAdvance ?
                ServiceCall.GetEvaluationsList(idCall, View.IdCallAdvCommission, type, filters, View.AnonymousDisplayname, View.UnknownDisplayname) :
                Service.GetEvaluationsList(idCall, type, filters, View.AnonymousDisplayname, View.UnknownDisplayname, true);



            PagerBase pager = new PagerBase();

            pager.PageSize = pageSize;

            if (pageSize == 0)
            {
                pageSize = 50;
            }
            pager.Count     = (int)items.Count - 1;
            pager.PageIndex = pageIndex;// Me.View.CurrentPageIndex
            View.Pager      = pager;

            View.CurrentOrderBy   = filters.OrderBy;
            View.CurrentFilterBy  = filters.Status;
            View.CurrentAscending = filters.Ascending;
            View.PageSize         = pageSize;

            View.AllowExportCurrent = (items != null && items.Any() && items.Skip(pageIndex * pageSize).Take(pageSize).Any());
            if (pager.Count < 0)
            {
                View.DisplayNoEvaluationsFound();
            }
            else
            {
                List <long> committees = Service.GetIdCommittees(idCall);
                if (committees.Count == 1)
                {
                    View.DisplayLinkToSingleCommittee(committees.FirstOrDefault());
                }
                View.LoadEvaluations(items.Skip(pageIndex * pageSize).Take(pageSize).ToList(), committees.Count);
            }
            View.SendUserAction(View.IdCallCommunity, View.IdCallModule, ModuleCallForPaper.ActionType.ViewEvaluationsSummary);


            if (isAdvance)
            {
                bool cancloseAdvance = ServiceCall.CommissionCanClose(View.IdCallAdvCommission);
                View.ShowCloseCommission(cancloseAdvance);
            }
        }
Пример #2
0
        public void SaveEvaluation(
            List <lm.Comol.Modules.CallForPapers.Domain.Evaluation.dtoCriterionEvaluated> criteria,
            String comment,
            Boolean completed)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout(
                    RootObject.EvaluateSubmission(View.IdCall, View.PreloadIdCommunity, View.PreloadedIdEvaluation)
                    );
            }
            else
            {
                long idCall    = View.IdCall;
                bool isAdvance = ServiceCall.CallIsAdvanced(idCall);

                long idEvaluation = View.IdEvaluation;
                long idEvaluator  = View.IdEvaluator;
                lm.Comol.Modules.CallForPapers.Domain.Evaluation.Evaluation evaluation = null;
                try
                {
                    if (!View.SavingForComplete && completed)
                    {
                        View.SavingForComplete = completed;
                    }
                    evaluation = isAdvance ?
                                 ServiceCall.SaveEvaluation(idEvaluation, idEvaluator, criteria, comment, completed):
                                 Service.SaveEvaluation(idEvaluation, idEvaluator, criteria, comment, completed);

                    if (evaluation == null)
                    {
                        View.DisplayError((completed) ? EvaluationEditorErrors.SavingEvaluationCompleted : EvaluationEditorErrors.SavingEvaluation);
                    }
                    else
                    {
                        View.DisplaySettingsSaved();
                        View.SendUserAction(View.IdCallCommunity, View.IdCallModule, idEvaluation, ModuleCallForPaper.ActionType.EvaluateSubmission);
                    }
                }
                catch (EvaluationError ex)
                {
                    View.DisplayWarning((completed) ? EvaluationEditorErrors.SavingEvaluationCompleted : EvaluationEditorErrors.SavingEvaluation, ex.Criteria.Count());
                }
                catch (Exception ex)
                {
                    View.DisplayError((completed) ? EvaluationEditorErrors.SavingEvaluationCompleted : EvaluationEditorErrors.SavingEvaluation);
                }

                LoadEvaluationData(
                    idCall,
                    (isAdvance) ?
                    ServiceCall.GetFullEvaluation(idEvaluation, View.AnonymousOwnerName, View.UnknownDisplayname) :
                    Service.GetFullEvaluation(idEvaluation, View.AnonymousOwnerName, View.UnknownDisplayname));
            }
        }
Пример #3
0
        public void LoadEvaluations(long idSubmission, long idCall, EvaluationType type, long idCommittee, Int32 count)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout(RootObject.ViewSubmissionTableEvaluations(idSubmission, idCall, View.IdCallCommunity));
            }
            else
            {
                bool isAdvance = ServiceCall.CallIsAdvanced(idCall);

                List <dtoSubmissionCommitteeItem> evaluations =
                    isAdvance ?
                    ServiceCall.GetSubmissionEvaluations(idCall, idSubmission, idCommittee, View.UnknownDisplayname) :
                    Service.GetSubmissionEvaluations(idCall, idSubmission, idCommittee, View.UnknownDisplayname);

                View.AllowHideComments  = (evaluations != null && evaluations.Where(e => e.HasComments()).Any());
                View.AllowExportCurrent = (evaluations != null && (idCommittee > 0 || count == 1));
                View.AllowExportAll     = (evaluations != null && count > 1);
                View.LoadEvaluations(evaluations);
            }
        }
Пример #4
0
        public String ExportTo(
            SummaryType summaryType,
            long idCall,
            long idSubmission,
            long idCommittee,
            ExportData exportData,
            lm.Comol.Core.DomainModel.Helpers.Export.ExportFileType fileType,
            Dictionary <lm.Comol.Modules.CallForPapers.Domain.Evaluation.EvaluationTranslations, String> translations,
            Dictionary <lm.Comol.Modules.CallForPapers.Domain.Evaluation.EvaluationStatus, String> status)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout(RootObject.ViewSubmissionTableEvaluations(idSubmission, idCall, View.IdCallCommunity));
                return("");
            }

            dtoBaseForPaper call = ServiceCall.GetDtoBaseCall(idCall);

            dtoSubmissionRevision submission = ServiceCall.GetSubmissionWithRevisions(idSubmission, false);

            List <dtoCommitteeEvaluationInfo> committees = new List <dtoCommitteeEvaluationInfo>();



            EvaluationType evalType = View.CurrentEvaluationType;

            bool isAdvance = ServiceCall.CallIsAdvanced(idCall);

            List <dtoSubmissionCommitteeItem> evaluations = new List <dtoSubmissionCommitteeItem>();

            if (isAdvance)
            {
                evaluations = ServiceCall.GetSubmissionEvaluations(idCall, idSubmission, idCommittee, View.UnknownDisplayname);
                committees  = ServiceCall.GetCommitteesInfoForSubmission(submission.Id, call.Id, View.AdvCommissionId);
            }
            else
            {
                evaluations = Service.GetSubmissionEvaluations(idCall, idSubmission, idCommittee, View.UnknownDisplayname);
                committees  = Service.GetCommitteesInfoForSubmission(submission.Id, call.Id);
            }



            String export = "";

            //INTESTAZIONE GENERICA

            export += string.Format(translations[EvaluationTranslations.CallTitle], call.Name) + ";";
            export += "\r\n";

            export += translations[EvaluationTranslations.CellTitleSubmissionOwner] + " ";
            export += submission.Owner.SurnameAndName + ";";
            export += "\r\n";

            if (submission.SubmittedOn != null)
            {
                DateTime submitOn = (DateTime)submission.SubmittedOn;

                export += string.Format(translations[EvaluationTranslations.SubmittedOn],
                                        submitOn.ToString("dd MM yyyy"),
                                        submitOn.ToString("h:mm:ss")
                                        ) + ";";

                export += "\r\n";
            }

            export += translations[EvaluationTranslations.CellTitleCommittee] + ";";

            if (committees != null && committees.Any())
            {
                export += committees.FirstOrDefault().Name;
            }
            else
            {
                export += "--";
            }


            export += "\r\n";
            export += "\r\n";


            if (exportData == ExportData.Fulldata)
            {
                //INTESTAZIONE ESPORTAZIONE

                export += translations[EvaluationTranslations.CellTitleEvaluator] + ";";
                export += translations[EvaluationTranslations.CellTitleGenericCriterion] + ";";
                export += "Tipo criterio;";
                export += translations[EvaluationTranslations.CellTitleGenericCriterionUserValue] + ";";

                //export += ((evalType == EvaluationType.Average) ?
                //    translations[Domain.Evaluation.EvaluationTranslations.CellTitleAverage] :
                //    translations[Domain.Evaluation.EvaluationTranslations.CellTitleSum])
                //    + ";";

                export += translations[EvaluationTranslations.CellTitleGenericCriterionComment] + ";";
                export += "Commento complessivo;";

                export += "\r\n";

                //DATA
                foreach (dtoEvaluatorDisplayItem evaluator in evaluations.FirstOrDefault().Evaluators)
                {
                    foreach (dtoCriterionEvaluated criterion in evaluator.Values)
                    {
                        export += evaluator.EvaluatorName + ";";
                        export += criterion.Criterion.Name + ";";



                        switch (criterion.Criterion.Type)
                        {
                        case CriterionType.Boolean:
                            export += "Boolean;";
                            export += (criterion.DecimalValue > 0) ? "1;" : "0;";
                            break;

                        case CriterionType.IntegerRange:
                            export += "Interi;";
                            export += criterion.DecimalValue.ToString("F0") + ";";
                            break;

                        case CriterionType.DecimalRange:
                            export += "Decimale;";
                            export += criterion.DecimalValue + ";";
                            break;

                        case CriterionType.StringRange:
                            export += "Qualitativo;";
                            export += criterion.StringValue + ";";
                            break;
                        }

                        export += criterion.Comment + ";";
                        export += evaluator.Comment + ";";
                        export += "\r\n";
                    }
                }
            }
            else
            {
                //INTESTAZIONE ESPORTAZIONE

                //export += translations[EvaluationTranslations.CellTitleEvaluator] + ";";
                //export += translations[EvaluationTranslations.CellTitleGenericCriterion] + ";";
                //export += "Tipo criterio;";
                //export += translations[EvaluationTranslations.CellTitleGenericCriterionUserValue] + ";";

                ////export += ((evalType == EvaluationType.Average) ?
                ////    translations[Domain.Evaluation.EvaluationTranslations.CellTitleAverage] :
                ////    translations[Domain.Evaluation.EvaluationTranslations.CellTitleSum])
                ////    + ";";

                //export += translations[EvaluationTranslations.CellTitleGenericCriterionComment] + ";";
                //export += "Commento complessivo;";

                //export += "\r\n";

                //DATA
                foreach (dtoEvaluatorDisplayItem evaluator in evaluations.FirstOrDefault().Evaluators)
                {
                    export += evaluator.EvaluatorName + ";";

                    foreach (dtoCriterionEvaluated criterion in evaluator.Values)
                    {
                        export += criterion.Criterion.Name + ";";


                        switch (criterion.Criterion.Type)
                        {
                        case CriterionType.Boolean:
                            export += "Boolean;";
                            export += (criterion.DecimalValue > 0) ? "Approvato;" : "Non approvato;";
                            break;

                        case CriterionType.IntegerRange:
                            export += "Interi;";
                            export += criterion.DecimalValue.ToString("F0") + ";";
                            break;

                        case CriterionType.DecimalRange:
                            export += "Decimale;";
                            export += criterion.DecimalValue + ";";
                            break;

                        case CriterionType.StringRange:
                            export += "Qualitativo;";
                            export += criterion.StringValue + ";";
                            break;
                        }

                        export += criterion.Comment + ";";
                    }

                    export += evaluator.Comment + ";";

                    export += "\r\n";
                }
            }

            return(export);


            //return Service.ExportSummaryStatistics(summaryType, ServiceCall.GetDtoCall(idCall), ServiceCall.GetSubmissionWithRevisions(idSubmission, false), idSubmission, idCommittee, View.AnonymousDisplayName, View.UnknownDisplayname, exportData, fileType, translations, status);
        }
Пример #5
0
        private void LoadCommitteData(long idCall, Int32 idCommunity, long idCommittee, long idEvaluator, dtoEvaluationsFilters filters)
        {
            bool isAdvance = ServiceCall.CallIsAdvanced(idCall);

            if (isAdvance)
            {
                LoadCommitteDataAdv(idCall, idCommunity, idCommittee, idEvaluator, filters);
                return;
            }


            EvaluationType type = EvaluationType.Sum;

            List <dtoCommitteeEvaluationsInfo> committees =
                isAdvance ?
                ServiceCall.GetCommitteesEvaluationInfoAdv(idCall, idEvaluator, idCommittee, ref type) :
                Service.GetCommitteesEvaluationInfo(idCall, idEvaluator);

            if (isAdvance)
            {
                View.CurrentEvaluationType = type;
            }


            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;
                if (!committees.Where(c => c.IdCommittee == idCommittee).Any())
                {
                    idCommittee = committees.Select(c => c.IdCommittee).FirstOrDefault();
                }
                View.IdCurrentCommittee = idCommittee;

                dtoEvaluatorCommitteeStatistic statistic =
                    isAdvance ?
                    ServiceCall.GetEvaluatorCommitteeStatistics(
                        View.CurrentEvaluationType,
                        filters,
                        View.AnonymousDisplayname,
                        View.UnknownDisplayname,
                        idCommittee,
                        idEvaluator
                        ) :
                    Service.GetEvaluatorCommitteeStatistics(
                        View.CurrentEvaluationType,
                        filters,
                        View.AnonymousDisplayname,
                        View.UnknownDisplayname,
                        idCommittee,
                        idEvaluator);

                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();


                View.LoadEvaluationData(globalStat, committees, statistic, filters.IdSubmitterType, filters.Status, (String.IsNullOrEmpty(filters.SearchForName) ? "" : View.GetItemEncoded(filters.SearchForName)));
            }
            else
            {
                View.AllowEvaluate = false;
                View.DisplayEvaluationUnavailable();
            }
        }
Пример #6
0
        public void InitView(Boolean forPublicCall)
        {
            Boolean          allowAdmin      = false;
            Boolean          isAnonymousUser = UserContext.isAnonymous;
            long             idCall          = View.PreloadIdCall;
            CallForPaperType type            = ServiceCall.GetCallType(idCall);
            long             idSubmission    = View.PreloadedIdSubmission;
            long             idRevision      = View.PreloadedIdRevision;
            Guid             uniqueId        = View.PreloadedUniqueID;


            View.IsAdvance = ServiceCall.CallIsAdvanced(idCall);


            dtoSubmissionRevision submission = ServiceCall.GetSubmissionWithRevisions(idSubmission, true);
            int idModule = (type == CallForPaperType.CallForBids) ? ServiceCall.ServiceModuleID() : ServiceRequest.ServiceModuleID();

            dtoBaseForPaper call        = ServiceCall.GetDtoBaseCall(idCall);
            int             idCommunity = SetCallCurrentCommunity(call);

            View.isAnonymousSubmission = forPublicCall;
            View.IdCall          = idCall;
            View.IdCallModule    = idModule;
            View.IdCallCommunity = idCommunity;
            View.CallType        = type;
            View.IdSubmission    = idSubmission;
            if (idRevision == 0 && submission != null)
            {
                idRevision = submission.GetIdLastActiveRevision();
            }
            View.IdRevision = idRevision;
            if (submission == null || submission.Owner == null)
            {
                View.DisplayUnknownSubmission(idCommunity, idModule, idSubmission, type);
            }
            else
            {
                if (idCall != submission.IdCall)
                {
                    idCall      = submission.IdCall;
                    call        = ServiceCall.GetDtoBaseCall(idCall);
                    idCommunity = SetCallCurrentCommunity(call);
                    type        = (call != null) ? call.Type : type;
                    idModule    = (type == CallForPaperType.CallForBids) ? ServiceCall.ServiceModuleID() : ServiceRequest.ServiceModuleID();

                    View.IdCall          = idCall;
                    View.IdCallModule    = idModule;
                    View.IdCallCommunity = idCommunity;
                    View.CallType        = type;
                }
                if (call == null)
                {
                    View.DisplayUnknownCall(idCommunity, idModule, idCall, type);
                    if (!isAnonymousUser)
                    {
                        View.SetActionUrl(CallStandardAction.List, RootObject.ViewCalls(type, CallStandardAction.List, View.PreloadIdOtherCommunity, View.PreloadView));
                    }
                }
                else if (isAnonymousUser && !forPublicCall)
                {
                    if (call.IsPublic && submission.IsAnonymous)
                    {
                        View.GoToUrl(RootObject.ViewSubmission(type, idCall, idSubmission, idRevision, uniqueId, true, false, View.PreloadView, View.PreloadIdOtherCommunity, 0));
                    }
                    else
                    {
                        View.DisplaySessionTimeout();
                    }
                }
                else if (isAnonymousUser && forPublicCall && !call.IsPublic)
                {
                    View.DisplayCallUnavailableForPublic();
                }
                else
                {
                    int        idUser     = UserContext.CurrentUserID;
                    litePerson currenUser = GetCurrentUser(ref idUser);
                    Boolean    allowView  = false;
                    View.CallRepository = call.GetRepositoryIdentifier();
                    switch (type)
                    {
                    case CallForPaperType.CallForBids:
                        ModuleCallForPaper module = ServiceCall.CallForPaperServicePermission(idUser, idCommunity);
                        allowView  = (submission.Owner.Id == idUser || module.ManageCallForPapers || module.Administration || ((module.CreateCallForPaper || module.EditCallForPaper) && call.Owner.Id == idUser));
                        allowAdmin = (View.PreloadFromManagement && (module.ManageCallForPapers || module.Administration || ((module.CreateCallForPaper || module.EditCallForPaper) && call.Owner.Id == idUser)));
                        break;

                    case CallForPaperType.RequestForMembership:
                        ModuleRequestForMembership moduleR = ServiceCall.RequestForMembershipServicePermission(idUser, idCommunity);
                        allowView  = (submission.Owner.Id == idUser || moduleR.ManageBaseForPapers || moduleR.Administration || ((moduleR.CreateBaseForPaper || moduleR.EditBaseForPaper) && call.Owner.Id == idUser));
                        allowAdmin = (View.PreloadFromManagement && (moduleR.ManageBaseForPapers || moduleR.Administration || ((moduleR.CreateBaseForPaper || moduleR.EditBaseForPaper) && call.Owner.Id == idUser)));
                        break;
                    }

                    if (View.IsAdvance)
                    {
                        Advanced.SubmissionListPermission permission = ServiceCall.SubmissionCanList(idCall);

                        if ((permission & Advanced.SubmissionListPermission.View) == Advanced.SubmissionListPermission.View)
                        {
                            allowView = true;
                        }

                        if ((permission & Advanced.SubmissionListPermission.Manage) == Advanced.SubmissionListPermission.Manage)
                        {
                            allowAdmin = true;
                        }
                    }


                    View.ShowAdministrationTools = allowAdmin;
                    CallStatusForSubmitters fromView = View.PreloadView;
                    if (fromView == CallStatusForSubmitters.None)
                    {
                        fromView = (allowAdmin) ? CallStatusForSubmitters.SubmissionClosed : CallStatusForSubmitters.Submitted;
                    }

                    if (!allowAdmin && allowView)
                    {
                        View.SetActionUrl(CallStandardAction.List, RootObject.ViewCalls(type, CallStandardAction.List, View.PreloadIdOtherCommunity, fromView));
                    }
                    else if (allowAdmin)
                    {
                        View.SetActionUrl(CallStandardAction.Manage, RootObject.ViewSubmissions(type, idCall, idSubmission, idRevision, fromView, View.PreloadFilterSubmission, View.PreloadOrderSubmission, View.PreloadAscending, View.PreloadPageIndex, View.PreloadPageSize));
                    }

                    if (submission.Deleted != BaseStatusDeleted.None && !allowAdmin)
                    {
                        View.DisplaySubmissionUnavailable();
                    }
                    else if (allowAdmin || allowView || (isAnonymousUser && submission.IsAnonymous && submission.UniqueId == View.PreloadedUniqueID))
                    {
                        LoadSubmission(call, submission, idUser, allowAdmin);
                    }
                    else
                    {
                        View.DisplayNoPermission(idCommunity, idModule);
                    }
                }
            }

            bool ShowSendIntegration = false;

            if (call.AdvacedEvaluation)
            {
                ShowSendIntegration = ServiceCall.ShowSendIntegration(idSubmission, View.CommissionId);
            }

            View.ShowHideSendIntegration(ShowSendIntegration);

            if (View.IsAdvance)
            {
                if (!ServiceCall.SignSubmissionIsNotExpired(idSubmission, idRevision, DateTime.Now, DateTime.Now))
                {
                    bool ShowMessage = (submission.Status == SubmissionStatus.waitforsignature);
                    View.DisplayOutOfTime("Expired", ShowMessage, false);
                }
            }
        }