コード例 #1
0
        public void EnrollTo(Int32 idCommunity, String name, String path, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters)
        {
            Int32 idPerson = UserContext.CurrentUserID;

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Boolean reloadCommunities          = false;
                ModuleDashboard.ActionType dAction = ModuleDashboard.ActionType.None;
                dtoCommunityInfoForEnroll  item    = Service.GetEnrollingItem(idPerson, idCommunity, path);
                litePerson person = CurrentManager.GetLitePerson(idPerson);
                if (item != null && item.Id > 0 && person != null && person.Id > 0)
                {
                    if (!item.AllowEnroll)
                    {
                        dAction = ModuleDashboard.ActionType.EnrollNotAllowed;
                        View.DisplayEnrollMessage(item, dAction);
                    }
                    else
                    {
                        if (!item.HasConstraints && item.AllowUnsubscribe)
                        {
                            dtoEnrollment enrollment = Service.EnrollTo(idPerson, item);
                            if (enrollment == null)
                            {
                                dAction = ModuleDashboard.ActionType.UnableToEnroll;
                                View.DisplayEnrollMessage(item, dAction);
                            }
                            else
                            {
                                View.DisplayEnrollMessage(enrollment, enrollment.IdCommunity, person, Service.GetTranslatedProfileType(person), CurrentManager.GetUserDefaultOrganizationName(idPerson));
                                reloadCommunities = true;
                                dAction           = (enrollment.Status == EnrolledStatus.NeedConfirm) ? ModuleDashboard.ActionType.EnrollToCommunityWaitingConfirm : ModuleDashboard.ActionType.EnrollToCommunity;
                                lm.Comol.Core.DomainModel.Helpers.CacheHelper.PurgeCacheItems(lm.Comol.Core.BaseModules.CommunityManagement.Domain.CacheKeys.UserCommunitiesTree(idPerson));
                            }
                        }
                        else
                        {
                            dAction = ModuleDashboard.ActionType.RequireEnrollConfirm;
                            View.DisplayConfirmMessage(item);
                        }
                    }
                }
                else
                {
                    dAction = ModuleDashboard.ActionType.UnableToEnroll;
                    View.DisplayUnknownCommunity(name);
                }
                View.SendUserAction(0, CurrentIdModule, idCommunity, dAction);
                if (reloadCommunities)
                {
                    LoadTree(filters, View.AdvancedMode, View.ReferenceIdCommunity, false);
                }
            }
        }
コード例 #2
0
        public void EnrollTo(dtoCommunityInfoForEnroll community, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, Boolean advancedMode, Int32 idReferenceCommunity)
        {
            Int32 idPerson = UserContext.CurrentUserID;

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Boolean reloadCommunities = false;
                if (community != null)
                {
                    reloadCommunities = true;
                    litePerson person           = CurrentManager.GetLitePerson(idPerson);
                    String     profileType      = Service.GetTranslatedProfileType(person);
                    String     organizationName = CurrentManager.GetUserDefaultOrganizationName(idPerson);

                    dtoEnrollment enrollment = Service.EnrollTo(idPerson, community);
                    if (enrollment != null)
                    {
                        switch (enrollment.Status)
                        {
                        case EnrolledStatus.Available:
                        case EnrolledStatus.NeedConfirm:
                            lm.Comol.Core.DomainModel.Helpers.CacheHelper.PurgeCacheItems(lm.Comol.Core.BaseModules.CommunityManagement.Domain.CacheKeys.UserCommunitiesTree(idPerson));
                            //View.NotifyEnrollment(enrollment, person, profileType, organizationName);

                            View.SendUserAction(0, CurrentIdModule, community.Id, (enrollment.Status == EnrolledStatus.Available) ? ModuleDashboard.ActionType.EnrollToCommunity : ModuleDashboard.ActionType.EnrollToCommunityWaitingConfirm);
                            reloadCommunities = true;
                            break;
                        }
                        View.DisplayEnrollMessage(enrollment, enrollment.IdCommunity, person, Service.GetTranslatedProfileType(person), CurrentManager.GetUserDefaultOrganizationName(idPerson));
                    }
                    if (reloadCommunities)
                    {
                        LoadTree(filters, advancedMode, idReferenceCommunity, false);
                    }
                }
                else
                {
                    View.SendUserAction(0, CurrentIdModule, ModuleDashboard.ActionType.NoSelectedCommunitiesToEnroll);
                }
            }
        }
コード例 #3
0
        public void EnrollTo(Int32 idCommunity, String name, String path, Int32 itemsForPage, RangeSettings range, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsToSubscribeBy orderBy, Boolean ascending, Int32 pageIndex)
        {
            Int32 idPerson = UserContext.CurrentUserID;

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Boolean reloadCommunities          = false;
                ModuleDashboard.ActionType dAction = ModuleDashboard.ActionType.None;
                dtoCommunityInfoForEnroll  item    = Service.GetEnrollingItem(idPerson, idCommunity, path);
                litePerson person = CurrentManager.GetLitePerson(idPerson);
                if (item != null && item.Id > 0 && person != null && person.Id > 0)
                {
                    if (!item.AllowEnroll)
                    {
                        dAction = ModuleDashboard.ActionType.EnrollNotAllowed;
                        View.DisplayEnrollMessage(item, dAction);
                    }
                    else
                    {
                        if (!item.HasConstraints && item.AllowUnsubscribe)
                        {
                            dtoEnrollment enrollment = Service.EnrollTo(idPerson, item);
                            if (enrollment == null)
                            {
                                dAction = ModuleDashboard.ActionType.UnableToEnroll;
                                View.DisplayEnrollMessage(item, dAction);
                            }
                            else
                            {
                                View.DisplayEnrollMessage(enrollment, enrollment.IdCommunity, person, Service.GetTranslatedProfileType(person), CurrentManager.GetUserDefaultOrganizationName(idPerson));
                                UpdateSelectedItems(new List <Int32>()
                                {
                                    enrollment.IdCommunity
                                });
                                reloadCommunities = true;
                                dAction           = (enrollment.Status == EnrolledStatus.NeedConfirm) ? ModuleDashboard.ActionType.EnrollToCommunityWaitingConfirm : ModuleDashboard.ActionType.EnrollToCommunity;
                                lm.Comol.Core.DomainModel.Helpers.CacheHelper.PurgeCacheItems(lm.Comol.Core.BaseModules.CommunityManagement.Domain.CacheKeys.UserCommunitiesTree(idPerson));
                            }
                        }
                        else
                        {
                            dAction = ModuleDashboard.ActionType.RequireEnrollConfirm;
                            View.DisplayConfirmMessage(item);
                        }
                    }
                }
                else
                {
                    dAction = ModuleDashboard.ActionType.UnableToEnroll;
                    View.DisplayUnknownCommunity(name);
                }
                View.SendUserAction(0, CurrentIdModule, idCommunity, dAction);
                if (reloadCommunities)
                {
                    InternalLoadCommunities(itemsForPage, range, filters, orderBy, ascending, true, pageIndex, ModuleDashboard.ActionType.EnrollPageLoadcommunitiesAfterEnrolling);
                }
            }
        }