Пример #1
0
        public void InitView()
        {
            Boolean isAnonymousUser = UserContext.isAnonymous;
            long    idCall          = View.PreloadIdCall;
            long    idSubmission    = View.PreloadIdSubmission;
            Int32   idUser          = UserContext.CurrentUserID;

            lm.Comol.Modules.CallForPapers.Domain.CallForPaperType type = ServiceCall.GetCallType(idCall);
            int idModule = (type == CallForPaperType.CallForBids) ? ServiceCall.ServiceModuleID() : ServiceRequest.ServiceModuleID();

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

            View.IdCall          = idCall;
            View.IdCallModule    = idModule;
            View.IdCallCommunity = idCommunity;
            View.IdSubmission    = idSubmission;
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout(RootObject.ViewSubmissionTableEvaluations(idSubmission, idCall, idCommunity));
            }
            else
            {
                if (call == null)
                {
                    View.DisplayUnknownCall(idCommunity, idModule, idCall, type);
                }
                else if (type == CallForPaperType.RequestForMembership)
                {
                    View.DisplayEvaluationUnavailable();
                }
                else
                {
                    ModuleCallForPaper module         = ServiceCall.CallForPaperServicePermission(idUser, idCommunity);
                    Boolean            allowAdmin     = ((module.ManageCallForPapers || module.Administration || ((module.CreateCallForPaper || module.EditCallForPaper) && call.Owner.Id == idUser)));
                    EvaluationType     evaluationType = ServiceCall.GetEvaluationType(idCall);
                    View.CurrentEvaluationType = evaluationType;
                    if (!allowAdmin)
                    {
                        View.DisplayNoPermissionToView();
                    }
                    else
                    {
                        dtoSubmissionRevision submission = ServiceCall.GetSubmissionWithRevisions(idSubmission, false);
                        if (submission == null)
                        {
                            View.DisplayUnknownSubmission(idCommunity, idModule, idSubmission, type);
                        }
                        else
                        {
                            LoadData(idCommunity, call, evaluationType, submission);
                        }
                    }
                }
            }
        }
Пример #2
0
        private void LoadSubmission(dtoCall call, dtoSubmissionRevision submission)
        {
            String owner       = "";
            String submittedBy = "";

            if (submission.Owner == null || submission.Owner.TypeID == (int)UserTypeStandard.Guest)
            {
                owner = View.AnonymousOwnerName;
            }
            else
            {
                owner = submission.Owner.SurnameAndName;
            }

            if (submission.SubmittedBy == null || submission.SubmittedBy.TypeID == (int)UserTypeStandard.Guest)
            {
                submittedBy = View.AnonymousOwnerName;
            }
            else
            {
                submittedBy = submission.SubmittedBy.SurnameAndName;
            }
            View.SetContainerName(call.Name, owner, submission.Type.Name, submittedBy);
            if (submission.Deleted != BaseStatusDeleted.None)
            {
                View.LoadSubmissionInfo(submission.Type.Name, owner, SubmissionStatus.deleted);
            }
            else if (!submission.SubmittedOn.HasValue)
            {
                View.LoadSubmissionInfo(submission.Type.Name, owner, submission.Status);
            }
            else if (submission.IdPerson == submission.IdSubmittedBy)
            {
                View.LoadSubmissionInfo(submission.Type.Name, owner, submission.Status, submission.SubmittedOn.Value);
            }
            else
            {
                View.LoadSubmissionInfo(submission.Type.Name, owner, submission.Status, submission.SubmittedOn.Value, submittedBy);
            }

            LoadSections(call.Id, submission);
        }
Пример #3
0
        //private void LoadSections(dtoBaseForPaper baseCall, dtoSubmissionRevision subRev, Boolean allowAdmin)
        //{
        //    BaseForPaper call = ServiceCall.GetCall(baseCall.Id);
        //    if (call != null)
        //    {
        //        LoadSections(call, subRev, allowAdmin);
        //    }
        //}
        private void LoadSections(BaseForPaper call, dtoSubmissionRevision submission)
        {
            //if (call.Type == CallForPaperType.CallForBids)
            //{
            //    List<dtoCallSubmissionFile> requiredFiles = ServiceCall.GetRequiredFiles(call, subRev.Type.Id, subRev.Id);
            //    Dictionary<long, FieldError> filesError = ServiceCall.GetSubmissionRequiredFileErrors(subRev.Id);
            //    if (requiredFiles != null && requiredFiles.Count > 0 && filesError != null)
            //        requiredFiles.ForEach(f => f.SetError(filesError));
            //}
            long idLastRevision = submission.GetIdLastActiveRevision();
            List <dtoCallSection <dtoSubmissionValueField> > sections = ServiceCall.GetSubmissionFields(call, submission.Type.Id, submission.Id, idLastRevision);
            Dictionary <long, FieldError> fieldsError = ServiceCall.GetSubmissionFieldErrors(submission.Id, idLastRevision);

            if (sections != null && sections.Count > 0 && fieldsError != null)
            {
                sections.ForEach(s => s.Fields.ForEach(f => f.SetError(fieldsError)));
            }
            View.LoadSections(sections);
            View.InitializeExportControl((submission.Owner != null && submission.Owner.Id == UserContext.CurrentUserID), (submission.Owner != null) ? submission.Owner.Id : 0, call.Id, submission.Id, idLastRevision, View.IdCallModule, View.IdCallCommunity, View.CallType);
        }
