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); } } }
public void InitView() { long idTemplate = View.PreloadIdTemplate; long idVersion = View.PreloadIdVersion; TemplateType t = View.PreloadTemplateType; dtoBaseTemplateOwner ownerInfo = View.PreloadOwnership; Int32 idCommunity = ownerInfo.IdCommunity; if (idCommunity == -1) { idCommunity = UserContext.CurrentCommunityID; } if (ownerInfo.IdModule == 0 && !String.IsNullOrEmpty(ownerInfo.ModuleCode)) { ownerInfo.IdModule = CurrentManager.GetModuleID(ownerInfo.ModuleCode); } View.Ownership = ownerInfo; View.IdTemplateCommunity = idCommunity; if (UserContext.isAnonymous) { Logout(t, idTemplate, idVersion); } else { Boolean allowDraft = false; Boolean allowActivate = false; TemplateDefinitionVersion version = Service.GetVersion(idVersion); List <lm.Comol.Core.Wizard.NavigableWizardItem <dtoTemplateStep> > steps = Service.GetAvailableSteps(idVersion, WizardTemplateStep.Settings, ownerInfo.Type); if (version == null || (version.Deleted != BaseStatusDeleted.None && !View.PreloadPreview) || (version.Template == null)) { View.DisplayUnknownTemplate(); steps = steps.Where(s => s.Id.Type == WizardTemplateStep.Settings).ToList(); steps[0].Status = Wizard.WizardItemStatus.disabled; steps[0].DisplayOrderDetail = Wizard.DisplayOrderEnum.first | Wizard.DisplayOrderEnum.last; View.SendUserAction(idCommunity, Service.ServiceModuleID(), ModuleTemplateMessages.ActionType.UnknownTemplateVersion); } else { dtoTemplatePermission permission = null; Boolean allowSee = false; Boolean isPreview = View.PreloadPreview; View.IdTemplate = version.Template.Id; View.IdVersion = version.Id; t = version.Template.Type; if (View.IsTemplateAdded) { View.DisplayTemplateAdded(); } switch (ownerInfo.Type) { case OwnerType.None: View.UnableToReadUrlSettings(); View.SendUserAction(idCommunity, Service.ServiceModuleID(), ModuleTemplateMessages.ActionType.MalformedUrl); break; case OwnerType.Object: //allowDraft = View.HasPermissionForObject(ModuleObject.CreateLongObject(ownerInfo.IdObject, ownerInfo.IdObjectType, ownerInfo.IdObjectCommunity, CurrentManager.GetModuleCode(ownerInfo.IdObjectModule))); //break; case OwnerType.Module: View.IdTemplateModule = ownerInfo.IdModule; if (ownerInfo.IdModule == Service.ServiceModuleID()) { permission = Service.GetItemPermission(idVersion); } else { permission = Service.GetManagementTemplatePermission(version, GetPermissions(ownerInfo.ModuleCode, ownerInfo.ModulePermission, ownerInfo.IdCommunity, t)); } allowDraft = permission.AllowEdit; allowSee = permission.AllowUse; break; default: permission = Service.GetItemPermission(idVersion); allowDraft = permission.AllowEdit; allowSee = permission.AllowUse; break; } allowDraft = allowDraft && (version.Status == TemplateStatus.Draft) && !isPreview; allowActivate = allowDraft && (version.DefaultTranslation.IsValid() || (version != null && version.Translations.Where(tn => tn.Deleted == BaseStatusDeleted.None && tn.IsValid).Any())); Boolean isAdministrative = Service.IsAdministrativeUser(UserContext.CurrentUserID); View.AllowSenderEdit = isAdministrative && t == TemplateType.System; View.AllowSubjectEdit = isAdministrative; View.AllowSignatureEdit = isAdministrative; View.InputReadOnly = isPreview || (!allowActivate && !allowDraft && allowSee); View.AllowSaveDraft = allowDraft; View.AllowSave = allowActivate; if (allowDraft || allowActivate || allowSee) { LoadSettings(version); View.SendUserAction(idCommunity, Service.ServiceModuleID(), ModuleTemplateMessages.ActionType.StartEditingSettings); } else { View.DisplayNoPermission(idCommunity, Service.ServiceModuleID()); View.SendUserAction(idCommunity, Service.ServiceModuleID(), ModuleTemplateMessages.ActionType.TryToEditingSettings); } } View.CurrentType = t; View.LoadWizardSteps(idCommunity, steps); if (String.IsNullOrEmpty(View.PreloadBackUrl)) { View.SetBackUrl(RootObject.List(View.PreloadFromIdCommunity, t, ownerInfo, true, View.PreloadFromModuleCode, View.PreloadFromModulePermissions, idTemplate, idVersion)); } else { View.SetBackUrl(View.PreloadBackUrl); } } }
public static void RemoveListener(TEventSource source, IWeakEventListener listener) { CurrentManager.ProtectedRemoveListener(source, listener); }
internal static void RemoveListener(DataGridControl source, IWeakEventListener listener) { CurrentManager.ProtectedRemoveListener(source, listener); }
private ModuleGenericTemplateMessages GetPermissions(String moduleCode, long permissions, Int32 idCommunity, TemplateType type) { ModuleGenericTemplateMessages permission = null; Int32 idUser = UserContext.CurrentUserID; switch (type) { case TemplateType.Module: if (moduleCode == ModuleTemplateMessages.UniqueCode) { permission = new ModuleGenericTemplateMessages(Service.GetPermission(idCommunity, OwnerType.Module)); } else { Int32 idModule = CurrentManager.GetModuleID(moduleCode); dtoBaseTemplateOwner ownerInfo = View.PreloadOwnership; ModuleObject obj = (ownerInfo.Type == OwnerType.Object) ? ModuleObject.CreateLongObject(ownerInfo.IdObject, ownerInfo.IdObjectType, ownerInfo.IdObjectCommunity, CurrentManager.GetModuleCode(ownerInfo.IdObjectModule), ownerInfo.IdObjectModule) : null; if (obj != null && obj.ServiceID == 0 && !String.IsNullOrEmpty(obj.ServiceCode)) { obj.ServiceID = CurrentManager.GetModuleID(obj.ServiceCode); } else if (obj != null && obj.ServiceID > 0 && String.IsNullOrEmpty(obj.ServiceCode)) { obj.ServiceCode = CurrentManager.GetModuleCode(obj.ServiceID); } if (permissions > 0) { permission = View.GetModulePermissions(moduleCode, idModule, CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, idModule), idCommunity, UserContext.UserTypeID, obj); } else { permission = View.GetModulePermissions(moduleCode, idModule, GetModulePermission(idCommunity, idModule), idCommunity, UserContext.UserTypeID, obj); } } break; case TemplateType.User: Person p = GetCurrentUser(ref idUser); Boolean allowView = (p != null && p.TypeID != (Int32)UserTypeStandard.Guest && p.TypeID != (Int32)UserTypeStandard.PublicUser); permission = new ModuleGenericTemplateMessages("personal"); permission.Add = allowView; permission.Administration = allowView; permission.Clone = allowView; permission.DeleteMyTemplates = allowView; permission.Edit = allowView; permission.List = allowView; break; } if (permission == null) { permission = new ModuleGenericTemplateMessages(moduleCode); } return(permission); }
public void ApplyFilters(lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { liteDashboardSettings settings = Service.DashboardSettingsGet(DashboardType.Portal, 0); litePageSettings page = (settings != null) ? settings.Pages.Where(p => p.Type == DashboardViewType.Search).FirstOrDefault() : new litePageSettings() { Type = DashboardViewType.Search, MaxItems = 25, More = DisplayMoreItems.Hide, Noticeboard = DisplayNoticeboard.Hide, PlainLayout = PlainLayout.full }; liteTile tile = null; long idTile = View.PreloadIdTile; if (idTile > 0) { tile = Service.GetTile(idTile); } else if (filters.IdcommunityType > -1) { tile = Service.GetTileForCommunityType(filters.IdcommunityType); } List <long> tags = View.TagsToLoad; if (tags != null && tags.Any() && idTile > 0) { filters.IdTags = tags; } View.ApplyFilters(page, filters, tile, ((UserContext != null && UserContext.Language != null) ? UserContext.Language.Id : -2), CurrentManager.GetDefaultIdLanguage()); } }
public static void AddListener(DataGridControl source, IWeakEventListener listener) { CurrentManager.ProtectedAddListener(source, listener); }
public void InitView(TabListItem tabItem) { Int32 idCommunity = View.PreloadIdContainerCommunity; View.IdContainerCommunity = idCommunity; dtoProjectContext cContext = InitializeContext(); View.DashboardContext = cContext; if (UserContext.isAnonymous) { View.DisplaySessionTimeout((idCommunity > -1) ? idCommunity : cContext.IdCommunity, View.GetCurrentUrl()); } else { Person p = CurrentManager.GetPerson(UserContext.CurrentUserID); if (tabItem == TabListItem.Resource || (tabItem != TabListItem.Resource && Service.GetAvailableTabs((p != null ? p.Id : 0), cContext, PageContainerType.Dashboard).Contains(tabItem))) { View.InitializeTopControls(cContext, cContext.IdCommunity, View.PreloadFromCookies, tabItem, PageContainerType.Dashboard, View.PreloadGroupBy, View.PreloadFilterBy, ItemListStatus.All, View.PreloadFilterStatus); switch (tabItem) { case TabListItem.Manager: switch (View.PreloadFromPage) { case PageListType.ListResource: View.SetLinkToProjectsAsManager(RootObject.ProjectListResource(cContext.IdCommunity, cContext.isForPortal, cContext.isPersonal, false, 0, ItemsGroupBy.Plain, View.PreloadFilterBy, View.PreloadFilterStatus, View.PreloadTimeLine, View.PreloadDisplay)); break; case PageListType.ListManager: View.SetLinkToProjectsAsManager(Service.GetBackUrl(View.PreloadFromPage, View.PreloadIdContainerCommunity, 0)); break; case PageListType.ListAdministrator: View.SetLinkToProjectsAsManager(RootObject.ProjectListManager(cContext.IdCommunity, cContext.isForPortal, cContext.isPersonal, false, 0, ItemsGroupBy.Plain, View.PreloadFilterBy, View.PreloadFilterStatus, View.PreloadTimeLine, View.PreloadDisplay)); break; default: View.SetLinkToProjectsAsManager(RootObject.ProjectListResource(cContext.IdCommunity, cContext.isForPortal, cContext.isPersonal, false, 0, ItemsGroupBy.Plain, View.PreloadFilterBy, View.PreloadFilterStatus, View.PreloadTimeLine, View.PreloadDisplay)); break; } break; case TabListItem.Resource: switch (View.PreloadFromPage) { case PageListType.ListResource: View.SetLinkToProjectsAsResource(Service.GetBackUrl(View.PreloadFromPage, View.PreloadIdContainerCommunity, 0)); break; //case PageListType.ListManager: // View.SetLinkToProjectsAsResource(RootObject.ProjectListResource(cContext.IdCommunity, cContext.isForPortal, cContext.isPersonal, false, 0, ItemsGroupBy.Plain, View.PreloadFilterBy, View.PreloadFilterStatus, View.PreloadTimeLine, View.PreloadDisplay)); // break; //case PageListType.ListAdministrator: // View.SetLinkToProjectsAsResource(RootObject.ProjectListResource(cContext.IdCommunity, cContext.isForPortal, cContext.isPersonal, false, 0, ItemsGroupBy.Plain, View.PreloadFilterBy, View.PreloadFilterStatus, View.PreloadTimeLine, View.PreloadDisplay)); // break; default: View.SetLinkToProjectsAsResource(RootObject.ProjectListResource(cContext.IdCommunity, cContext.isForPortal, cContext.isPersonal, false, 0, ItemsGroupBy.Plain, View.PreloadFilterBy, View.PreloadFilterStatus, View.PreloadTimeLine, View.PreloadDisplay)); break; } break; } View.SendUserAction(cContext.IdCommunity, CurrentIdModule, 0, GetDefaultAction(tabItem)); } else { View.RedirectToUrl(View.GetCurrentUrl().Replace(RootObject.GetDashboardPlainPage(PageListType.DashboardManager), RootObject.GetDashboardPlainPage(PageListType.DashboardResource))); } } }
private Boolean HasPermission(dtoSelectorContext context) { Person p = CurrentManager.GetPerson(UserContext.CurrentUserID); ModuleTemplateMessages permission = (context.IsForPortal) ? ModuleTemplateMessages.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID, OwnerType.System) : new ModuleTemplateMessages(CurrentManager.GetModulePermission(UserContext.CurrentUserID, context.IdCommunity, TemplatesService.ServiceModuleID())); if (permission.Administration) { //List<lm.Comol.Core.TemplateMessages.ModuleGenericTemplateMessages> permissions = InitializePermissions(forPortal, idCommunity, p); return(true); } else { return(View.HasModulePermissions(context.ModuleCode, GetModulePermissions(context.IdModule, context.IdCommunity), context.IdCommunity, (p == null) ? (int)UserTypeStandard.Guest : p.TypeID, context.ObjectOwner)); } }
private dtoActivity GetActivity(liteProjectSettings project, litePmActivity activity, List <dtoLiteMapActivity> activities, Boolean firstLoad = false) { Person p = CurrentManager.GetPerson(UserContext.CurrentUserID); ModuleProjectManagement mPermission = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, project.IdCommunity, CurrentIdModule)); PmActivityPermission pPermissions = Service.GetProjectPermission(activity.IdProject, UserContext.CurrentUserID); dtoActivity dto = new dtoActivity(activity); Boolean allowEdit = (mPermission.Administration && !project.isPersonal) || pPermissions.HasFlag(PmActivityPermission.ManageProject); Boolean allowDelete = (mPermission.Administration && !project.isPersonal) || pPermissions.HasFlag(PmActivityPermission.ManageProject); dto.Permission = new dtoActivityPermission(pPermissions, allowEdit, allowDelete, project.AllowSummary, project.DateCalculationByCpm); dto.Permission.ViewPredecessors = dto.Permission.ViewPredecessors && !dto.IsSummary; dto.Permission.SetPredecessors = (allowEdit || pPermissions.HasFlag(PmActivityPermission.ManageLinks)) && project.DateCalculationByCpm && !dto.IsSummary; dto.Permission.SetDuration = dto.Permission.SetDuration && !dto.IsSummary; dto.Permission.SetResources = dto.Permission.SetResources && !dto.IsSummary; View.AllowDelete = allowDelete; View.AllowEdit = allowEdit; LoadLinks(dto, activities, firstLoad); return(dto); }
public void InitView(String plattformId, long idItem, Guid uniqueId, long idVersion, Guid uniqueIdVersion, ItemType type, long idLink, String language, Boolean saveCompleteness, Boolean isOnModal, Boolean refreshContainer, Boolean saveStatistics) { Guid playUniqueSessionId = Guid.NewGuid(); Guid workingSessionId = UserContext.WorkSessionID; String playSessionId = plattformId + "_" + playUniqueSessionId.ToString(); Int32 idUser = UserContext.CurrentUserID; View.IdItem = idItem; View.IdLink = idLink; View.IdVersion = idVersion; View.ItemType = type; View.SaveStatistics = saveStatistics; View.PlayUniqueSessionId = playUniqueSessionId; View.WorkingSessionId = workingSessionId; View.PlaySessionId = playSessionId; if (SessionTimeout()) { if (isOnModal) { View.DisplaySessionExpired(); } else { View.DisplaySessionTimeout(); } } else if (uniqueId == Guid.Empty || uniqueIdVersion == Guid.Empty) { InitViewForRedirect(idItem, uniqueId, idVersion, uniqueIdVersion, type, idLink, language, saveCompleteness, isOnModal, refreshContainer, saveStatistics); } else { if (String.IsNullOrWhiteSpace(language)) { language = ""; } liteRepositoryItem item = Service.ItemGet(idItem); liteRepositoryItemVersion version = Service.ItemGetVersion(idItem, idVersion); if (version != null && version.Id != idVersion) { View.IdVersion = version.Id; } if (item == null) { View.DisplayUnknownItem(); } else { liteFileTransfer fileTransfer = null; type = item.Type; View.ItemType = type; switch (type) { case ItemType.File: case ItemType.Folder: case ItemType.Link: case ItemType.SharedDocument: case ItemType.VideoStreaming: View.DisplayMessage(item.DisplayName, item.Extension, type, Domain.PlayerErrors.InvalidType); break; case ItemType.ScormPackage: case ItemType.Multimedia: liteModuleLink link = null; Boolean hasPermissions = false; View.ItemIdCommunity = item.IdCommunity; fileTransfer = Service.FileTransferGet(idItem, version.Id); if (idLink == 0) { hasPermissions = Service.HasPermissionToSeeItem(idUser, item, version, ModuleRepository.ActionType.PlayFile); } else { link = CurrentManager.Get <liteModuleLink>(idLink); if (link == null) { View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.NoPermissionToPlay); return; } else { if (link.DestinationItem.ObjectIdVersion > 0 && version != null && version.Id != link.DestinationItem.ObjectIdVersion) { version = Service.ItemGetVersion(idItem, link.DestinationItem.ObjectIdVersion); } ModuleObject obj = ModuleObject.CloneObject(link.DestinationItem); obj.ObjectIdVersion = (version != null ? version.Id : obj.ObjectIdVersion); saveCompleteness = link.AutoEvaluable && saveCompleteness; hasPermissions = View.HasPermissionForLink(UserContext.CurrentUserID, idLink, obj, item.Type, link.SourceItem.ServiceID, link.SourceItem.ServiceCode); View.ItemIdCommunity = link.SourceItem.CommunityID; } } Boolean playerLoaded = false; if (version == null) { View.DisplayPlayUnavailable(item.DisplayName, item.Extension, type, (idVersion > 0), ItemAvailability.notavailable, item.Status); } else if (type == ItemType.Multimedia && fileTransfer != null && String.IsNullOrEmpty(fileTransfer.DefaultDocumentPath)) { View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.InvalidSettings); } else if ((type == ItemType.Multimedia || type == ItemType.ScormPackage) && fileTransfer == null) { View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.InvalidTransfer); } else if (version.Availability == ItemAvailability.available) { playerLoaded = hasPermissions; if (hasPermissions) { LoadPlayer(idUser, playSessionId, workingSessionId, item, version, fileTransfer, link, language, saveCompleteness, isOnModal, refreshContainer, saveStatistics); } else { View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.NoPermissionToPlay); } } else { View.DisplayPlayUnavailable(item.DisplayName, item.Extension, type, (idVersion > 0 && item.HasVersions), item.Availability, item.Status); } if (!playerLoaded && !View.PreloadIsOnModal) { Boolean setBackUrl = View.PreloadSetBackUrl; String backUrl = View.PreloadBackUrl; View.BackUrl = (setBackUrl ? backUrl : ""); View.SetPageBackUrl(backUrl); } break; } } } }
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; } View.InEditing = new List <long>(); 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.SubmitterTemplateMail, type); View.LoadWizardSteps(idCall, type, idCommunity, steps); LoadTemplates(idCall); if (type == CallForPaperType.CallForBids) { View.SendUserAction(idCommunity, idModule, idCall, ModuleCallForPaper.ActionType.ViewSubmittersTemplate); } else { View.SendUserAction(idCommunity, idModule, idCall, ModuleRequestForMembership.ActionType.ViewSubmittersTemplate); } 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 static void RemoveListener(ColumnCollection source, IWeakEventListener listener) { CurrentManager.ProtectedRemoveListener(source, listener); }
public void InitView(long idProject) { dtoProject project = Service.GetdtoProject(idProject); if (project == null) { View.DisplayUnknownProject(); } else { Person p = CurrentManager.GetPerson(UserContext.CurrentUserID); ModuleProjectManagement mPermission = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, project.IdCommunity, CurrentIdModule)); PmActivityPermission pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID); if ((mPermission.Administration && !project.isPersonal) || (pPermissions.HasFlag(PmActivityPermission.ManageProject))) { View.LoadGantt(RootObject.GetGanttXML(project.Id, false, project.IdCommunity, project.isPortal, project.isPersonal)); } else { ProjectResource resource = Service.GetResource(idProject, UserContext.CurrentUserID); if (pPermissions.HasFlag(PmActivityPermission.ViewProjectMap) && (resource != null && (resource.Visibility == ProjectVisibility.Full || resource.Visibility == ProjectVisibility.InvolvedTasks))) { View.LoadGantt(RootObject.GetGanttXML(project.Id, false, project.IdCommunity, project.isPortal, project.isPersonal)); } else { View.DisplayNoPermissionToSeeProjectGantt(); } } } }
internal static void RemoveListener(FontSizeManager source, IWeakEventListener listener) { CurrentManager.ProtectedRemoveListener(source, listener); }
private long GetModulePermissions(Int32 idModule, Int32 idCommunity) { return(CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, idModule)); }
private void InitializeView(liteDashboardSettings settings, UserCurrentSettings userSettings, DisplaySearchItems search, String searchText, Boolean forSubscription = false) { List <dtoItemFilter <OrderItemsBy> > items = GetOrderByItems(settings, userSettings); Int32 idType = View.PreloadIdCommunityType; List <long> idTags = new List <long>(); long idTile = View.PreloadIdTile; View.EnableFullWidth((settings == null) ? false : settings.FullWidth); View.InitalizeTopBar(settings, userSettings, searchText); liteTile tile = null; if (idTile > 0) { tile = Service.GetTile(idTile); if (tile != null) { switch (tile.Type) { case TileType.CommunityType: if (tile.CommunityTypes != null) { idType = tile.CommunityTypes.FirstOrDefault(); idTile = -1; } break; case TileType.CommunityTag: case TileType.CombinedTags: if (tile.Tags != null && tile.Tags.Any(t => t.Tag != null) && tile.Tags.Any(t => t.Deleted == BaseStatusDeleted.None)) { idTags.AddRange(tile.Tags.Where(t => t.Tag != null && t.Deleted == BaseStatusDeleted.None).Select(t => t.Tag.Id).ToList()); } break; } } } View.TagsToLoad = idTags; Int32 idUserLanguage = ((UserContext != null && UserContext.Language != null) ? UserContext.Language.Id : -2); Int32 idDefaultLanguage = CurrentManager.GetDefaultIdLanguage(); List <lm.Comol.Core.DomainModel.Filters.Filter> fToLoad = ServiceCommunities.GetDefaultFilters(UserContext.CurrentUserID, searchText, idType, idTile, idTags, null, CommunityManagement.CommunityAvailability.Subscribed, -1).OrderBy(f => f.DisplayOrder).ToList(); View.LoadDefaultFilters(fToLoad); if (fToLoad != null && fToLoad.Any()) { lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters = new lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters(fToLoad, CommunityManagement.CommunityAvailability.Subscribed, idType, idTile); filters.IdcommunityType = idType; if (!String.IsNullOrEmpty(searchText)) { filters.SearchBy = CommunityManagement.SearchCommunitiesBy.Contains; } if (filters.IdcommunityType > -1) { tile = Service.GetTileForCommunityType(filters.IdcommunityType); } else if (idTags.Any() && idTile > 0) { filters.IdTags = idTags; } View.InitializeCommunitiesList(settings.Pages.Where(p => p.Type == DashboardViewType.Search).FirstOrDefault(), filters, items, tile, idUserLanguage, idDefaultLanguage); } else { if (idType > -1) { tile = Service.GetTileForCommunityType(idType); } View.InitializeCommunitiesList(settings.Pages.Where(p => p.Type == DashboardViewType.Search).FirstOrDefault(), items, tile, idUserLanguage, idDefaultLanguage); } View.SendUserAction(0, CurrentIdModule, settings.Id, (search == DisplaySearchItems.Advanced) ? ModuleDashboard.ActionType.SearchAdvancedDashboardLoad : ModuleDashboard.ActionType.SearchSimpleDashboardLoad); }
private void InitializeView(long idTemplate, long idVersion, dtoSelectorContext context) { TemplateDefinitionVersion version = InternalService.GetVersion(idTemplate, idVersion); if (version == null) { if (idVersion > 0) { View.DisplayNoTemplateVersionFound(); } else { View.DisplayNoTemplateFound(); } } else { if (idVersion > 0) { View.DisplayVersionInfo(version.Number); } else { View.DisplayLastVersionInfo(); } Boolean isAdministrative = InternalService.IsAdministrativeUser(UserContext.CurrentUserID); if (version.ChannelSettings != null && version.ChannelSettings.Where(c => c.Deleted == BaseStatusDeleted.None && c.Channel == lm.Comol.Core.Notification.Domain.NotificationChannel.Mail).Any()) { View.InitializeMailSettings(version.ChannelSettings.Where(c => c.Deleted == BaseStatusDeleted.None && c.Channel == lm.Comol.Core.Notification.Domain.NotificationChannel.Mail).FirstOrDefault().MailSettings, isAdministrative, isAdministrative, isAdministrative); } List <lm.Comol.Core.TemplateMessages.Domain.dtoTemplateTranslation> translations = new List <lm.Comol.Core.TemplateMessages.Domain.dtoTemplateTranslation>(); translations = (from t in version.Translations where t.Deleted == BaseStatusDeleted.None select new lm.Comol.Core.TemplateMessages.Domain.dtoTemplateTranslation() { Id = t.Id, IdLanguage = t.IdLanguage, LanguageCode = t.LanguageCode, LanguageName = t.LanguageName, Translation = t.Translation }).ToList(); translations.Add(new dtoTemplateTranslation() { Id = 0, IdLanguage = 0, LanguageCode = "multi", LanguageName = "multi", IdVersion = version.Id, Translation = version.DefaultTranslation }); View.ContentModules = version.GetModuleContentCodes(); List <Language> languages = CurrentManager.GetAllLanguages().ToList(); List <lm.Comol.Core.DomainModel.Languages.LanguageItem> inUseLanguages = translations.Select(t => new lm.Comol.Core.DomainModel.Languages.LanguageItem() { Id = t.IdLanguage, Code = t.LanguageCode, Name = t.LanguageName, IsMultiLanguage = (t.LanguageCode == "multi" && t.IdLanguage == 0), Status = (t.IsEmpty) ? DomainModel.Languages.ItemStatus.wrong : (t.Translation.IsValid(!version.OnlyShortText, version.HasShortText, true)) ? DomainModel.Languages.ItemStatus.valid : DomainModel.Languages.ItemStatus.warning }).ToList(); inUseLanguages.Where(l => languages.Where(ll => ll.isDefault && l.Id == ll.Id).Any()).ToList().ForEach(l => l.IsDefault = true); inUseLanguages.Where(l => l.Id > 0).ToList().ForEach(l => l.Name = languages.Where(ll => ll.Id == l.Id).Select(ll => ll.Name).FirstOrDefault()); inUseLanguages.Add(new lm.Comol.Core.DomainModel.Languages.LanguageItem() { Id = 0, Code = "multi", IsEnabled = true, IsMultiLanguage = true, Status = (version.DefaultTranslation.IsValid(!version.OnlyShortText, version.HasShortText, true)) ? lm.Comol.Core.DomainModel.Languages.ItemStatus.valid : lm.Comol.Core.DomainModel.Languages.ItemStatus.warning }); inUseLanguages = inUseLanguages.OrderByDescending(l => l.IsMultiLanguage).ThenBy(l => l.Name).ToList(); //if (!inUseLanguages.Any(l => l.IsMultiLanguage)) //{ // inUseLanguages.Add(new DomainModel.Languages.LanguageItem(){ IsMultiLanguage=true, }) //} lm.Comol.Core.DomainModel.Languages.LanguageItem current = inUseLanguages.Where(l => l.Id == UserContext.Language.Id).FirstOrDefault(); if (current == null && inUseLanguages.Any()) { current = inUseLanguages.Where(l => l.IsDefault).FirstOrDefault(); if (current == null) { current = inUseLanguages.Where(l => l.IsMultiLanguage).FirstOrDefault(); } } if (current == null && inUseLanguages.Any()) { current = inUseLanguages.FirstOrDefault(); } View.InitializeControls(translations, inUseLanguages, current); View.LoadTemplate((current != null) ? translations.Where(t => t.IdLanguage == current.Id && t.LanguageCode == current.Code).FirstOrDefault() : (translations.Any() ? translations[0] : null)); } // Boolean isAdministrative = Service.IsAdministrativeUser(UserContext.CurrentUserID); // Boolean senderEdit = isAdministrative; // List<lm.Comol.Core.TemplateMessages.Domain.dtoTemplateTranslation> translations = new List<lm.Comol.Core.TemplateMessages.Domain.dtoTemplateTranslation>(); // if (message.Template != null) { // Boolean onlyShortText = false; // Boolean hasShortText = false; // String tagTranslation = View.TagTranslation; // if (translations.Any() && !String.IsNullOrEmpty(tagTranslation)){ // List<lm.Comol.Core.DomainModel.Helpers.TemplatePlaceHolder> placeHolders = View.GetContentPlaceHolders(View.ContentModules); // foreach(lm.Comol.Core.DomainModel.Helpers.TemplatePlaceHolder pHolder in placeHolders.Where(t=> translations.Where(ct=> !ct.Translation.IsContentEmpty && ((!String.IsNullOrEmpty(ct.Translation.Body) && ct.Translation.Body.Contains(t.Tag)) || (!String.IsNullOrEmpty(ct.Translation.Subject) && ct.Translation.Subject.Contains(t.Tag)))).Any()) ){ // translations.Where(ct => !ct.Translation.IsContentEmpty && !String.IsNullOrEmpty(ct.Translation.Body) && ct.Translation.Body.Contains(pHolder.Tag)).ToList().ForEach(t => t.Translation.Body = t.Translation.Body.Replace(pHolder.Tag, String.Format(tagTranslation, pHolder.Tag, pHolder.Name))); // translations.Where(ct => !ct.Translation.IsContentEmpty && !String.IsNullOrEmpty(ct.Translation.Subject) && ct.Translation.Subject.Contains(pHolder.Tag)).ToList().ForEach(t => t.Translation.Subject = t.Translation.Subject.Replace(pHolder.Tag, String.Format(tagTranslation, pHolder.Tag, pHolder.Name))); // } // } // } // } }
public static void AddListener(object source, IWeakEventListener wListener) { CurrentManager.ProtectedAddListener(source, wListener); }
public static void AddListener(IBindingList source, IWeakEventListener listener) { CurrentManager.ProtectedAddListener(source, listener); }
public Term GetGlossaryItem(Int64 idTerm) { return(CurrentManager.Get <Term>(idTerm)); }
private List <Person> CreateProfiles(dtoImportSettings settings, Int32 idDefaultOrganization, ProfileExternalResource selectedItems, List <dtoImportedProfile> createdProfiles, List <dtoBaseProfile> notCreatedProfiles) { List <Person> profiles = new List <Person>(); Language language = CurrentManager.GetDefaultLanguage(); AuthenticationProvider provider = Service.GetAuthenticationProvider(settings.IdProvider); if (provider != null && language != null) { Boolean created = false; Int32 idPerson = 0; Int32 index = 1; foreach (ProfileAttributesRow row in selectedItems.Rows) { dtoBaseProfile baseItem = null; switch (settings.IdProfileType) { case (int)UserTypeStandard.ExternalUser: dtoExternal externalUser = CreateExternal(row); baseItem = externalUser; break; case (int)UserTypeStandard.Company: dtoCompany company = CreateCompanyUser(row); baseItem = company; break; case (int)UserTypeStandard.Employee: dtoEmployee employee = CreateEmployee(row); baseItem = employee; break; default: baseItem = new dtoBaseProfile(); break; } created = false; if (baseItem != null) { GenerateBaseProfile(baseItem, settings, row, provider.ProviderType, GetUserLanguage(row, language)); if (InternalService.isUniqueMail(baseItem.Mail)) { PersonInfo info = GeneratePersonInfo(row, baseItem); idPerson = View.AddUserProfile(baseItem, info, idDefaultOrganization, provider); if (idPerson > 0) { Person person = CurrentManager.GetPerson(idPerson); if (person != null) { created = AddAuthentication(person, baseItem, settings, row, provider); if (created) { Service.SetDefaultProvider(provider.Id, person.Id); } profiles.Add(person); createdProfiles.Add(new dtoImportedProfile() { Profile = baseItem, Info = info }); } } } if (!created) { notCreatedProfiles.Add(baseItem); } View.UpdateProfileCreation(0, index, created, baseItem.DisplayName); } else { View.UpdateProfileCreation(0, index, created, " // "); } index++; } } return(profiles); }
public void InitView() { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(RootObject.List(View.PreloadIdCommunity, View.PreloadTemplateType, View.PreloadOwnership, View.PreloadFromCookies, View.PreloadModuleCode, View.PreloadModulePermissions, View.PreloadModulePermissions)); } else { Int32 idCommunity = View.PreloadIdCommunity; if (idCommunity < 0) { idCommunity = UserContext.CurrentCommunityID; } View.IdManagerCommunity = idCommunity; TemplateType type = View.PreloadTemplateType; if (type == TemplateType.None) { type = TemplateType.User; } dtoBaseFilters filters = (View.PreloadFromCookies) ? View.GetFromCookies() : null; if (filters == null) { filters = new dtoBaseFilters(); filters.Ascending = true; filters.SearchForName = ""; filters.Status = TemplateStatus.Active; filters.TemplateType = type; //filters.SetLoadingType(type); switch (type) { case TemplateType.Module: filters.ModuleCode = View.PreloadModuleCode; break; } filters.Ascending = true; filters.OrderBy = TemplateOrder.ByName; filters.TranslationsStatus = View.GetTranslationsStatus(); filters.TranslationsType = View.GetTranslationsTypes(); filters.TemplateDisplay = TemplateDisplay.OnlyVisible; View.SaveToCookies(filters); } Int32 idUser = UserContext.CurrentUserID; Boolean allowView = false; Boolean allowAdd = false; String addUrl = ""; dtoModuleContext context = new dtoModuleContext(); context.ModuleCode = View.PreloadModuleCode; context.ModulePermissions = View.PreloadModulePermissions; context.IdCommunity = idCommunity; dtoBaseTemplateOwner ownerInfo = null; ModuleTemplateMessages module = null; switch (type) { case TemplateType.System: module = ModuleTemplateMessages.CreatePortalmodule(UserContext.UserTypeID, OwnerType.System); allowView = module.Administration || module.List; allowAdd = module.Administration || module.Add; if (allowAdd) { ownerInfo = new dtoBaseTemplateOwner() { IdCommunity = 0, IsPortal = true, Type = OwnerType.System, ModuleCode = View.PreloadModuleCode, IdModule = (String.IsNullOrEmpty(View.PreloadModuleCode) ? 0 : CurrentManager.GetModuleID(View.PreloadModuleCode)) }; addUrl = RootObject.Add(TemplateType.System, ownerInfo, idCommunity, View.PreloadModuleCode, View.PreloadModulePermissions); } context.LoaderType = TemplateLoaderType.System; context.IdModule = Service.ServiceModuleID(); context.Permissions = new ModuleGenericTemplateMessages(module); break; case TemplateType.Module: if (context.ModuleCode == ModuleTemplateMessages.UniqueCode) { context.IdModule = Service.ServiceModuleID(); module = Service.GetPermission(idCommunity, OwnerType.Module); context.ModulePermissions = module.GetPermissions(); allowView = module.Administration || module.List; allowAdd = module.Administration || module.Add; if (allowAdd) { ownerInfo = new dtoBaseTemplateOwner() { IdCommunity = idCommunity, IsPortal = (idCommunity == 0), Type = OwnerType.Module, ModuleCode = context.ModuleCode, IdModule = context.IdModule, ModulePermission = context.ModulePermissions }; addUrl = RootObject.Add(TemplateType.Module, ownerInfo, idCommunity, context.ModuleCode, context.ModulePermissions); } context.Permissions = new ModuleGenericTemplateMessages(module); context.LoaderType = TemplateLoaderType.Module; } else if (View.PreloadModulePermissions > 0) { context.IdModule = CurrentManager.GetModuleID(context.ModuleCode); long dbPermissions = CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, context.IdModule); context.Permissions = View.GetModulePermissions(context.ModuleCode, context.IdModule, dbPermissions, idCommunity, UserContext.UserTypeID); if (lm.Comol.Core.DomainModel.PermissionHelper.CheckPermissionSoft(dbPermissions, context.ModulePermissions)) { allowView = true; allowAdd = true; if (allowAdd) { ownerInfo = new dtoBaseTemplateOwner() { IdCommunity = idCommunity, IsPortal = (idCommunity == 0), Type = OwnerType.Module, ModuleCode = context.ModuleCode, IdModule = context.IdModule, ModulePermission = context.ModulePermissions }; addUrl = RootObject.Add(TemplateType.Module, ownerInfo, idCommunity, context.ModuleCode, context.ModulePermissions); } } context.LoaderType = TemplateLoaderType.OtherModule; } else { context.IdModule = CurrentManager.GetModuleID(context.ModuleCode); context.Permissions = View.GetModulePermissions(context.ModuleCode, context.IdModule, GetModulePermission(idCommunity, context.IdModule), idCommunity, UserContext.UserTypeID); context.LoaderType = TemplateLoaderType.OtherModule; allowView = context.Permissions.Administration || context.Permissions.List; allowAdd = context.Permissions.Administration || context.Permissions.Add; if (allowAdd) { ownerInfo = new dtoBaseTemplateOwner() { IdCommunity = idCommunity, IsPortal = (idCommunity == 0), Type = OwnerType.Module, ModuleCode = context.ModuleCode, IdModule = context.IdModule, ModulePermission = context.ModulePermissions }; addUrl = RootObject.Add(TemplateType.Module, ownerInfo, idCommunity, context.ModuleCode, context.ModulePermissions); } } break; case TemplateType.User: Person p = GetCurrentUser(ref idUser); allowView = (p != null && p.TypeID != (Int32)UserTypeStandard.Guest && p.TypeID != (Int32)UserTypeStandard.PublicUser); allowAdd = allowView; if (allowAdd) { ownerInfo = new dtoBaseTemplateOwner() { IdCommunity = idCommunity, IsPortal = (idCommunity == 0), Type = OwnerType.Person, IdPerson = UserContext.CurrentUserID, ModuleCode = View.PreloadModuleCode, IdModule = (String.IsNullOrEmpty(View.PreloadModuleCode) ? 0 : CurrentManager.GetModuleID(View.PreloadModuleCode)) }; addUrl = RootObject.Add(TemplateType.User, ownerInfo, idCommunity, context.ModuleCode, context.ModulePermissions); } context.LoaderType = TemplateLoaderType.User; context.Permissions = new ModuleGenericTemplateMessages("personal"); context.Permissions.Add = allowView; context.Permissions.Administration = allowView; context.Permissions.Clone = allowView; context.Permissions.DeleteMyTemplates = allowView; context.Permissions.Edit = allowView; context.Permissions.List = allowView; break; } if (allowView) { if (allowAdd) { View.SetAddUrl(addUrl); } switch (type) { case TemplateType.User: case TemplateType.System: View.InitializeList(context, filters, GetAvailableTypes(type), GetAvailableDisplay(type)); break; case TemplateType.Module: View.InitializeList(context, filters, GetAvailableTypes(type), GetAvailableDisplay(type)); break; } } else { View.DisplayNoPermission(idCommunity, Service.ServiceModuleID()); } } }
public void ChangeLetter(String letter, Int32 currentPage, Int32 pageSize, GlossaryFilter filter) { var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID); if (UserContext.isAnonymous || litePerson == null) { View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission); View.DisplaySessionTimeout(); return; } if (String.IsNullOrEmpty(letter)) { letter = AllChar; } if (pageSize == 0) { pageSize = 10; } Int32 records; var currentChar = letter[0]; var listValidId = GetIDGlossary(); //var currentLetterTermListAll = Service.GetDTO_TermListFromliteTerm(f => f.Deleted == BaseStatusDeleted.None , f => f.Name, currentPage, currentChar, pageSize, filter, out records).ToList(); Dictionary <string, CharInfo> words; var currentLetterTermList = Service.GetDTO_TermListFromliteTerm(f => f.Deleted == BaseStatusDeleted.None && listValidId.Contains(f.IdGlossary), f => f.Name, currentPage, currentChar, pageSize, filter, out records, out words).ToList(); var filteredTerms = new List <DTO_Term>(); var usedletterList = new List <String>(); var letterList = new List <CharInfo>(); var startIndex = currentPage == 0 ? 0 : 1; var endIndex = currentLetterTermList.Count; var lastChildLastPage = currentPage > 0 && currentLetterTermList.Count > 0 ? currentLetterTermList[0] : null; DTO_Term firstChildNextPage = null; var lastPageIndex = records % pageSize == 0 ? (records / pageSize) - 1 : (records / pageSize); if (currentLetterTermList.Count == pageSize + 1) { firstChildNextPage = currentLetterTermList[currentLetterTermList.Count - 1]; } else if (currentLetterTermList.Count == pageSize + 2) { firstChildNextPage = currentLetterTermList[currentLetterTermList.Count - 1]; } for (var index = startIndex; index < endIndex; index++) { var currentTerm = currentLetterTermList[index]; if (filteredTerms.Count >= pageSize) { break; } filteredTerms.Add(currentTerm); if (!usedletterList.Contains(currentTerm.FirstLetter.ToString())) { usedletterList.Add(currentTerm.FirstLetter.ToString()); var wordInPreviousPage = lastChildLastPage != null && lastChildLastPage.FirstLetter == currentTerm.FirstLetter; var wordInNextPage = firstChildNextPage != null && firstChildNextPage.FirstLetter == currentTerm.FirstLetter; if (lastPageIndex == currentPage || records < pageSize) { wordInNextPage = false; } letterList.Add(new CharInfo(currentTerm.FirstLetter.ToString(), wordInPreviousPage, wordInNextPage)); } } View.BindRepeaterList(filteredTerms, currentChar, records, currentPage, letterList); }
public long GetModulePermission(Int32 idCommunity, Int32 idModule) { return(CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, idModule)); }
public void AddCommunityClick(Int32 userId) { var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID); if (UserContext.isAnonymous || litePerson == null) { View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission); View.DisplaySessionTimeout(); return; } /* * Esempio da EditCallAvailabilityPresenter.cs * * Dictionary<Int32, long> rPermissions = new Dictionary<Int32, long>(); * Boolean forAdmin = (UserContext.UserTypeID == (Int32)UserTypeStandard.SysAdmin) || (UserContext.UserTypeID == (Int32)UserTypeStandard.Administrator) || (UserContext.UserTypeID == (Int32)UserTypeStandard.Administrative); * Core.BaseModules.CommunityManagement.CommunityAvailability availability = (forAdmin) ? Core.BaseModules.CommunityManagement.CommunityAvailability.All : Core.BaseModules.CommunityManagement.CommunityAvailability.Subscribed; * long permissions = -1; * switch (View.CallType) * { * case CallForPaperType.CallForBids: * permissions = (long)ModuleCallForPaper.Base2Permission.Admin | (long)ModuleCallForPaper.Base2Permission.ManageCalls | (long)ModuleCallForPaper.Base2Permission.AddCall; * break; * case CallForPaperType.RequestForMembership: * permissions = (long)ModuleRequestForMembership.Base2Permission.Admin | (long)ModuleRequestForMembership.Base2Permission.ManageRequests | (long)ModuleRequestForMembership.Base2Permission.AddRequest; * break; * } * rPermissions.Add(View.IdCallModule, permissions); * rPermissions.Add(CommunityService.ServiceModuleID(), (long)lm.Comol.Core.DomainModel.Domain.ModuleCommunityManagement.Base2Permission.Manage | (long)lm.Comol.Core.DomainModel.Domain.ModuleCommunityManagement.Base2Permission.AdminService); * List<Int32> idCommunities = CallService.GetIdCommunityAssignments(idCall); */ var forAdmin = UserContext.UserTypeID == (Int32)UserTypeStandard.SysAdmin || UserContext.UserTypeID == (Int32)UserTypeStandard.Administrator || UserContext.UserTypeID == (Int32)UserTypeStandard.Administrative; var availability = forAdmin ? CommunityAvailability.All : CommunityAvailability.Subscribed; var rPermissions = new Dictionary <Int32, Int64>(); rPermissions.Add(Service.GetServiceIdModule(), (long)(ModuleGlossaryNew.Base2Permission.Admin | ModuleGlossaryNew.Base2Permission.AddGlossary)); /* * switch (View.CallType) * { * case CallForPaperType.CallForBids: * permissions = (long)ModuleCallForPaper.Base2Permission.Admin | (long)ModuleCallForPaper.Base2Permission.ManageCalls | (long)ModuleCallForPaper.Base2Permission.AddCall; * break; * case CallForPaperType.RequestForMembership: * permissions = (long)ModuleRequestForMembership.Base2Permission.Admin | (long)ModuleRequestForMembership.Base2Permission.ManageRequests | (long)ModuleRequestForMembership.Base2Permission.AddRequest; * break; * } * * * rPermissions.Add(View.IdCallModule, permissions); * rPermissions.Add(CommunityService.ServiceModuleID(), (long)lm.Comol.Core.DomainModel.Domain.ModuleCommunityManagement.Base2Permission.Manage | (long)lm.Comol.Core.DomainModel.Domain.ModuleCommunityManagement.Base2Permission.AdminService); */ // Rimuovo la comunità corrente e le comunità su cui è già condiviso var unloadIdCommunities = GlossaryDisplayOrders(View.IdGlossary); if (!unloadIdCommunities.Contains(View.IdCommunity)) { unloadIdCommunities.Add(View.IdCommunity); } View.DisplayCommunityToAdd(forAdmin, rPermissions, unloadIdCommunities, availability); }
internal static void RemoveListener(ObservableColumnCollection source, IWeakEventListener listener) { CurrentManager.ProtectedRemoveListener(source, listener); }
/// <summary> /// Adds listener /// </summary> /// <param name="source"></param> /// <param name="listener"></param> public static void AddListener(TranslationManager source, IWeakEventListener listener) { CurrentManager.ProtectedAddListener(source, listener); }
public static void AddListener(Selector source, IWeakEventListener listener) { CurrentManager.ProtectedAddListener(source, listener); }
public static void AddListener(ColumnBase source, IWeakEventListener listener) { CurrentManager.ProtectedAddListener(source, listener); }