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); }
public static dtoTreeCommunityNode FullClone(dtoTreeCommunityNode node, dtoTreeCommunityNode father) { dtoTreeCommunityNode item = new dtoTreeCommunityNode() { Id = node.Id, IdFather = node.IdFather, IdOrganization = node.IdOrganization, IdFirstFatherOrganization = node.IdFirstFatherOrganization, IdResponsible = node.IdResponsible, Name = node.Name, ToolTip = node.ToolTip, isPrimary = node.isPrimary, IdCommunityType = node.IdCommunityType, Type = node.Type, Status = node.Status, Selected = node.Selected, AccessAvailable = node.AccessAvailable, IdDegreeType = node.IdDegreeType, IdCourseTime = node.IdCourseTime, CourseCode = node.CourseCode, Year = node.Year, Path = node.Path, FathersName = node.FathersName, IdCreatedBy = node.IdCreatedBy, Father = father, FirstFather = father, ConfirmSubscription = node.ConfirmSubscription, isClosedByAdministrator = node.isClosedByAdministrator, }; item.Nodes = node.Nodes.Select(n => dtoTreeCommunityNode.FullClone(n, item)).ToList(); return(item); }
public object Clone() { dtoTreeCommunityNode item = new dtoTreeCommunityNode() { Id = Id, IdFather = IdFather, IdOrganization = IdOrganization, IdFirstFatherOrganization = IdFirstFatherOrganization, IdResponsible = IdResponsible, Name = Name, ToolTip = ToolTip, isPrimary = isPrimary, IdCommunityType = IdCommunityType, Type = Type, Status = Status, Selected = Selected, AccessAvailable = AccessAvailable, Nodes = new List <dtoTreeCommunityNode>(), IdDegreeType = IdDegreeType, IdCourseTime = IdCourseTime, CourseCode = CourseCode, Year = Year, Path = Path, FathersName = FathersName, IdCreatedBy = IdCreatedBy, ConfirmSubscription = ConfirmSubscription, isClosedByAdministrator = isClosedByAdministrator, }; return(item); }
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 dtoTreeCommunityNode InternalFilter(dtoCommunitiesFilters filter, Int32 IdDefaultOrganization, List <Int32> onlyFromOrganizations = null) { dtoTreeCommunityNode root = (dtoTreeCommunityNode)this.Clone(); if (root.Type != dtoCommunityNodeType.Root && filter.Status != CommunityStatus.None && filter.Status != this.Status) { root.Type = dtoCommunityNodeType.NotSelectable; } if (root.Type != dtoCommunityNodeType.Root && root.Type != dtoCommunityNodeType.NotSelectable && filter.Availability != CommunityAvailability.All) { root.Type = (filter.Availability == CommunityAvailability.NotSubscribed && this.Selected) ? dtoCommunityNodeType.NotSelectable : this.Type; } if (root.Type != dtoCommunityNodeType.NotSelectable && this.IdOrganization == IdDefaultOrganization && this.IdFather == 0) { root.Type = dtoCommunityNodeType.NotSelectable; } if (root.Type != dtoCommunityNodeType.Root && !HasNodes(filter)) { return(root); } else { foreach (dtoTreeCommunityNode n in this.Nodes.Where(n => onlyFromOrganizations == null || (onlyFromOrganizations != null && onlyFromOrganizations.Contains(n.IdOrganization))).OrderBy(nn => nn.Name).ToList()) { if (n.HasNodes(filter)) { dtoTreeCommunityNode subNode = n.InternalFilter(filter, IdDefaultOrganization, onlyFromOrganizations); if (subNode != null) { root.Nodes.Add(subNode); } } } if (root.Type == dtoCommunityNodeType.Root) { root.Type = dtoCommunityNodeType.Root; } return(root); } }
protected void VerifyChildrenNotSelectableForSubscription(dtoTreeCommunityNode node) { if (node.ConfirmSubscription && node.Selected && AccessAvailable && node.Status == CommunityStatus.Active) { foreach (dtoTreeCommunityNode n in node.Nodes) { if (n.Status == CommunityStatus.Active && !n.Selected) { n.Type = dtoCommunityNodeType.Active; } else if (n.HasAvailableNodesForSubscription()) { VerifyChildrenNotSelectableForSubscription(n); } } } else { foreach (dtoTreeCommunityNode n in node.Nodes.Where(i => i.HasAvailableNodesForSubscription())) { VerifyChildrenNotSelectableForSubscription(n); } } }