private void LoadCall(dtoRequest dto) { BaseForPaper call = Service.GetCall(dto.Id); if (call != null) { long idSubmitter = 0; View.LoadCallInfo(dto); List <dtoSubmitterType> submitters = Service.GetCallAvailableSubmittersType(call); View.HasMultipleSubmitters = (submitters.Count > 0); if (submitters.Count == 1) { idSubmitter = submitters[0].Id; } View.LoadSubmitterTypes(submitters); if (idSubmitter != 0 && submitters.Where(s => s.Id == idSubmitter).Any()) { if (submitters.Count > 1) { View.SetSubmitterName(submitters.Where(s => s.Id == idSubmitter).FirstOrDefault().Name); } else { View.SetGenericSubmitterName(); } } View.LoadAttachments(Service.GetAvailableCallAttachments(call.Id, idSubmitter)); } }
public void LoadSections(long idCall, long idSubmitter, long idSubmission, long idRevision) { BaseForPaper call = Service.GetCall(idCall); if (call != null) { SubmitterType submitter = Service.GetSubmitterType(idSubmitter); if (View.HasMultipleSubmitters) { if (submitter != null) { View.SetSubmitterName(submitter.Name); } else { View.SetSubmitterName(""); idSubmitter = 0; } } else if (submitter == null) { idSubmitter = 0; } LoadSections(call, idSubmitter, idSubmission, idRevision, null); } }
private void LoadTemplate(long idCall) { BaseForPaper call = CallService.GetCall(idCall); if (call == null) { View.LoadUnknowCall(View.IdCommunity, View.IdCallModule, idCall, View.CallType); } else { dtoManagerTemplateMail template = CallService.GetManagerTemplateMail(idCall); if (template == null) { View.DisplayNoTemplate(); template = View.GetDefaultTemplate; litePerson person = CurrentManager.GetLitePerson(UserContext.CurrentUserID); template.NotifyTo = (call.CreatedBy != null) ? call.CreatedBy.Mail : ""; if (person != null && call.CreatedBy != null && person.Id != call.CreatedBy.Id) { template.NotifyTo = (string.IsNullOrEmpty(template.NotifyTo)) ? "" : ";" + person.Mail; } } View.LoadTemplate(template); } }
private iTextSharp5.text.pdf.PdfPTable WriteCallHeader(BaseForPaper call, SubmitterType submitter, Dictionary <SubmissionTranslations, string> translations) { iTextSharp5.text.pdf.PdfPTable table = GetTable(1); table.HorizontalAlignment = Element.ALIGN_CENTER; String callName = ""; switch (call.Type) { case CallForPaperType.CallForBids: if (string.IsNullOrEmpty(call.Edition)) { callName = String.Format(translations[SubmissionTranslations.CallTitle], "\r\n" + call.Name); } else { callName = String.Format(translations[SubmissionTranslations.CallTitleAndEdition], "\r\n" + call.Name, call.Edition); } break; case CallForPaperType.RequestForMembership: callName = String.Format(translations[SubmissionTranslations.RequestTitle], "\r\n" + call.Name); break; } PdfPCell titleCell = new PdfPCell(new Phrase(callName, GetFont(ItemType.Title))); titleCell.Border = 0; table.AddCell(titleCell); return(table); }
private void VirtualDelete(long idCall, Boolean delete) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { int idCommunity = 0; BaseForPaper call = Service.VirtualDeleteCall(idCall, UserContext.CurrentUserID, delete); if (call != null) { if (!call.IsPortal && call.Community != null) { idCommunity = call.Community.Id; } View.SendUserAction(idCommunity, Service.ServiceModuleID(), idCall, (delete) ? ModuleRequestForMembership.ActionType.VirtualDeleteRequest : ModuleRequestForMembership.ActionType.VirtualUndeleteRequest); } idCommunity = View.IdCallCommunity; CallStandardAction action = View.CurrentAction; ModuleRequestForMembership module = Service.RequestForMembershipServicePermission(UserContext.CurrentUserID, idCommunity); FilterCallVisibility filter = View.CurrentFilter; InitializeView(action, module, idCommunity, View.CurrentView); View.CurrentFilter = filter; LoadCalls(module, action, idCommunity, View.CurrentView, View.Pager.PageIndex, currentPageSize); } }
private void LoadSections(BaseForPaper call, dtoSubmissionRevision subRev, Boolean allowAdmin) { 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)); } View.LoadRequiredFiles(requiredFiles); } List <dtoCallSection <dtoSubmissionValueField> > sections = ServiceCall.GetSubmissionFields(call, subRev.Type.Id, subRev.Id, View.IdRevision); Dictionary <long, FieldError> fieldsError = ServiceCall.GetSubmissionFieldErrors(subRev.Id, View.IdRevision); if (sections != null && sections.Count > 0 && fieldsError != null) { sections.ForEach(s => s.Fields.ForEach(f => f.SetError(fieldsError))); } View.LoadSections(sections); View.InitializeExportControl( (subRev.Owner != null && UserContext.CurrentUserID == subRev.Owner.Id), (subRev.Owner != null) ? subRev.Owner.Id : 0, call.Id, subRev.Id, View.IdRevision, View.IdCallModule, View.IdCallCommunity, View.CallType, subRev.Type.Id, subRev.Status == SubmissionStatus.draft); }
private void ExportSubmission(Document doc, BaseForPaper call, SubmitterType submitter, List <dtoCallSubmissionFile> requiredFiles, List <dtoCallSection <dtoSubmissionValueField> > sections, litePerson person, Dictionary <SubmissionTranslations, string> translations) { doc.Add(WriteCallHeader(call, submitter, translations)); doc.Add(GetWhiteParagraph(GetFont(ItemType.Paragraph))); doc.Add(GetWhiteParagraph(GetFont(ItemType.Paragraph))); ExportSubmission(doc, true, requiredFiles, sections, translations); }
private void LoadCommittees(long idCall, Boolean allowUseOfDssMethods) { BaseForPaper call = CallService.GetCall(idCall); if (call != null) { LoadCommittees(call, allowUseOfDssMethods); } }
public void LoadSections(long idCall, CallForPaperType type, long idSubmission, long idRevision, long idSubmitter, Boolean allowAdmin) { BaseForPaper call = ServiceCall.GetCall(idCall); if (call != null) { LoadSections(call, ServiceCall.GetSubmissionWithRevisions(idSubmission, true), allowAdmin); } }
public Document SubmissionToCompile(Boolean openCloseConnection, BaseForPaper call, SubmitterType submitter, String clientFilename, List <dtoCallSubmissionFile> requiredFiles, List <dtoCallSection <dtoSubmissionValueField> > sections, litePerson person, System.Web.HttpResponse webResponse, System.Web.HttpCookie cookie) { dtoExportSubmission settings = new dtoExportSubmission() { ClientFilename = clientFilename, PrintBy = person, RequiredFiles = requiredFiles, Sections = sections, Call = call, Submitter = submitter }; return(Submission(openCloseConnection, settings, webResponse, cookie)); }
public void LoadSections(long idCall, dtoSubmissionRevision subRev, Boolean allowAdmin) { BaseForPaper call = ServiceCall.GetCall(idCall); if (call != null) { LoadSections(call, subRev, allowAdmin); } }
private void LoadSections(long idCall, long idSubmission, dtoRevisionRequest rev) { BaseForPaper call = Service.GetCall(idCall); if (call != null) { LoadSections(call, idSubmission, rev); } }
private void LoadSections(long idCall) { BaseForPaper call = CallService.GetCall(idCall); if (call != null) { LoadSections(call); } }
private void LoadSections(dtoBaseForPaper baseCall, dtoSubmissionRevision subRev, Boolean allowAdmin) { BaseForPaper call = ServiceCall.GetCall(baseCall.Id); if (call != null) { LoadSections(call, subRev, allowAdmin); } }
private void LoadCommittees(long idCall) { BaseForPaper call = CallService.GetCall(idCall); if (call != null) { View.CommiteesWithEvaluationsCompleted = Service.GetIdCommitteesWithEvaluationCompleted(idCall); LoadCommittees(call); } }
private void LoadSections(BaseForPaper call, long idSubmitter, long idSubmission, long idRevision, Dictionary <long, FieldError> fieldsError) { List <dtoCallSection <dtoSubmissionValueField> > sections = Service.GetSubmissionFields(call, idSubmitter, idSubmission, idRevision); if (sections != null && sections.Count > 0 && View.TryToComplete && fieldsError != null) { sections.ForEach(s => s.Fields.ForEach(f => f.SetError(fieldsError))); } View.LoadSections(sections); }
private void LoadCall(dtoCall dto, dtoBaseSubmission submission, long defaultSubmitter) { View.LoadCallInfo(dto); BaseForPaper call = Service.GetCall(dto.Id); List <dtoSubmitterType> submitters = null; if (call != null) { submitters = Service.GetCallAvailableSubmittersType(call); View.HasMultipleSubmitters = (submitters.Count > 1); } if (submission == null) { if (call != null) { long idSubmitter = 0; if (submitters.Count == 1) { idSubmitter = submitters[0].Id; View.IdSelectedSubmitterType = idSubmitter; } else { idSubmitter = defaultSubmitter; View.LoadSubmitterTypes(submitters); } View.AllowSubmitterSelection = (submitters.Count > 1 && defaultSubmitter == 0); if (idSubmitter != 0 && submitters.Where(s => s.Id == idSubmitter).Any()) { if (submitters.Count > 1) { View.SetSubmitterName(submitters.Where(s => s.Id == idSubmitter).FirstOrDefault().Name); } else { View.SetGenericSubmitterName(); } } } } else { View.IdSelectedSubmitterType = submission.Type.Id; if (submitters != null && submitters.Count > 1) { View.SetSubmitterName(submission.Type.Name); } else { View.SetGenericSubmitterName(); } } View.LoadAttachments(Service.GetAvailableCallAttachments(dto.Id, (submission == null) ? 0 : submission.Type.Id)); }
private void LoadSections(BaseForPaper call, long idSubmitter, long idSubmission, long idRevision, Dictionary <long, FieldError> fieldsError) { View.LoadAttachments(Service.GetAvailableCallAttachments(call.Id, idSubmitter)); List <dtoCallSection <dtoSubmissionValueField> > sections = Service.GetSubmissionFields(call, idSubmitter, idSubmission, idRevision); if (sections != null && sections.Count > 0 && View.TryToComplete && fieldsError != null) { sections.ForEach(s => s.Fields.ForEach(f => f.SetError(fieldsError))); } View.LoadSections(sections.Where(s => s.Fields.Count > 0).OrderBy(s => s.DisplayOrder).ThenBy(s => s.Name).ToList()); }
public void AddFilesToItem(long idCall, CallForPaperType type) { if (UserContext.isAnonymous) { View.DisplayWorkingSessionExpired(); } else { BaseForPaper call = CallService.GetCall(idCall); Int32 idModule = (type == CallForPaperType.CallForBids ? CurrentIdCallModule : currentIdRequestModule); if (call == null) { View.DisplayCallNotFound(type); if (type == CallForPaperType.CallForBids) { View.SendUserAction(View.IdCallCommunity, idModule, idCall, 0, ModuleCallForPaper.ActionType.UploadFileToUnknownCall); } else { View.SendUserAction(View.IdCallCommunity, idModule, idCall, 0, ModuleRequestForMembership.ActionType.UploadFileToUnknownCall); } } else { List <lm.Comol.Core.FileRepository.Domain.dtoModuleUploadedItem> files = null; Int32 idObjectType = (Int32)ModuleCallForPaper.ObjectType.AttachmentFile; Int32 idObjAction = (Int32)ModuleCallForPaper.ActionType.DownloadCallForPaperFile; String moduleCode = ModuleCallForPaper.UniqueCode; if (type != CallForPaperType.CallForBids) { idObjectType = (Int32)ModuleRequestForMembership.ObjectType.AttachmentFile; idObjAction = (Int32)ModuleRequestForMembership.ActionType.DownloadCallFile; moduleCode = ModuleRequestForMembership.UniqueCode; } files = View.UploadFiles(moduleCode, idObjectType, idObjAction, false); if (files != null && files.Any(f => f.IsAdded)) { if (CallService.UploadAttachments(call, files.Where(f => f.IsAdded).ToList(), moduleCode, idModule, View.IdCallCommunity, idObjectType)) { View.DisplayItemsAdded(); } else { View.DisplayItemsNotAdded(); } } else { View.DisplayNoFilesToAdd(); } } } }
public List <lm.Comol.Core.Dss.Domain.Templates.dtoItemWeightBase> RequireCommitteesWeight(long idCall, Boolean fuzzyWeights, Boolean orderedWeights, List <dtoCommittee> committees) { BaseForPaper call = CallService.GetCall(idCall); if (call != null) { return(GetAvailableWeights(call, fuzzyWeights, orderedWeights, committees, true)); } else { return(new List <dtoItemWeightBase>()); } }
//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); }
private void LoadSections(BaseForPaper call) { View.LoadSubmitterTypes(CallService.GetCallAvailableSubmittersType(call)); List <dtoCallSection <dtoCallField> > sections = CallService.GetEditorSections(call); List <lm.Comol.Core.Wizard.NavigableWizardItem <WizardCallStep> > steps = RequestService.GetAvailableSteps(call.Id, WizardCallStep.SubmissionEditor, call.Type); //View.InitializeAddFieldControl(call.Id); if (sections == null || sections.Count == 0) { if (!CallService.isNewCall(call)) { View.DisplayError(EditorErrors.NoSections); } else { FieldsSection section = CallService.AddSection(call, View.DefaultSectionName, View.DefaultSectionDescription); if (section != null) { sections = new List <dtoCallSection <dtoCallField> >(); sections.Add(new dtoCallSection <dtoCallField>() { Id = section.Id, Description = section.Description, DisplayOrder = section.DisplayOrder, Name = section.Name }); View.LoadSections(sections); } } View.LoadWizardSteps(call.Id, call.Type, View.IdCommunity, steps); } else { View.LoadWizardSteps(call.Id, call.Type, View.IdCommunity, steps); View.LoadSections(sections); } if (steps.Where(s => s.Id == WizardCallStep.SubmittersType && (s.Status == Core.Wizard.WizardItemStatus.valid || s.Status == Core.Wizard.WizardItemStatus.warning)).Any()) { View.SetActionUrl(CallStandardAction.PreviewCall, RootObject.PreviewCall(call.Type, call.Id, View.IdCommunity, View.PreloadView)); } }
private void LoadSections(BaseForPaper call, long idSubmission, dtoRevisionRequest rev) { List <dtoCallSection <dtoSubmissionValueField> > sections = Service.GetSubmissionFields(Service.GetCall(View.IdCall), View.IdSubmitterType, idSubmission, rev.Id); Dictionary <long, FieldError> fieldsError = Service.GetSubmissionFieldErrors(idSubmission, View.IdRevision); if (sections != null && sections.Count > 0 && fieldsError != null) { sections.ForEach(s => s.Fields.ForEach(f => f.SetError(fieldsError))); } Boolean allowSelection = false; allowSelection = (rev.ItemsToReview.Count == 0 || !Service.RevisionIsReviewed(idSubmission, rev.Id, rev.ItemsToReview.Select(r => r.IdField).ToList())); sections.ForEach(s => s.Fields.ForEach(f => f.AllowSelection = allowSelection)); View.CurrentStatus = rev.Status; View.FieldsToCheck = rev.ItemsToReview.Select(i => i.IdField).ToList(); View.DisplayRevisionInfo(rev); View.InitializeExportControl((View.IdUserSubmitter == UserContext.CurrentUserID), View.IdUserSubmitter, call.Id, idSubmission, rev.Id, View.IdCallModule, View.IdCallCommunity, View.CallType); View.LoadSections(sections); }
public void CloneCall(long idCall, String prefix, String filePath, String thumbnailPath) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { int idCommunity = View.IdCallCommunity; int idUser = UserContext.CurrentUserID; CallStandardAction action = View.CurrentAction; ModuleRequestForMembership module = Service.RequestForMembershipServicePermission(idUser, idCommunity); if (module.CreateBaseForPaper || module.Administration || module.ManageBaseForPapers || module.EditBaseForPaper) { Boolean reloadPage = (View.CurrentView == CallStatusForSubmitters.Draft); BaseForPaper call = Service.CloneCall(idCall, idUser, idCommunity, prefix, filePath, thumbnailPath); if (call != null) { View.SendUserAction(idCommunity, Service.ServiceModuleID(), idCall, ModuleRequestForMembership.ActionType.CloneRequest); View.CloneSkinAssociation(idUser, Service.ServiceModuleID(), ((call.IsPortal || call.Community == null) ? 0 : call.Community.Id), idCall, call.Id, (Int32)ModuleRequestForMembership.ObjectType.RequestForMembership, typeof(RequestForMembership).FullName); } if (reloadPage || call == null) { FilterCallVisibility filter = View.CurrentFilter; InitializeView(action, module, idCommunity, View.CurrentView); View.CurrentFilter = filter; LoadCalls(module, action, idCommunity, View.CurrentView, View.Pager.PageIndex, currentPageSize); } else { View.GotoUrl(RootObject.ViewCalls(call.Id, CallForPaperType.RequestForMembership, View.CurrentAction, idCommunity, CallStatusForSubmitters.Draft)); } } else { View.DisplayNoPermission(idCommunity, Service.ServiceModuleID()); } } }
public void Delete(long idCall, String baseFilePath, String baseThumbnailPath) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { int idCommunity = View.IdCallCommunity; int idUser = UserContext.CurrentUserID; CallStandardAction action = View.CurrentAction; ModuleRequestForMembership module = Service.RequestForMembershipServicePermission(idUser, idCommunity); BaseForPaper call = Service.GetCall(idCall); if (call == null) { View.DisplayUnableToDeleteUnknownCall(); } else if (module.Administration || module.ManageBaseForPapers || (module.DeleteOwnBaseForPaper && call.CreatedBy != null && call.CreatedBy.Id == idUser)) { idCommunity = ((call.IsPortal || call.Community == null) ? 0 : call.Community.Id); if (Service.DeleteCall(idCall, baseFilePath, baseThumbnailPath)) { View.SendUserAction(idCommunity, Service.ServiceModuleID(), idCall, ModuleRequestForMembership.ActionType.DeleteRequest); View.RemoveSkinAssociation(idUser, Service.ServiceModuleID(), idCommunity, idCall, (Int32)ModuleRequestForMembership.ObjectType.RequestForMembership, typeof(RequestForMembership).FullName); } else { View.DisplayUnableToDeleteCall(); } } FilterCallVisibility filter = View.CurrentFilter; InitializeView(action, module, idCommunity, View.CurrentView); View.CurrentFilter = filter; LoadCalls(module, action, idCommunity, View.CurrentView, View.Pager.PageIndex, currentPageSize); } }
private void LoadCommittees(BaseForPaper call) { List <dtoCommitteeEvaluators> committees = Service.GetCommitteesEvaluationInfo(call); List <lm.Comol.Core.Wizard.NavigableWizardItem <dtoEvaluationStep> > steps = Service.GetAvailableSteps(call, WizardEvaluationStep.ManageEvaluators); if (committees == null || committees.Count == 0) { if (!Service.isNewCommittee(call)) { View.DisplayError(EvaluationEditorErrors.NoCommittees); View.LoadWizardSteps(call.Id, View.IdCommunity, steps, EvaluationEditorErrors.NoCommittees); } else { View.LoadWizardSteps(call.Id, View.IdCommunity, steps); } } else { View.LoadWizardSteps(call.Id, View.IdCommunity, steps); View.LoadCommitteesInfo(committees); } }
public void Initialize(long idCall, long submissionTypeId, long idRevision, long idSubmission) { if (idCall <= 0) { return; } View.IdCall = idCall; if (!CanPrint) { return; } BaseForPaper call = CurrentManager.Get <BaseForPaper>(idCall); if (call == null) { return; } int comId = call.Community.Id; int usrId = UserContext.CurrentUserID; //Manager Bando //Individuo eventuale sottomissione, revisione, bando, tipo di bando... View.CallName = call.Name; View.CallType = call.Type; View.IdSubmission = idSubmission; View.IdRevision = idRevision; SubmitterType type = null; if (idSubmission > 0 && idRevision > 0) { dtoSubmissionRevision subRev = CallService.GetSubmissionWithRevisions(idSubmission, true); if (subRev != null && subRev.Type != null && subRev.Revisions != null && subRev.Revisions.Any()) { dtoRevision rev = subRev.Revisions.FirstOrDefault(r => r.Id == idRevision); if (rev != null) { View.IdRevision = idRevision; } else { View.IdRevision = 0; } View.IdSubmission = subRev.Id; type = CurrentManager.Get <SubmitterType>(subRev.Type.Id); } else { View.IdSubmission = 0; View.IdRevision = 0; } } if (type == null) { type = call.SubmittersType.FirstOrDefault(st => st.Id == submissionTypeId); if (type == null) { type = call.SubmittersType.OrderBy(st => st.DisplayOrder).FirstOrDefault(); } } View.SubmissionType = type; }
private List <lm.Comol.Core.Dss.Domain.Templates.dtoItemWeightBase> GetAvailableWeights(BaseForPaper call, Boolean fuzzyWeights, Boolean orderedWeights, List <dtoCommittee> committees, Boolean emptyValues = false) { Dictionary <long, String> weights = null; if (!emptyValues && (orderedWeights == call.UseOrderedWeights || fuzzyWeights == call.IsDssMethodFuzzy)) { weights = call.GetFuzzyMeItems(); if (!fuzzyWeights) { weights.Values.Where(v => v.Contains(";")).ToList().ForEach(v => v = ""); } } else { weights = new Dictionary <long, string>(); } List <lm.Comol.Core.Dss.Domain.Templates.dtoItemWeightBase> items = null; if (orderedWeights) { if (committees.Count() > 1) { if (committees.Count() == weights.Count) { items = (from int i in Enumerable.Range(1, committees.Count()) select i).ToList().Select(i => new lm.Comol.Core.Dss.Domain.Templates.dtoItemWeightBase() { IdObject = (long)i, IsFuzzyValue = fuzzyWeights, OrderedItem = true, Name = i.ToString(), Value = (weights.ContainsKey((long)i) ? weights[(long)i] : "") }).ToList(); } else { Int32 index = 1; items = (from int i in Enumerable.Range(1, committees.Count()) select i).ToList().Select(i => new lm.Comol.Core.Dss.Domain.Templates.dtoItemWeightBase() { IdObject = (long)i, IsFuzzyValue = fuzzyWeights, OrderedItem = true, Name = i.ToString(), Value = "" }).ToList(); List <String> values = weights.Values.ToList(); if (values.Any()) { items[0].Value = values[0]; switch (values.Count) { case 0: case 1: break; case 2: items.Last().Value = values.Last(); break; default: items.Last().Value = values.Last(); foreach (String v in values.Skip(1).Take(values.Count - 1)) { items[index++].Value = v; } break; } } } } } else { items = committees.Select(c => c.ToWeightItem(weights, fuzzyWeights)).ToList(); } return(items); }
private void LoadCommittees(BaseForPaper call, Boolean allowUseOfDssMethods, long idMethod = -1, long idRatingSet = -1) { List <dtoCommittee> committees = Service.GetEditorCommittees(call); List <dtoSubmitterType> submitters = CallService.GetCallAvailableSubmittersType(call); CallForPaper cfp = Service.GetCallForCommiteeSettings(call.Id); Boolean useDssMethod = allowUseOfDssMethods && (cfp != null && cfp != null && cfp.EvaluationType == EvaluationType.Dss); View.AllowSubmittersSelection = !useDssMethod && (committees.Count > 0) && submitters.Count > 0; View.UseDssMethods = useDssMethod; View.LoadSubmitterTypes(submitters); List <lm.Comol.Core.Wizard.NavigableWizardItem <dtoEvaluationStep> > steps = Service.GetAvailableSteps(call, WizardEvaluationStep.none); Int32 count = committees.Count; View.CommitteesCount = count; List <dtoSelectMethod> methods = null; if (useDssMethod) { methods = ServiceDss.MethodsGetAvailable(UserContext.Language.Id); View.CurrentMethods = methods; } if (committees == null || committees.Count == 0) { if (!Service.isNewCommittee(call)) { View.CommitteesCount = 0; View.DisplayError(EvaluationEditorErrors.NoCommittees); View.LoadWizardSteps(call.Id, View.IdCommunity, steps, EvaluationEditorErrors.NoCommittees); View.DisplayDssErrors(new List <dtoCommittee>()); } else { EvaluationCommittee committee = Service.AddFirstCommittee(call, View.DefaultCommitteeName, View.DefaultCommitteeDescription, useDssMethod); if (committee != null) { committees = new List <dtoCommittee>(); committees.Add(new dtoCommittee() { Id = committee.Id, Description = committee.Description, DisplayOrder = committee.DisplayOrder, UseDss = committee.UseDss, WeightSettings = new Core.Dss.Domain.Templates.dtoItemWeightSettings(), MethodSettings = new Core.Dss.Domain.Templates.dtoItemMethodSettings() { InheritsFromFather = false }, Name = committee.Name, ForAllSubmittersType = true }); count = 1; View.CommitteesCount = count; View.LoadCommittees(committees); } else { View.CommitteesCount = 0; } if (useDssMethod && committees.Any(c => c.HasDssErrors(count))) { //lm.Comol.Core.Wizard.NavigableWizardItem<dtoEvaluationStep> step = steps.Where(s=> s.Id.Type== WizardEvaluationStep.GeneralSettings).FirstOrDefault(); //if (step!=null){ // step.Id.Errors.Add(EditingErrors.CommitteeDssSettings); // if (step.Status== Core.Wizard.WizardItemStatus.valid || step.Status== Core.Wizard.WizardItemStatus.none) // step.Status= Core.Wizard.WizardItemStatus.error; //} View.DisplayDssErrors(committees.Where(c => c.HasDssErrors(1)).ToList()); } else { View.DisplayDssErrors(new List <dtoCommittee>()); } View.LoadWizardSteps(call.Id, View.IdCommunity, steps); } } else { if (useDssMethod && committees.Any(c => c.HasDssErrors(count))) { View.DisplayDssErrors(committees.Where(c => c.HasDssErrors(count)).ToList()); //lm.Comol.Core.Wizard.NavigableWizardItem<dtoEvaluationStep> step = steps.Where(s => s.Id.Type == WizardEvaluationStep.GeneralSettings).FirstOrDefault(); //if (step != null) //{ // step.Id.Errors.Add(EditingErrors.CommitteeDssSettings); // if (step.Status == Core.Wizard.WizardItemStatus.valid || step.Status == Core.Wizard.WizardItemStatus.none) // step.Status = Core.Wizard.WizardItemStatus.error; //} } else { View.DisplayDssErrors(new List <dtoCommittee>()); } View.LoadWizardSteps(call.Id, View.IdCommunity, steps); if (useDssMethod) { if (committees.Count > 1) { View.InitializeAggregationMethods(methods, (idMethod == -1 ? cfp.IdDssMethod : idMethod), (idRatingSet == -1 ? cfp.IdDssRatingSet : idRatingSet), GetAvailableWeights(call, call.IsDssMethodFuzzy, call.UseOrderedWeights, committees)); } else { View.HideCallAggregationMethods(methods, (idMethod == -1 ? cfp.IdDssMethod : idMethod), (idRatingSet == -1 ? cfp.IdDssRatingSet : idRatingSet), GetAvailableWeights(call, call.IsDssMethodFuzzy, call.UseOrderedWeights, committees)); } } View.LoadCommittees(committees); } }
private void LoadRevisionInfos(Boolean allowAdmin, BaseForPaper call, dtoSubmissionRevision submission) { Boolean allowRevision = false; Boolean isOwner = (submission.IdPerson == UserContext.CurrentUserID); switch (call.RevisionSettings) { case RevisionMode.OnlyManager: allowRevision = allowAdmin && !submission.IsAnonymous; break; case RevisionMode.ManagerSubmitter: allowRevision = (allowAdmin && !submission.IsAnonymous) || (isOwner && !submission.IsAnonymous); break; case RevisionMode.OnlySubmitter: allowRevision = (isOwner && !submission.IsAnonymous); break; default: allowRevision = false; break; } Boolean submissionRevision = !call.AdvacedEvaluation && (allowRevision && submission.Status >= SubmissionStatus.submitted && submission.Status != SubmissionStatus.rejected); // SE posso fare la revisione e NON ci sono revisioni in corso ! View.AllowRevisionRequest = submissionRevision && submission.HasWorkingRevision() == false; dtoRevisionRequest revision = submission.GetWorkingRevision(); List <dtoRevision> acceptRevisions = submission.GetAcceptedRevisions(); long currentRevision = View.IdRevision; if (allowAdmin && currentRevision > 0) { if (revision != null) { Int32 version = acceptRevisions.Where(r => r.Id <= currentRevision).Select(r => r.Number).Max(); Int32 subVersion = submission.Revisions.Where(r => r.Id > acceptRevisions.Where(a => a.IsActive && a.Id <= currentRevision).Select(t => t.Id).FirstOrDefault() && r.Id < currentRevision).Count() + 1; //revision.SubVersion = subVersion; //acceptRevisions.Insert(0,revision); //if (currentRevision == revision.Id && revision.Status != RevisionStatus.Submitted) { switch (revision.Type) { case RevisionType.UserRequired: View.DisplayUserPendingRequest(revision, RootObject.UserReviewCall(View.CallType, View.IdCall, View.IdSubmission, revision.Id, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity)); break; case RevisionType.Manager: View.DisplayManagePendingRevision(revision, RootObject.UserReviewCall(View.CallType, View.IdCall, View.IdSubmission, revision.Id, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity)); break; } //} } if (submissionRevision && !submission.HasWorkingRevision()) { View.InitializeRevisionRequest(((allowAdmin) ? RevisionType.Manager : RevisionType.None)); } } else { // Imposto le richieste di revisione if (submissionRevision && !submission.HasWorkingRevision()) { View.InitializeRevisionRequest((isOwner) ? RevisionType.UserRequired : ((allowAdmin) ? RevisionType.Manager : RevisionType.None)); } if (revision != null && revision.Status != RevisionStatus.Submitted) { View.IdPendingRevision = revision.Id; if (isOwner) { switch (revision.Type) { case RevisionType.UserRequired: View.DisplaySelfPendingRequest(revision, RootObject.UserReviewCall(View.CallType, View.IdCall, View.IdSubmission, revision.Id, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity)); break; case RevisionType.Manager: View.DisplayPendingRevision(revision, RootObject.UserReviewCall(View.CallType, View.IdCall, View.IdSubmission, revision.Id, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity)); break; } } else if (allowAdmin) { switch (revision.Type) { case RevisionType.UserRequired: View.DisplayUserPendingRequest(revision, RootObject.UserReviewCall(View.CallType, View.IdCall, View.IdSubmission, revision.Id, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity)); break; case RevisionType.Manager: View.DisplayManagePendingRevision(revision, RootObject.UserReviewCall(View.CallType, View.IdCall, View.IdSubmission, revision.Id, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity)); break; } } } if (revision == null || (revision != null && (revision.Id != View.IdRevision || revision.Status == RevisionStatus.Submitted))) { View.DisplayRevisionInfo(submission.Revisions.Where(r => r.Id == View.IdRevision).FirstOrDefault()); } } // Carico la lista delle revisioni attualmente accettate ! View.LoadAvailableRevision(acceptRevisions, View.IdRevision); }