Пример #4
0
        private void LoadSubmission(dtoBaseForPaper call, dtoSubmissionRevision subRev, int idUser, Boolean allowAdmin)
        {
            if (!allowAdmin)
            {
                switch (call.Type)
                {
                case CallForPaperType.CallForBids:
                    dtoCall dtoC = ServiceCall.GetDtoCall(call.Id);
                    View.LoadCallInfo(dtoC);
                    break;

                case CallForPaperType.RequestForMembership:
                    dtoRequest dtoR = ServiceRequest.GetDtoRequest(call.Id);
                    View.LoadCallInfo(dtoR);
                    break;
                }
                View.LoadAttachments(ServiceCall.GetAvailableCallAttachments(call.Id, subRev.Type.Id));
            }
            View.IdSubmitterType = (subRev == null) ? 0 : subRev.Type.Id;
            String owner       = "";
            String submittedBy = "";

            if (subRev.Owner == null || subRev.Owner.TypeID == (int)UserTypeStandard.Guest)
            {
                owner = View.AnonymousOwnerName;
            }
            else
            {
                owner = subRev.Owner.SurnameAndName;
            }

            if (subRev.SubmittedBy == null || subRev.SubmittedBy.TypeID == (int)UserTypeStandard.Guest)
            {
                submittedBy = View.AnonymousOwnerName;
            }
            else
            {
                submittedBy = subRev.SubmittedBy.SurnameAndName;
            }

            if (subRev.Deleted != BaseStatusDeleted.None)
            {
                View.LoadSubmissionInfo(subRev.Type.Name, owner, SubmissionStatus.deleted);
            }
            else if (!subRev.SubmittedOn.HasValue)
            {
                View.LoadSubmissionInfo(subRev.Type.Name, owner, subRev.Status);
            }
            else if (subRev.IdPerson == subRev.IdSubmittedBy)
            {
                View.LoadSubmissionInfo(subRev.Type.Name, owner, subRev.Status, subRev.SubmittedOn.Value);
            }
            else
            {
                View.LoadSubmissionInfo(subRev.Type.Name, owner, subRev.Status, subRev.SubmittedOn.Value, submittedBy);
            }

            LoadSections(call, subRev, allowAdmin);


            //Gestione firme
            if (!call.AttachSign)
            {
                View.HideSignSubmission();
            }
            else
            {
                ModuleLink mLink = ServiceCall.GetSignModuleLink(call.Id, (View.IdRevision > 0) ? View.IdRevision : View.PreloadedIdRevision);

                if (mLink != null)
                {
                    View.InitializeDownloadSign(mLink);
                }
                else
                {
                    if (UserContext.CurrentUserID == subRev.IdSubmittedBy)
                    {
                        //dtoSubmissionRevision subRev = Service.GetSubmissionWithRevisions(idSubmission, true);

                        View.InitSignSubmission((call.Community != null) ? call.Community.Id : 0);
                    }
                    else
                    {
                        View.ShowSignNotSubmitted();
                    }
                }
            }
        }
        public void InitView(Boolean forPublicCall)
        {
            long             idCall          = View.PreloadIdCall;
            Boolean          skinInitialized = false;
            dtoRequest       call            = null;
            CallForPaperType type            = Service.GetCallType(idCall);

            call = Service.GetDtoRequest(idCall);
            if (type == CallForPaperType.None || call == null)
            {
                type = CallForPaperType.RequestForMembership;
            }
            View.CallType = type;
            int idCommunity = SetCallCurrentCommunity(call);
            int idModule    = Service.ServiceModuleID();

            Boolean hasPermissionToSubmit = Service.IsCallAvailableByUser(idCall, UserContext.CurrentUserID);

            if (call == null)
            {
                View.LoadUnknowCall(idCommunity, idModule, idCall, type);
            }
            else if (UserContext.isAnonymous && !forPublicCall)
            {
                if (call.IsPublic)
                {
                    View.GoToUrl(RootObject.SubmitToCallBySubmitterType(type, idCall, call.IsPublic, View.PreloadedIdSubmission, View.PreloadedIdSubmitter, View.FromPublicList, View.PreloadView, View.PreloadIdOtherCommunity));
                }
                else
                {
                    View.DisplaySessionTimeout();
                }
            }
            else if (UserContext.isAnonymous && forPublicCall && !call.IsPublic)
            {
                View.DisplayCallUnavailableForPublic();
            }
            else if (!hasPermissionToSubmit && call.IsPublic && forPublicCall == false)
            {
                View.GoToUrl(RootObject.SubmitToCallBySubmitterType(type, idCall, call.IsPublic, View.IdSubmission, View.PreloadedIdSubmitter, View.FromPublicList, View.PreloadView, View.PreloadIdOtherCommunity));
            }
            else
            {
                int        idUser     = UserContext.CurrentUserID;
                litePerson currenUser = GetCurrentUser(ref idUser);

                View.isAnonymousSubmission = forPublicCall;
                View.TryToComplete         = false;
                ModuleRequestForMembership module = Service.RequestForMembershipServicePermission(idUser, idCommunity);

                View.IdCallModule = idModule;
                if (call == null)
                {
                    View.LoadUnknowCall(idCommunity, idModule, idCall, type);
                    if (module.ViewBaseForPapers)
                    {
                        if (View.FromPublicList)
                        {
                            View.SetActionUrl(CallStandardAction.List, RootObject.PublicCollectorCalls(CallForPaperType.RequestForMembership, idCall, View.PreloadIdCommunity));
                        }
                        else if (!UserContext.isAnonymous)
                        {
                            View.SetActionUrl(CallStandardAction.List, RootObject.ViewCalls(idCall, CallForPaperType.RequestForMembership, CallStandardAction.List, (module.ViewBaseForPapers) ? idCommunity : View.PreloadIdOtherCommunity, View.PreloadView));
                        }
                    }
                }
                else if (call.Status <= CallForPaperStatus.Published || call.Status == CallForPaperStatus.SubmissionClosed || call.Status == CallForPaperStatus.SubmissionsLimitReached)
                {
                    View.DisplayCallUnavailable(call.Status);
                    if (module.ViewBaseForPapers)
                    {
                        if (View.FromPublicList)
                        {
                            View.SetActionUrl(CallStandardAction.List, RootObject.PublicCollectorCalls(CallForPaperType.RequestForMembership, idCall, View.PreloadIdCommunity));
                        }
                        else if (!UserContext.isAnonymous)
                        {
                            View.SetActionUrl(CallStandardAction.List, RootObject.ViewCalls(idCall, CallForPaperType.RequestForMembership, CallStandardAction.List, (module.ViewBaseForPapers) ? idCommunity : View.PreloadIdOtherCommunity, View.PreloadView));
                        }
                    }
                    if (forPublicCall)
                    {
                        View.InitializeView(Service.GetExternalContext(idCall), Service.CallWithFileToUpload(idCall, 0));
                        skinInitialized = true;
                    }
                }
                else if (module.ViewBaseForPapers || call.IsPublic || hasPermissionToSubmit)
                {
                    long idSubmission = View.PreloadedIdSubmission;
                    View.IdCall         = idCall;
                    View.CallRepository = call.GetRepositoryIdentifier();
                    if (module.ViewBaseForPapers || hasPermissionToSubmit)
                    {
                        if (View.FromPublicList)
                        {
                            View.SetActionUrl(CallStandardAction.List, RootObject.PublicCollectorCalls(CallForPaperType.RequestForMembership, idCall, View.PreloadIdCommunity));
                        }
                        else if (!UserContext.isAnonymous)
                        {
                            View.SetActionUrl(CallStandardAction.List, RootObject.ViewCalls(idCall, CallForPaperType.RequestForMembership, CallStandardAction.List, (module.ViewBaseForPapers) ? idCommunity : View.PreloadIdOtherCommunity, View.PreloadView));
                        }
                    }

                    // Find active submission
                    dtoSubmissionRevision submission = null;
                    if (forPublicCall && UserContext.isAnonymous)
                    {
                        submission = Service.GetActiveUserSubmission(idCall, UserContext.CurrentUserID, idSubmission, View.PreloadedUniqueID);
                        if (submission != null && submission.Owner.Id != idUser)
                        {
                            submission = null;
                        }
                    }
                    else
                    {
                        submission = Service.GetActiveUserSubmission(idCall, UserContext.CurrentUserID, idSubmission);
                    }


                    if (forPublicCall)
                    {
                        View.InitializeView(Service.GetExternalContext(idCall), Service.CallWithFileToUpload(idCall, 0));
                        skinInitialized = true;
                    }
                    else
                    {
                        SubmitterType submitter = null;
                        if (submission != null)
                        {
                            submitter = Service.GetSubmitterType(submission.Type.Id);
                        }
                        else
                        {
                            submitter = Service.GetSubmitterType(View.PreloadedIdSubmitter);
                        }

                        if (idSubmission == 0 && submitter != null && submitter.AllowMultipleSubmissions && Service.GetSubmissionCountBySubmitter(idCall, UserContext.CurrentUserID, submitter.Id) < submitter.MaxMultipleSubmissions)
                        {
                            submission = null;
                        }
                        View.InitializeView(Service.CallWithFileToUpload(idCall, (submission == null) ? 0 : submission.Type.Id));
                    }

                    DateTime InitTime = DateTime.Now;
                    if (call.StartDate > InitTime)
                    {
                        View.DisplaySubmissionTimeBefore(call.StartDate);
                    }
                    else if ((submission == null && !call.AllowSubmission(InitTime)) || (submission != null && submission.ExtensionDate.HasValue && call.AllowLateSubmission(InitTime, submission.ExtensionDate.Value)))
                    {
                        View.DisplaySubmissionTimeAfter(call.EndDate);
                    }
                    else if (submission != null && (submission.Deleted != BaseStatusDeleted.None || (submission.Status != SubmissionStatus.none && submission.Status != SubmissionStatus.draft)))
                    {
                        if (forPublicCall)
                        {
                            View.GoToUrl(RootObject.ViewSubmission(call.Type, call.Id, submission.Id, submission.UniqueId, true, View.FromPublicList, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity, 0));
                        }
                        else if (!UserContext.isAnonymous)
                        {
                            View.GoToUrl(RootObject.ViewSubmission(call.Type, call.Id, submission.Id, View.FromPublicList, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity, 0));
                        }
                    }
                    else if (submission != null && submission.Revisions.Where(r => r.Type != RevisionType.Original).Any())
                    {
                        if (!forPublicCall || (forPublicCall && !UserContext.isAnonymous))
                        {
                            View.GoToUrl(RootObject.UserReviewCall(call.Type, call.Id, submission.Id, submission.GetIdWorkingRevision(), CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity));
                        }
                        else
                        {
                            View.DisplayCallUnavailableForPublic();
                        }
                    }
                    else
                    {
                        idSubmission = (submission == null) ? 0 : submission.Id;
                        long idRevision = (submission == null) ? 0 : submission.GetIdOriginal();
                        View.IdRevision   = idRevision;
                        View.IdSubmission = idSubmission;

                        View.AllowDeleteSubmission = false;
                        Boolean allowSave = false;
                        Boolean allowCompleteSubmission = false;
                        LoadCall(call, submission);

                        View.AllowSubmitterChange = false;
                        if (module.AddSubmission || call.IsPublic || hasPermissionToSubmit)
                        {
                            View.AllowDeleteSubmission = (submission != null && submission.Deleted == BaseStatusDeleted.None && submission.Status == SubmissionStatus.draft);
                            allowCompleteSubmission    = (submission != null && submission.Deleted == BaseStatusDeleted.None && submission.Status == SubmissionStatus.draft);
                            allowSave      = (submission != null && submission.Deleted == BaseStatusDeleted.None && submission.Status == SubmissionStatus.draft);
                            View.AllowSave = allowSave;
                            View.AllowCompleteSubmission = allowCompleteSubmission;
                            if (submission == null)
                            {
                                View.IdSubmission         = 0;
                                View.AllowSubmitterChange = true;
                                View.SendStartSubmission(idCommunity, idModule, idCall, ModuleRequestForMembership.ActionType.StartSubmission);
                            }
                            else
                            {
                                View.InitSubmissionTime = InitTime;
                                //if (submission.Status >= SubmissionStatus.submitted && viewList == CallStatusForSubmitters.SubmissionOpened)
                                //    viewList = CallStatusForSubmitters.Submitted;
                                View.AllowSubmitterSelection = false;
                                View.IdSubmission            = submission.Id;
                                LoadSections(idCall, submission.Type.Id, submission.Id, idRevision);
                                View.SendUserAction(idCommunity, idModule, submission.Id, ModuleRequestForMembership.ActionType.ViewSubmission);
                            }
                        }
                        else
                        {
                            View.AllowSave = allowSave;
                            View.AllowCompleteSubmission = allowCompleteSubmission;
                            if (idSubmission == 0)
                            {
                                View.DisableSubmitterTypesSelection();
                            }
                        }
                    }
                }
                else
                {
                    View.DisplayNoPermission(idCommunity, idModule);
                }
            }
            if (forPublicCall && !skinInitialized)
            {
                View.InitializeEmptyView();
            }
        }
