public void InitView(Int32 idCommunity, Boolean fromPage, String url = "", Boolean fromSession = false) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { if (fromSession && idCommunity == 0) { idCommunity = UserContext.CurrentCommunityID; } View.DashboardIdCommunity = idCommunity; liteCommunityInfo community = CurrentManager.GetLiteCommunityInfo(idCommunity); if (community == null) { View.DisplayUnknownCommunity(); View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, idCommunity, ModuleDashboard.ActionType.LoadingUnknownCommunityDetails); } else { View.SetTitle(community.Name); View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, idCommunity, ModuleDashboard.ActionType.LoadingCommunityDetails); View.InitializeDetails(community); } } }
public dtoCommunityInfoForEnroll(Int32 idCommunity, String path, liteCommunityInfo community, Dictionary <Int32, Int32> dRoles, Dictionary <Int32, long> enrolledUsers) { NotAvailableFor = new List <EnrollingStatus>(); Constraints = new List <dtoCommunityConstraint>(); AllowSubscription = !(community == null); Id = idCommunity; Path = path; EnrolledOn = DateTime.Now; EnrolledUsers = (enrolledUsers != null && enrolledUsers.ContainsKey(idCommunity)) ? enrolledUsers[idCommunity] : 0; IdDefaultRole = (dRoles != null && community != null && dRoles.ContainsKey(community.IdTypeOfCommunity)) ? dRoles[community.IdTypeOfCommunity] : 0; if (community != null) { if (community.isArchived) { Status = Communities.CommunityStatus.Stored; } else if (community.isClosedByAdministrator) { Status = Communities.CommunityStatus.Blocked; } else { Status = Communities.CommunityStatus.Active; } Name = community.Name; AllowSubscription = community.AllowSubscription; AllowUnsubscribe = community.AllowUnsubscribe; ConfirmSubscription = community.ConfirmSubscription; MaxOverDefaultSubscriptionsAllowed = community.MaxOverDefaultSubscriptionsAllowed; MaxUsersWithDefaultRole = community.MaxUsersWithDefaultRole; SubscriptionEndOn = community.SubscriptionEndOn; SubscriptionStartOn = community.SubscriptionStartOn; if (!AllowSubscription) { NotAvailableFor.Add(EnrollingStatus.Unavailable); } else { if (!IsAvailableForSubscriptionStartOn(DateTime.Now)) { NotAvailableFor.Add(EnrollingStatus.StartDate); } else if (!IsAvailableForSubscriptionEndOn(DateTime.Now)) { NotAvailableFor.Add(EnrollingStatus.EndDate); } } } else { Id = -Id; } if (AvailableSeats <= 0) { NotAvailableFor.Add(EnrollingStatus.Seats); } }
public void InitView(Int32 idCommunity) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { if (idCommunity == 0) { View.RedirectToPortalHomePage(); } else { liteCommunityInfo community = CurrentManager.GetLiteCommunityInfo(idCommunity); if (community == null) { View.DisplayUnknownCommunity(); } else if (community.isClosedByAdministrator) { View.DisplayCommunityBlock(community.Name); } else { liteSubscriptionInfo subscription = CurrentManager.GetLiteSubscriptionInfo(UserContext.CurrentUserID, idCommunity); if (subscription == null || subscription.IdRole < 0) { View.DisplayNotEnrolledIntoCommunity(community.Name); } else if (subscription.Accepted && subscription.Enabled) { View.LogonToCommunity(idCommunity, UserContext.CurrentUserID); } else if (subscription.Accepted && !subscription.Enabled) { View.DisplayNoAccessToCommunity(community.Name); } else if (!subscription.Accepted && !subscription.Enabled) { View.DisplayWaitingActivaction(community.Name); } } } } }
public void InitView(liteCommunityInfo community) { View.LoadUserInfo(Service.GetResponsible(community.Id), (community.IdCreatedBy > 0) ? CurrentManager.GetLitePerson(community.IdCreatedBy) : null); Int32 idLanguage = UserContext.Language.Id; Language l = CurrentManager.GetDefaultLanguage(); List <String> tags = ServiceTags.GetCommunityAssociationToString(community.Id, idLanguage, l.Id, true); if (tags != null && tags.Any()) { View.LoadTags(tags, community.IdTypeOfCommunity); } List <dtoEnrollmentsDetailInfo> items = Service.GetEnrollmentsInfo(community.Id, community.IdTypeOfCommunity, UserContext.Language.Id); View.LoadEnrollmentsInfo(community, items, items.Select(i => i.Count).Sum(), Service.GetWaitingEnrollments(community.Id)); View.LoadConstraints(Service.GetDtoCommunityConstraints(community.Id, UserContext.CurrentUserID)); View.LoadDetails(community, Service.GetTranslatedCommunityType(idLanguage, community.IdTypeOfCommunity), Service.GetDescription(community.Id)); }
public dtoUnsubscribeTreeNode(liteCommunityInfo community, liteSubscriptionInfo subscription, String path) { Id = community.Id; IdFather = community.IdFather; IdCreatedBy = community.IdCreatedBy; IdOrganization = community.IdOrganization; this.isPrimary = true; Name = community.Name; Path = path; AllowUnsubscriptionFromOrganization = true; CommunityAllowUnsubscribe = community.AllowUnsubscribe; CommunitySubscriptionEndOn = community.SubscriptionEndOn; CommunityStatus = (community.isClosedByAdministrator) ? CommunityStatus.Blocked : ((community.isArchived) ? CommunityStatus.Stored : CommunityStatus.Active); Nodes = new List <dtoUnsubscribeTreeNode>(); SubscriptionStatus = GetSubscriptionStatus(subscription); IdRole = (subscription != null) ? subscription.IdRole : -3; CommunityAllowSubscription = community.AllowSubscription; MaxUsersWithDefaultRole = community.MaxUsersWithDefaultRole; }
public dtoNodeDetails(liteCommunityInfo community, Int32 idCommunity, Dictionary <Int32, long> enrolledUsers = null, List <liteCommunityConstraint> constraints = null, liteSubscriptionInfo enrollment = null) { Permissions = new dtoCommunityNodeItemPermission(); NotAvailableFor = new List <EnrollingStatus>(); Constraints = new List <dtoCommunityConstraint>(); Community = new lm.Comol.Core.Dashboard.Domain.dtoCommunityItem(community, idCommunity); if (enrollment != null) { LastAccessOn = enrollment.LastAccessOn; EnrolledOn = enrollment.SubscribedOn; } if (AvailableSeats <= 0) { NotAvailableFor.Add(EnrollingStatus.Seats); } if (!Community.AllowSubscription) { NotAvailableFor.Add(EnrollingStatus.Unavailable); } else { if (!Community.IsAvailableForSubscriptionStartOn(DateTime.Now)) { NotAvailableFor.Add(EnrollingStatus.StartDate); } else if (!Community.IsAvailableForSubscriptionEndOn(DateTime.Now)) { NotAvailableFor.Add(EnrollingStatus.EndDate); } } if (enrolledUsers != null && enrolledUsers.ContainsKey(idCommunity)) { EnrolledUsers = enrolledUsers[idCommunity]; if (AvailableSeats <= 0) { NotAvailableFor.Add(EnrollingStatus.Seats); } } }
public dtoEnrollment(DateTime enrollOn, liteCommunityInfo community, List <dtoCommunityConstraint> constraints) { NotAvailableFor = new List <EnrollingStatus>(); Constraints = constraints; IdCommunity = community.Id; CommunityName = community.Name; EnrollOn = enrollOn; if (!community.AllowSubscription) { NotAvailableFor.Add(EnrollingStatus.Unavailable); } else { if (!IsAvailableForSubscriptionStartOn(DateTime.Now)) { NotAvailableFor.Add(EnrollingStatus.StartDate); } else if (!IsAvailableForSubscriptionEndOn(DateTime.Now)) { NotAvailableFor.Add(EnrollingStatus.EndDate); } } if (constraints.Where(c => !c.IsRespected).Any()) { NotAvailableFor.Add(EnrollingStatus.Constraints); } if (NotAvailableFor.Any()) { Status = EnrolledStatus.NotAvailable; } else { Status = EnrolledStatus.None; } ExtendedInfo = new dtoEnrollmentInfo(); }
private lm.Comol.Core.Dashboard.Domain.dtoCommunityItem CreateCommunity(lm.Comol.Core.BaseModules.CommunityManagement.dtoTreeCommunityNode node, liteCommunityInfo community, Dictionary <Int32, List <long> > associations, Dictionary <Int32, String> responsibles) { lm.Comol.Core.Dashboard.Domain.dtoCommunityItem dto = new lm.Comol.Core.Dashboard.Domain.dtoCommunityItem(); dto.Id = node.Id; dto.IdOrganization = node.IdOrganization; dto.IdTags = (associations.ContainsKey(node.Id) ? associations[node.Id] : new List <long>()); dto.IdType = node.IdCommunityType; dto.Name = node.Name; dto.Status = node.Status; if (community.isArchived) { dto.Status = Communities.CommunityStatus.Stored; } else if (community.isClosedByAdministrator) { dto.Status = Communities.CommunityStatus.Blocked; } else { dto.Status = Communities.CommunityStatus.Active; } dto.Tags = new List <string>(); dto.AllowSubscription = community.AllowSubscription; dto.AllowUnsubscribe = community.AllowUnsubscribe; dto.ClosedOn = community.ClosedOn; dto.MaxOverDefaultSubscriptionsAllowed = community.MaxOverDefaultSubscriptionsAllowed; dto.MaxUsersWithDefaultRole = community.MaxUsersWithDefaultRole; dto.SubscriptionEndOn = community.SubscriptionEndOn; dto.ConfirmSubscription = community.ConfirmSubscription; dto.SubscriptionStartOn = community.SubscriptionStartOn; if (node.Year > 0) { dto.Year = node.Year.ToString() + "/" + (node.Year + 1).ToString(); } else { dto.Year = ""; } if (responsibles != null && responsibles.ContainsKey(node.IdResponsible)) { dto.Responsible = responsibles[node.IdResponsible]; } else { dto.Responsible = ""; } dto.CourseTime = ""; dto.DegreeType = ""; return(dto); }
public dtoEnrollingItem(lm.Comol.Core.BaseModules.CommunityManagement.dtoTreeCommunityNode node, liteCommunityInfo community, Dictionary <Int32, List <long> > associations, Dictionary <Int32, String> responsibles, Dictionary <bool, List <string> > aPaths = null) { NotAvailableFor = new List <EnrollingStatus>(); Constraints = new List <dtoCommunityConstraint>(); if (aPaths == null) { PrimaryPath = node.Path; AvailablePath = new List <string>() { node.Path }; } else { PrimaryPath = "";// (node.isPrimary) ? node.Path : ""; AvailablePath = new List <string>(); if (aPaths.ContainsKey(true)) { AvailablePath.Add(aPaths[true].FirstOrDefault()); } if (aPaths.ContainsKey(false)) { AvailablePath.AddRange(aPaths[false]); } } Community = CreateCommunity(node, community, associations, responsibles); }