public void SaveSettings(List <dtoSubmitterTemplateMail> templates) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { List <long> editing = View.InEditing; if (!CallService.SaveSubmittersTemplate(View.IdCall, templates, editing)) { View.DisplayError(EditorErrors.SavingTemplateSettings); } else { LoadTemplates(View.IdCall); DisplayMessage(View.IdCall, false); if (View.CallType == CallForPaperType.CallForBids) { View.SendUserAction(View.IdCommunity, View.IdCallModule, View.IdCall, ModuleCallForPaper.ActionType.SaveSubmittersTemplate); } else { View.SendUserAction(View.IdCommunity, View.IdCallModule, View.IdCall, ModuleRequestForMembership.ActionType.SaveSubmittersTemplate); } } View.LoadWizardSteps(View.IdCall, View.CallType, View.IdCommunity, CallService.GetAvailableSteps(View.IdCall, WizardCallStep.SubmitterTemplateMail, View.CallType)); } }
private void LoadRequiredFiles(long idCall, dtoGenericPermission permission) { View.LoadSubmitterTypes(CallService.GetCallAvailableSubmittersType(idCall)); List <dtoRequestedFilePermission> items = CallService.GetRequestedFiles(idCall, permission, false); View.LoadWizardSteps(idCall, View.CallType, View.IdCommunity, CallService.GetAvailableSteps(idCall, WizardCallStep.FileToSubmit, View.CallType)); if (items.Count == 0) { View.DisplayNoFileToSubmit(); } else { View.LoadFiles(items); } }
public void SaveTemplate(dtoSubmitterTemplateMail template, List <dtoSubmitterTemplateMail> templates) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { List <long> editing = View.InEditing; if (template != null && template.Id == 0) { SubmitterTemplateMail sTemplate = CallService.AddSubmitterTemplate(View.IdCall, template); if (sTemplate != null) { template.Id = sTemplate.Id; templates.Add(template); editing.Add(sTemplate.Id); } } if (!CallService.SaveSubmitterTemplate(template)) { View.InEditing = editing; View.LoadTemplates(templates); View.DisplayError(EditorErrors.SavingTemplateSettings); } else { editing.Remove(template.Id); View.InEditing = editing; View.LoadTemplates(templates); DisplayMessage(View.IdCall, false); if (View.CallType == CallForPaperType.CallForBids) { View.SendUserAction(View.IdCommunity, View.IdCallModule, View.IdCall, ModuleCallForPaper.ActionType.SaveSubmittersTemplate); } else { View.SendUserAction(View.IdCommunity, View.IdCallModule, View.IdCall, ModuleRequestForMembership.ActionType.SaveSubmittersTemplate); } } View.LoadWizardSteps(View.IdCall, View.CallType, View.IdCommunity, CallService.GetAvailableSteps(View.IdCall, WizardCallStep.SubmitterTemplateMail, View.CallType)); } }
public void SaveSettings(dtoManagerTemplateMail template) { ManagerTemplateMail sTemplate = CallService.SaveManagerTemplate(View.IdCall, template); if (sTemplate == null) { View.DisplayErrorSaving(); } else { View.IdTemplate = sTemplate.Id; View.DisplaySettingsSaved(); if (View.CallType == CallForPaperType.CallForBids) { View.SendUserAction(View.IdCommunity, View.IdCallModule, View.IdCall, ModuleCallForPaper.ActionType.SaveManagerTemplate); } else { View.SendUserAction(View.IdCommunity, View.IdCallModule, View.IdCall, ModuleRequestForMembership.ActionType.SaveManagerTemplate); } View.LoadWizardSteps(View.IdCall, View.CallType, View.IdCommunity, CallService.GetAvailableSteps(View.IdCall, WizardCallStep.NotificationTemplateMail, View.CallType)); } }
public void InitView() { long idCall = View.PreloadIdCall; dtoBaseForPaper call = null; CallForPaperType type = CallService.GetCallType(idCall); if (type == CallForPaperType.None) { type = View.PreloadType; } call = CallService.GetDtoBaseCall(idCall); View.CallType = type; int idCommunity = SetCallCurrentCommunity(call); if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { litePerson currenUser = CurrentManager.GetLitePerson(UserContext.CurrentUserID); Boolean allowManage = false; Boolean allowView = false; Boolean allowSave = false; ModuleCallForPaper module = null; ModuleRequestForMembership moduleR = null; switch (type) { case CallForPaperType.CallForBids: module = CallService.CallForPaperServicePermission(UserContext.CurrentUserID, idCommunity); allowView = (module.ViewCallForPapers || module.Administration || module.ManageCallForPapers); allowManage = module.CreateCallForPaper || module.Administration || module.ManageCallForPapers || module.EditCallForPaper; allowSave = (module.Administration || module.ManageCallForPapers || (module.CreateCallForPaper && idCall == 0) || (call != null && module.EditCallForPaper && currenUser == call.Owner)); break; case CallForPaperType.RequestForMembership: moduleR = CallService.RequestForMembershipServicePermission(UserContext.CurrentUserID, idCommunity); allowView = (moduleR.ViewBaseForPapers || moduleR.Administration || moduleR.ManageBaseForPapers); allowManage = moduleR.CreateBaseForPaper || moduleR.Administration || moduleR.ManageBaseForPapers || moduleR.EditBaseForPaper; allowSave = (moduleR.Administration || moduleR.ManageBaseForPapers || (moduleR.CreateBaseForPaper && idCall == 0) || (call != null && moduleR.EditBaseForPaper && currenUser == call.Owner)); break; default: break; } int idModule = (type == CallForPaperType.CallForBids) ? CallService.ServiceModuleID() : RequestService.ServiceModuleID(); View.IdCallModule = idModule; if (call == null) { View.LoadUnknowCall(idCommunity, idModule, idCall, type); } else if (allowManage || allowSave) { View.AllowSave = allowSave; View.IdCall = idCall; View.SetActionUrl(CallStandardAction.Manage, RootObject.ViewCalls(idCall, type, CallStandardAction.Manage, idCommunity, View.PreloadView)); List <lm.Comol.Core.Wizard.NavigableWizardItem <WizardCallStep> > steps = CallService.GetAvailableSteps(idCall, WizardCallStep.NotificationTemplateMail, type); View.LoadWizardSteps(idCall, type, idCommunity, steps); LoadTemplate(idCall); if (type == CallForPaperType.CallForBids) { View.SendUserAction(idCommunity, idModule, idCall, ModuleCallForPaper.ActionType.EditManagerTemplate); } else { View.SendUserAction(idCommunity, idModule, idCall, ModuleRequestForMembership.ActionType.EditManagerTemplate); } 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(type, idCall, idCommunity, View.PreloadView)); } } else { View.DisplayNoPermission(idCommunity, idModule); } } }
public void InitView(Boolean allowUseOfDss) { CallStandardAction action = View.PreloadAction; long idCall = View.PreloadIdCall; dtoBaseForPaper call = null; CallForPaperType type = View.PreloadType; if (idCall == 0) { action = CallStandardAction.Add; } else { type = CallService.GetCallType(idCall); call = CallService.GetDtoBaseCall(idCall); action = CallStandardAction.Edit; } View.CallType = type; View.CurrentAction = action; int idCommunity = SetCallCurrentCommunity(action, call); if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { litePerson currenUser = CurrentManager.GetLitePerson(UserContext.CurrentUserID); Boolean allowManage = false; Boolean allowView = false; Boolean allowSave = false; switch (type) { case CallForPaperType.CallForBids: ModuleCallForPaper module = CallService.CallForPaperServicePermission(UserContext.CurrentUserID, idCommunity); allowView = (module.ViewCallForPapers || module.Administration || module.ManageCallForPapers); allowManage = module.CreateCallForPaper || module.Administration || module.ManageCallForPapers || module.EditCallForPaper; allowSave = (module.Administration || module.ManageCallForPapers || (module.CreateCallForPaper && idCall == 0) || (call != null && module.EditCallForPaper && currenUser == call.Owner)); break; case CallForPaperType.RequestForMembership: ModuleRequestForMembership moduleR = CallService.RequestForMembershipServicePermission(UserContext.CurrentUserID, idCommunity); allowView = (moduleR.ViewBaseForPapers || moduleR.Administration || moduleR.ManageBaseForPapers); allowManage = moduleR.CreateBaseForPaper || moduleR.Administration || moduleR.ManageBaseForPapers || moduleR.EditBaseForPaper; allowSave = (moduleR.Administration || moduleR.ManageBaseForPapers || (moduleR.CreateBaseForPaper && idCall == 0) || (call != null && moduleR.EditBaseForPaper && currenUser == call.Owner)); break; default: break; } int idModule = (type == CallForPaperType.CallForBids) ? CallService.ServiceModuleID() : RequestService.ServiceModuleID(); View.IdCallModule = idModule; if (call == null && action == CallStandardAction.Edit) { View.LoadUnknowCall(idCommunity, idModule, idCall, type); } else if (allowManage || allowSave) { View.AllowSave = allowSave; View.IdCall = idCall; LoadCallStatus(idCall, call); if (action == CallStandardAction.Add) { View.LoadEmptyCall(); View.AllowStatusEdit = false; View.ForPortal = (idCommunity == 0); } else { View.ForPortal = (call != null && call.IsPortal); View.AllowStatusEdit = AllowStatusEdit(idCall, type, call, allowSave); View.LoadCall(call); } List <lm.Comol.Core.Wizard.NavigableWizardItem <WizardCallStep> > steps = CallService.GetAvailableSteps(idCall, WizardCallStep.GeneralSettings, type); View.SetActionUrl(CallStandardAction.Manage, RootObject.ViewCalls(idCall, type, CallStandardAction.Manage, idCommunity, View.PreloadView)); View.LoadWizardSteps(idCall, type, idCommunity, steps); if (type == CallForPaperType.CallForBids) { View.LoadEvaluationSettings(CallService.GetEvaluationSettings(idCall, allowUseOfDss)); View.SendUserAction(idCommunity, idModule, idCall, (action == CallStandardAction.Add) ? ModuleCallForPaper.ActionType.StartCallCreation : ModuleCallForPaper.ActionType.StartCallEdit); } else { View.SendUserAction(idCommunity, idModule, idCall, (action == CallStandardAction.Add) ? ModuleRequestForMembership.ActionType.StartRequestCreation : ModuleRequestForMembership.ActionType.StartRequestEdit); } 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(type, idCall, idCommunity, View.PreloadView)); } } else { View.DisplayNoPermission(idCommunity, idModule); } } }
public void SaveSettings(dtoBaseForPaper dto, String submitterName, Boolean allowUseOfDss, Boolean validateStatus) { int idCommunity = View.IdCommunity; try { int idModule = (dto.Type == CallForPaperType.CallForBids) ? CallService.ServiceModuleID() : RequestService.ServiceModuleID(); if (dto.Type == CallForPaperType.RequestForMembership && dto.EndDate.HasValue && dto.StartDate >= dto.EndDate.Value) { View.DisplayDateError(dto.StartDate, dto.EndDate.Value); } else if (dto.Type == CallForPaperType.CallForBids && dto.EndDate.HasValue && dto.StartDate >= dto.EndDate.Value && ((dtoCall)dto).EndEvaluationOn.HasValue && dto.EndDate.Value >= ((dtoCall)dto).EndEvaluationOn.Value) { View.DisplayDateError(CallForPaperType.CallForBids); } else if (dto.Type == CallForPaperType.CallForBids && dto.EndDate.HasValue && dto.StartDate >= dto.EndDate.Value) { View.DisplayDateError(dto.StartDate, dto.EndDate.Value); } else if (dto.Type == CallForPaperType.CallForBids && dto.EndDate.HasValue && ((dtoCall)dto).EndEvaluationOn.HasValue && dto.EndDate.Value >= ((dtoCall)dto).EndEvaluationOn.Value) { View.DisplayEvaluationDateError(dto.EndDate.Value, ((dtoCall)dto).EndEvaluationOn.Value); } else { Boolean stepsToComplete = false; List <lm.Comol.Core.Wizard.NavigableWizardItem <WizardCallStep> > wizardSteps = null; BaseForPaper call = null; List <WizardCallStep> skipedSteps = new List <WizardCallStep>();; long idCall = dto.Id; Boolean hasSubmission = false; if (idCall > 0) { hasSubmission = CallService.CallHasSubmissions(idCall); } if (dto.Status > CallForPaperStatus.Draft && idCall == 0) { dto.Status = CallForPaperStatus.Draft; stepsToComplete = true; View.CurrentStatus = dto.Status; } else if (dto.Status > CallForPaperStatus.Draft && idCall > 0) { wizardSteps = CallService.GetAvailableSteps(idCall, WizardCallStep.GeneralSettings, View.CallType); skipedSteps = CallService.GetSkippedSteps(wizardSteps, idCall, View.CallType); stepsToComplete = (skipedSteps.Count > 0); if (stepsToComplete && !hasSubmission) { dto.Status = CallForPaperStatus.Draft; View.CurrentStatus = dto.Status; } } if (dto.Type == CallForPaperType.CallForBids) { call = CallService.SaveCallSettings((dtoCall)dto, idCommunity, validateStatus); } else { call = RequestService.SaveCallSettings((dtoRequest)dto, idCommunity, validateStatus, submitterName); } if (call != null) { idCall = call.Id; RefreshCallName(View.CurrentAction, dto.Name, idCommunity); } View.IdCall = idCall; if (dto.Type == CallForPaperType.CallForBids) { View.SendUserAction(idCommunity, idModule, idCall, (View.CurrentAction == CallStandardAction.Add) ? ModuleCallForPaper.ActionType.AddCallSettings : ModuleCallForPaper.ActionType.SaveCallSettings); } else { View.SendUserAction(idCommunity, idModule, idCall, (View.CurrentAction == CallStandardAction.Add) ? ModuleRequestForMembership.ActionType.AddCallSettings : ModuleRequestForMembership.ActionType.SaveCallSettings); } if (wizardSteps == null) { wizardSteps = CallService.GetAvailableSteps(idCall, WizardCallStep.GeneralSettings, call.Type); } if (stepsToComplete && skipedSteps.Count > 0) { View.DisplaySkippedRequiredSteps(skipedSteps); } else if (stepsToComplete && wizardSteps.Count > 0) { View.DisplaySkippedRequiredSteps(wizardSteps.Where(ws => ws.Status == Core.Wizard.WizardItemStatus.error || ws.Status == Core.Wizard.WizardItemStatus.disabled).Select(ws => ws.Id).ToList()); } else if (call != null) { View.DisplaySettingsSaved(); } if (View.InvalidStatusFound) { View.InvalidStatusFound = false; View.LoadStatus(CallService.GetAvailableStatus(idCall), dto.Status); dto = CallService.GetDtoBaseCall(idCall); View.LoadCall(dto); if (dto.Type == CallForPaperType.CallForBids) { View.LoadEvaluationSettings(CallService.GetEvaluationSettings(idCall, allowUseOfDss)); } } else { View.LoadStatus(CallService.GetAvailableStatus(idCall), dto.Status); } View.LoadWizardSteps(idCall, dto.Type, idCommunity, wizardSteps); } } catch (SkipRequiredSteps exc) { View.DisplaySkippedRequiredSteps(exc.Steps); } catch (CallForPaperInvalidStatus ex) { View.InvalidStatusFound = true; switch (dto.Status) { case CallForPaperStatus.Draft: if (dto.StartDate >= DateTime.Now) { View.CurrentStatus = (!dto.EndDate.HasValue || (dto.EndDate.HasValue && dto.EndDate.Value <= DateTime.Now)) ? CallForPaperStatus.SubmissionOpened: CallForPaperStatus.SubmissionClosed; } else { View.CurrentStatus = CallForPaperStatus.SubmissionOpened; } break; } View.LoadInvalidStatus(dto.Status, dto.EndDate); RefreshCallName(View.CurrentAction, dto.Name, idCommunity); } }
private void LoadSubmitters(long idCall, ModuleRequestForMembership module, CallForPaperType type, Int32 idCommunity) { List <dtoSubmitterTypePermission> submitters = CallService.GetCallSubmittersType(idCall, module, false); if (submitters.Count == 0) { View.DisplayNoSubmitters(); } else { View.LoadSubmitters(submitters); } List <lm.Comol.Core.Wizard.NavigableWizardItem <WizardCallStep> > steps = CallService.GetAvailableSteps(idCall, WizardCallStep.SubmittersType, type); View.LoadWizardSteps(idCall, type, idCommunity, steps); if (steps.Where(s => (s.Id != WizardCallStep.CallAvailability) && submitters.Count > 0 && (s.Status == Core.Wizard.WizardItemStatus.valid || s.Status == Core.Wizard.WizardItemStatus.warning)).Any()) { View.SetActionUrl(CallStandardAction.PreviewCall, RootObject.PreviewCall(type, idCall, idCommunity, View.PreloadView)); } }
public Boolean AddTemplate(dtoSubmitterTemplateMail template, List <dtoSubmitterTemplateMail> templates) { Boolean result = false; if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { SubmitterTemplateMail sTemplate = CallService.AddSubmitterTemplate(View.IdCall, template); if (sTemplate != null) { View.AllowAdd = View.AllowSave && View.Availablesubmitters.Count > 1; template.Id = sTemplate.Id; templates.Add(template); if (View.CallType == CallForPaperType.CallForBids) { View.SendUserAction(View.IdCommunity, View.IdCallModule, View.IdCall, ModuleCallForPaper.ActionType.AddSubmitterTemplate); } else { View.SendUserAction(View.IdCommunity, View.IdCallModule, View.IdCall, ModuleRequestForMembership.ActionType.AddSubmitterTemplate); } DisplayMessage(View.IdCall, true); View.LoadWizardSteps(View.IdCall, View.CallType, View.IdCommunity, CallService.GetAvailableSteps(View.IdCall, WizardCallStep.SubmitterTemplateMail, View.CallType)); } View.LoadTemplates(templates); } return(result); }
public void RemoveTemplate(long idTemplate, List <dtoSubmitterTemplateMail> templates) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { List <long> editing = View.InEditing; try { if (!CallService.VirtualDeleteSubmitterTemplate(idTemplate, true)) { View.DisplayError(EditorErrors.RemovingTemplate); } else { View.DisplayTemplateRemoved(); editing.Remove(idTemplate); templates = templates.Where(t => t.Id != idTemplate).ToList(); if (View.CallType == CallForPaperType.CallForBids) { View.SendUserAction(View.IdCommunity, View.IdCallModule, View.IdCall, ModuleCallForPaper.ActionType.VirtualDeleteSubmitterTemplate); } else { View.SendUserAction(View.IdCommunity, View.IdCallModule, View.IdCall, ModuleRequestForMembership.ActionType.VirtualDeleteSubmitterTemplate); } View.LoadWizardSteps(View.IdCall, View.CallType, View.IdCommunity, CallService.GetAvailableSteps(View.IdCall, WizardCallStep.SubmitterTemplateMail, View.CallType)); } } catch (SubmissionLinked ex) { View.DisplayError(EditorErrors.RemovingTemplate); } View.InEditing = editing; View.LoadTemplates(templates); } }
public void InitView() { long idCall = View.PreloadIdCall; dtoBaseForPaper call = null; CallForPaperType type = CallService.GetCallType(idCall); if (type == CallForPaperType.None) { type = View.PreloadType; } call = CallService.GetDtoBaseCall(idCall); View.CallType = type; int idCommunity = SetCallCurrentCommunity(call); if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { litePerson currenUser = CurrentManager.GetLitePerson(UserContext.CurrentUserID); Boolean allowManage = false; Boolean allowView = false; Boolean allowSave = false; ModuleCallForPaper module = null; ModuleRequestForMembership moduleR = null; switch (type) { case CallForPaperType.CallForBids: module = CallService.CallForPaperServicePermission(UserContext.CurrentUserID, idCommunity); allowView = (module.ViewCallForPapers || module.Administration || module.ManageCallForPapers); allowManage = module.CreateCallForPaper || module.Administration || module.ManageCallForPapers || module.EditCallForPaper; allowSave = (module.Administration || module.ManageCallForPapers || (module.CreateCallForPaper && idCall == 0) || (call != null && module.EditCallForPaper && currenUser == call.Owner)); break; case CallForPaperType.RequestForMembership: moduleR = CallService.RequestForMembershipServicePermission(UserContext.CurrentUserID, idCommunity); allowView = (moduleR.ViewBaseForPapers || moduleR.Administration || moduleR.ManageBaseForPapers); allowManage = moduleR.CreateBaseForPaper || moduleR.Administration || moduleR.ManageBaseForPapers || moduleR.EditBaseForPaper; allowSave = (moduleR.Administration || moduleR.ManageBaseForPapers || (moduleR.CreateBaseForPaper && idCall == 0) || (call != null && moduleR.EditBaseForPaper && currenUser == call.Owner)); break; default: break; } int idModule = (type == CallForPaperType.CallForBids) ? CallService.ServiceModuleID() : RequestService.ServiceModuleID(); View.IdCallModule = idModule; if (call == null) { View.LoadUnknowCall(idCommunity, idModule, idCall, type); } else if (allowManage || allowSave) { allowSave = allowSave && (type == CallForPaperType.RequestForMembership || (type != CallForPaperType.RequestForMembership && (!CallService.CallHasSubmissions(idCall)))); View.AllowSave = allowSave; View.IdCall = idCall; List <lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions> availableActions = new List <Core.DomainModel.Repository.RepositoryAttachmentUploadActions>() { Core.DomainModel.Repository.RepositoryAttachmentUploadActions.uploadtomoduleitem }; lm.Comol.Core.FileRepository.Domain.RepositoryIdentifier rIdentifier = call.GetRepositoryIdentifier(); if (!(rIdentifier.Type == Core.FileRepository.Domain.RepositoryType.Community && rIdentifier.IdCommunity == 0)) { View.InitializeAttachmentsControl(idCall, type, rIdentifier, availableActions, Core.DomainModel.Repository.RepositoryAttachmentUploadActions.uploadtomoduleitem); } List <lm.Comol.Core.Wizard.NavigableWizardItem <WizardCallStep> > steps = CallService.GetAvailableSteps(idCall, WizardCallStep.Attachments, type); View.SetActionUrl(CallStandardAction.Manage, RootObject.ViewCalls(type, CallStandardAction.Manage, idCommunity, View.PreloadView)); View.LoadWizardSteps(idCall, type, idCommunity, steps); if (type == CallForPaperType.CallForBids) { LoadAttachments(idCall, module); View.SendUserAction(idCommunity, idModule, idCall, ModuleCallForPaper.ActionType.EditAttachments); } else { LoadAttachments(idCall, moduleR); View.SendUserAction(idCommunity, idModule, idCall, ModuleRequestForMembership.ActionType.EditAttachments); } 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(type, idCall, idCommunity, View.PreloadView)); } } else { View.DisplayNoPermission(idCommunity, idModule); } } }