Пример #6
0
        public void InitView(Boolean forPublicCall)
        {
            Boolean isAnonymousUser = UserContext.isAnonymous;
            long    idCall          = View.PreloadIdCall;
            long    idEvaluation    = View.PreloadedIdEvaluation;
            Int32   idUser          = UserContext.CurrentUserID;

            lm.Comol.Modules.CallForPapers.Domain.CallForPaperType type = ServiceCall.GetCallType(idCall);
            int idModule = (type == CallForPaperType.CallForBids) ? ServiceCall.ServiceModuleID() : ServiceRequest.ServiceModuleID();

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


            View.IdCall          = idCall;
            View.IdCallModule    = idModule;
            View.IdCallCommunity = idCommunity;
            View.IdEvaluation    = idEvaluation;
            View.CallType        = type;



            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout(RootObject.EvaluateSubmission(idCall, View.PreloadIdCommunity, View.PreloadedIdEvaluation));
            }
            if (call == null)
            {
                View.DisplayUnknownCall(idCommunity, idModule, idCall, type);
            }
            else if (type == CallForPaperType.RequestForMembership)
            {
                View.DisplayEvaluationUnavailable();
            }
            else
            {
                bool canEvaluate = true;
                //Evantualmente aggiungere i tag anche sulle vecchie commissioni...
                string tags = (call.AdvacedEvaluation) ?
                              ServiceCall.TagGetForEvaluation(idEvaluation, idCall, ref canEvaluate) :
                              call.Tags;

                if (call.AdvacedEvaluation && !canEvaluate)
                {
                    View.DisplayEvaluationUnavailable();
                }

                View.BindTag(tags);

                ModuleCallForPaper module        = ServiceCall.CallForPaperServicePermission(idUser, idCommunity);
                Boolean            allowEvaluate = false;
                Boolean            allowAdmin    = ((module.ManageCallForPapers || module.Administration || ((module.CreateCallForPaper || module.EditCallForPaper) && call.Owner.Id == idUser)));

                Boolean isEvaluator =
                    (call.AdvacedEvaluation) ?
                    ServiceCall.isEvaluationOwner(idEvaluation, UserContext.CurrentUserID) :
                    Service.isEvaluationOwner(idEvaluation, UserContext.CurrentUserID);

                allowEvaluate = isEvaluator; //(isEvaluator || module.ManageCallForPapers || module.Administration || ((module.CreateCallForPaper || module.EditCallForPaper) && call.Owner.Id == idUser));

                if (!allowEvaluate)
                {
                    View.DisplayEvaluationUnavailable();
                }
                else
                {
                    lm.Comol.Modules.CallForPapers.Domain.Evaluation.dtoEvaluation evaluation =
                        (call.AdvacedEvaluation) ?
                        ServiceCall.GetFullEvaluation(idEvaluation, View.AnonymousOwnerName, View.UnknownDisplayname):
                        Service.GetFullEvaluation(idEvaluation, View.AnonymousOwnerName, View.UnknownDisplayname);
                    if (evaluation == null)
                    {
                        View.DisplayUnknownEvaluation(idCommunity, idModule, idEvaluation);
                    }
                    else
                    {
                        View.IdEvaluator = evaluation.IdEvaluator;
                        dtoSubmissionRevision submission = ServiceCall.GetSubmissionWithRevisions(evaluation.IdSubmission, true);
                        if (submission == null)
                        {
                            View.DisplayUnknownSubmission(idCommunity, idModule, evaluation.IdSubmission, type);
                        }
                        else
                        {
                            LoadData(idCall, evaluation, submission);
                        }
                    }
                }
            }
        }
Пример #7
0
        //private int SetCallCurrentCommunity(dtoBaseForPaper call)
        //{
        //    int idCommunity = 0;
        //    Community currentCommunity = CurrentManager.GetCommunity(this.UserContext.CurrentCommunityID);
        //    Community community = null;
        //    if (call != null)
        //        idCommunity = (call.IsPortal) ? 0 : (call.Community != null) ? call.Community.Id : 0;


        //    community = CurrentManager.GetCommunity(idCommunity);
        //    if (community != null){}
        //       // View.SetContainerName(community.Name, (call != null) ? call.Name : "");
        //    else if (currentCommunity != null)
        //    {
        //        idCommunity = this.UserContext.CurrentCommunityID;
        //       // View.SetContainerName(currentCommunity.Name, (call != null) ? call.Name : "");
        //    }
        //    else
        //    {
        //        idCommunity = 0;
        //        //View.SetContainerName(View.Portalname, (call != null) ? call.Name : "");
        //    }
        //    View.IdCallCommunity = idCommunity;
        //    return idCommunity;
        //}
        private void LoadData(long idCall, lm.Comol.Modules.CallForPapers.Domain.Evaluation.dtoEvaluation evaluation, dtoSubmissionRevision submission)
        {
            // LOAD CALL INFO
            //dtoCall dtoC = ServiceCall.GetDtoCall(idCall;
            //                View.LoadCallInfo(dtoC);
            //View.LoadAttachments(ServiceCall.GetAvailableCallAttachments(idCall, submission.Type.Id));
            //Boolean submissionSubmitted = (submission.Status == SubmissionStatus.accepted);
            dtoCall call = ServiceCall.GetDtoCall(idCall);

            LoadSubmission(call, submission);
            LoadEvaluationData(call, evaluation);
        }
Пример #8
0
        public void InitView()
        {
            Boolean isAnonymousUser = UserContext.isAnonymous;
            long    idCall          = View.PreloadIdCall;
            long    idEvaluation    = View.PreloadIdEvaluation;
            long    idSubmission    = View.PreloadIdSubmission;
            long    idEvaluator     = View.PreloadIdEvaluator;
            Int32   idUser          = UserContext.CurrentUserID;

            lm.Comol.Modules.CallForPapers.Domain.CallForPaperType type = ServiceCall.GetCallType(idCall);
            int idModule = (type == CallForPaperType.CallForBids) ? ServiceCall.ServiceModuleID() : ServiceRequest.ServiceModuleID();

            dtoBaseForPaper baseCall    = ServiceCall.GetDtoBaseCall(idCall);
            int             idCommunity = GetCurrentCommunity(baseCall);


            View.IdCall          = idCall;
            View.IdCallModule    = idModule;
            View.IdCallCommunity = idCommunity;
            View.IdEvaluation    = idEvaluation;
            View.IdSubmission    = idSubmission;
            View.IdEvaluator     = idEvaluator;
            View.CallType        = type;
            DisplayEvaluations dEvaluation = DisplayEvaluations.None;

            if (idEvaluation > 0)
            {
                dEvaluation = DisplayEvaluations.Single;
            }
            else if (idEvaluator > 0)
            {
                dEvaluation = DisplayEvaluations.ForUser;
            }
            else if (idSubmission > 0)
            {
                dEvaluation = DisplayEvaluations.ForSubmission;
            }

            if (UserContext.isAnonymous)
            {
                switch (dEvaluation)
                {
                case DisplayEvaluations.Single:
                    View.DisplaySessionTimeout(RootObject.ViewSingleEvaluation(idEvaluation, idSubmission, idCall, idCommunity, View.AdvCommId));
                    break;

                case DisplayEvaluations.ForUser:
                    View.DisplaySessionTimeout(RootObject.ViewUserEvaluations(idEvaluator, idSubmission, idCall, idCommunity, View.AdvCommId));
                    break;

                default:
                    View.DisplaySessionTimeout(RootObject.ViewSubmissionEvaluations(idSubmission, idCall, idCommunity, View.AdvCommId));
                    break;
                }
            }
            else
            {
                if (baseCall == null)
                {
                    View.DisplayUnknownCall(idCommunity, idModule, idCall, type);
                }
                else if (type == CallForPaperType.RequestForMembership)
                {
                    View.DisplayEvaluationUnavailable();
                }
                else if (dEvaluation == DisplayEvaluations.None)
                {
                    View.DisplayNoEvaluationsToView();
                }
                else
                {
                    ModuleCallForPaper module     = ServiceCall.CallForPaperServicePermission(idUser, idCommunity);
                    Boolean            allowAdmin = ((module.ManageCallForPapers || module.Administration || ((module.CreateCallForPaper || module.EditCallForPaper) && baseCall.Owner.Id == idUser)));

                    if (!allowAdmin && !Service.isEvaluationOwner(idEvaluator, idEvaluation, idSubmission, dEvaluation, UserContext.CurrentUserID))
                    {
                        View.DisplayNoPermissionToView();
                    }
                    else
                    {
                        dtoSubmissionRevision submission = ServiceCall.GetSubmissionWithRevisions(idSubmission, false);
                        if (submission == null)
                        {
                            View.DisplayUnknownSubmission(idCommunity, idModule, idSubmission, type);
                        }
                        else
                        {
                            dtoCall call = ServiceCall.GetDtoCall(idCall);
                            if (call != null)
                            {
                                View.CurrentEvaluationType = call.EvaluationType;
                                if (call.EvaluationType == EvaluationType.Dss)
                                {
                                    InitializeDssInfo(idCall);
                                }
                                else
                                {
                                    View.HideDssWarning();
                                }
                                LoadData(dEvaluation, idCommunity, call, submission, idEvaluation, idEvaluator);
                            }
                            else
                            {
                                View.DisplayUnknownCall(idCommunity, idModule, idCall, type);
                            }
                        }
                    }
                }
            }
        }
Пример #9
0
        private void LoadData(DisplayEvaluations display, Int32 idCommunity, dtoCall call, dtoSubmissionRevision submission, long idEvaluation, long idEvaluator)
        {
            View.CurrentDisplay = display;
            List <dtoCommitteeEvaluationInfo> committees = null;
            String     owner       = (submission.IsAnonymous || submission.Owner == null) ? View.AnonymousDisplayName : submission.Owner.SurnameAndName;
            litePerson submitter   = CurrentManager.GetLitePerson(submission.IdSubmittedBy);
            String     submittedBy = (submission.IdPerson == submission.IdSubmittedBy) ? "" : (submitter == null || submitter.TypeID == (int)UserTypeStandard.Guest) ? View.AnonymousDisplayName : submitter.SurnameAndName;

            View.LoadSubmissionInfo(owner, call.Name, submission.SubmittedOn, submittedBy);
            View.AllowPrint = true;

            if (call.AdvacedEvaluation)
            {
                View.SetViewEvaluationUrl("");
            }
            else
            {
                View.SetViewEvaluationUrl(RootObject.ViewSubmissionTableEvaluations(submission.Id, call.Id, idCommunity));
            }

            View.CommitteeIsFuzzy = Service.GetCommitteeDssMethodIsFuzzy(call.Id);
            switch (display)
            {
            case DisplayEvaluations.ForSubmission:
                committees = (call.AdvacedEvaluation) ?
                             ServiceCall.GetCommitteesInfoForSubmission(submission.Id, call.Id, View.AdvCommId)
                        : Service.GetCommitteesInfoForSubmission(submission.Id, call.Id);
                View.LoadCommitteesStatus(committees, display);

                View.LoadEvaluations(
                    (call.AdvacedEvaluation) ?
                    ServiceCall.GetSubmissionEvaluationsDispItem(call.Id, submission.Id, View.AdvCommId, View.UnknonwUserName) :
                    Service.GetSubmissionEvaluations(submission.Id, call.Id, View.UnknonwUserName)
                    );

                break;

            case DisplayEvaluations.ForUser:
                committees = (call.AdvacedEvaluation) ?
                             ServiceCall.GetCommitteesInfoForEvaluator(idEvaluator, View.AdvCommId) :
                             Service.GetCommitteesInfoForEvaluator(idEvaluator);

                CallEvaluator evaluator = CurrentManager.Get <CallEvaluator>(idEvaluator);
                if (committees != null)
                {
                    View.LoadEvaluatorInfo((evaluator == null || evaluator.Person == null) ? View.AnonymousDisplayName : evaluator.Person.SurnameAndName, committees.Count);
                }
                else
                {
                    View.LoadEvaluatorInfo((evaluator == null || evaluator.Person == null) ? View.AnonymousDisplayName : evaluator.Person.SurnameAndName, 0);
                }

                View.LoadEvaluations(Service.GetEvaluationsInfo(idEvaluator, submission.Id, View.AnonymousDisplayName, View.UnknonwUserName));
                View.LoadCommitteesStatus(committees, display);
                break;

            case DisplayEvaluations.Single:
                lm.Comol.Modules.CallForPapers.Domain.Evaluation.dtoEvaluation evaluation =
                    (call.AdvacedEvaluation) ?
                    ServiceCall.GetFullEvaluation(idEvaluation, View.AnonymousDisplayName, View.UnknonwUserName):
                    Service.GetFullEvaluation(idEvaluation, View.AnonymousDisplayName, View.UnknonwUserName);

                if (evaluation == null)
                {
                    View.DisplayUnknownEvaluation(View.IdCallCommunity, View.IdCallModule, idEvaluation);
                }
                else
                {
                    dtoCommitteeEvaluation result = new dtoCommitteeEvaluation()
                    {
                        Evaluation  = evaluation,
                        IdCommittee = evaluation.IdCommittee
                    };

                    committees = (call.AdvacedEvaluation) ?
                                 ServiceCall.GetCommitteesInfoForEvaluator(evaluation.IdEvaluator):
                                 Service.GetCommitteesInfoForEvaluator(evaluation.IdEvaluator);

                    if (committees.Where(c => c.IdCommittee == evaluation.IdCommittee).Any())
                    {
                        committees.Where(c => c.IdCommittee == evaluation.IdCommittee).FirstOrDefault().Status = evaluation.Status;
                        result.Status = evaluation.Status;
                        result.Name   = committees.Where(c => c.IdCommittee == evaluation.IdCommittee).FirstOrDefault().Name;
                    }

                    View.LoadCommitteesStatus(committees.Where(c => c.IdCommittee == evaluation.IdCommittee).ToList(), display);
                    if (committees != null)
                    {
                        View.LoadEvaluatorInfo(evaluation.EvaluatorName, committees.Count);
                    }
                    else
                    {
                        View.LoadEvaluatorInfo(evaluation.EvaluatorName, 0);
                    }
                    View.LoadEvaluation(result);
                }
                break;
            }
        }
Пример #10
0
        private void LoadData(Int32 idCommunity, dtoBaseForPaper call, EvaluationType type, dtoSubmissionRevision submission)
        {
            List <dtoCommitteeEvaluationInfo> committees = Service.GetCommitteesInfoForSubmission(submission.Id, call.Id);

            View.CommitteesCount = committees.Count;
            String     owner       = (submission == null || (submission != null && (submission.IsAnonymous))) ? View.AnonymousDisplayName : ((submission.Owner != null) ? submission.Owner.SurnameAndName : View.UnknownDisplayname);
            litePerson submitter   = CurrentManager.GetLitePerson(submission.IdSubmittedBy);
            String     submittedBy = (submission.IdPerson == submission.IdSubmittedBy) ? "" : (submitter == null || submitter.TypeID == (int)UserTypeStandard.Guest) ? View.AnonymousDisplayName : submitter.SurnameAndName;

            View.SetViewEvaluationsUrl(RootObject.ViewSubmissionEvaluations(submission.Id, call.Id, idCommunity));
            // View.SetViewSubmissionUrl(RootObject.ViewSubmissionAsManager(

            View.LoadSubmissionInfo(call.Name, owner, submission.SubmittedOn, submittedBy, committees, (committees == null || !committees.Any()) ? 0 : committees[0].IdCommittee);
            if (type == EvaluationType.Dss)
            {
                InitializeDssInfo(call.Id);
            }
            LoadEvaluations(submission.Id, call.Id, type, View.IdCurrentCommittee, committees.Count);
        }
Пример #11
0
        public void InitView()
        {
            Boolean isAnonymousUser = UserContext.isAnonymous;
            long    idCall          = View.PreloadIdCall;

            CallForPaperType type         = Service.GetCallType(idCall);
            long             idSubmission = View.PreloadedIdSubmission;
            long             idRevision   = View.PreloadedIdRevision;

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

            View.CallType = type;

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

            View.IdCall          = idCall;
            View.IdCallModule    = idModule;
            View.IdCallCommunity = idCommunity;

            View.IdSubmission = idSubmission;
            if (submission != null && (idRevision == 0 && submission.Revisions.Where(r => r.Id == idRevision && r.AllowSave).Any()))
            {
                idRevision = submission.GetIdWorkingRevision();
            }
            View.IdRevision = idRevision;

            if (isAnonymousUser)
            {
                View.DisplaySessionTimeout();
            }
            else if (submission == null)
            {
                View.DisplayRevisionUnknown();
                if (View.PreloadFromManagement)
                {
                    View.SetActionUrl(RootObject.ViewSubmissions(type, idCall, idSubmission, idRevision, View.PreloadView, View.PreloadFilterSubmission, View.PreloadOrderSubmission, View.PreloadAscending, View.PreloadPageIndex, View.PreloadPageSize));
                }
                else
                {
                    View.SetActionUrl(RootObject.ViewRevisions(idRevision, type, View.PreloadAction, idCommunity, View.PreloadView));
                }
            }
            else if (submission != null && (idRevision == 0))
            {
                View.DisplayRevisionUnavailable();
                View.SetActionUrl(RootObject.ViewRevisions(idRevision, type, View.PreloadAction, idCommunity, View.PreloadView));
            }
            else
            {
                int        idUser     = UserContext.CurrentUserID;
                litePerson currenUser = GetCurrentUser(ref idUser);
                Boolean    allowView  = false;

                switch (type)
                {
                case CallForPaperType.CallForBids:
                    ModuleCallForPaper module = Service.CallForPaperServicePermission(idUser, idCommunity);
                    allowView = (submission.Owner.Id == idUser || module.ManageCallForPapers || module.Administration || ((module.CreateCallForPaper || module.EditCallForPaper) && call.Owner.Id == idUser));
                    break;

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

                if (idRevision == 0)
                {
                    idRevision = submission.GetIdLastActiveRevision();
                }
                dtoRevisionRequest rev = Service.GetRevisionRequest(idRevision, true);
                if (rev == null)
                {
                    View.DisplayRevisionUnknown();
                }
                else if (allowView)
                {
                    switch (type)
                    {
                    case CallForPaperType.CallForBids:
                        View.SendUserAction(idCommunity, idModule, idRevision, ModuleCallForPaper.ActionType.ViewRevision);
                        break;

                    case CallForPaperType.RequestForMembership:
                        View.SendUserAction(idCommunity, idModule, idRevision, ModuleRequestForMembership.ActionType.ViewRevision);
                        break;
                    }
                    LoadSubmission(call, submission, rev);
                }
                else
                {
                    View.DisplayNoPermission(idCommunity, idModule);
                }
                if (allowView)
                {
                    if (View.PreloadFromManagement)
                    {
                        View.SetActionUrl(RootObject.ViewSubmissions(type, idCall, idSubmission, idRevision, View.PreloadView, View.PreloadFilterSubmission, View.PreloadOrderSubmission, View.PreloadAscending, View.PreloadPageIndex, View.PreloadPageSize));
                    }
                    else
                    {
                        View.SetActionUrl(RootObject.ViewRevisions(idRevision, type, View.PreloadAction, idCommunity, View.PreloadView));
                    }
                }
            }
        }