Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
                }
            }
        }
        private lm.Comol.Core.Dashboard.Domain.dtoCommunityItem CreateCommunity(lm.Comol.Core.BaseModules.CommunityManagement.dtoTreeCommunityNode node, lm.Comol.Core.DomainModel.liteCommunityInfo community, Dictionary <Int32, List <long> > associations, Dictionary <Int32, String> responsibles, Dictionary <Int32, String> cTimes, Dictionary <Int32, String> degreesTypes, Dictionary <Int32, String> cTypes, lm.Comol.Core.DomainModel.liteSubscriptionInfo enrollment = null)
        {
            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 = "";
            }
            if (cTimes != null && cTimes.ContainsKey(node.IdCourseTime))
            {
                dto.CourseTime = cTimes[node.IdCourseTime];
            }
            else
            {
                dto.CourseTime = "";
            }
            if (degreesTypes != null && degreesTypes.ContainsKey(node.IdDegreeType))
            {
                dto.DegreeType = degreesTypes[node.IdDegreeType];
            }
            else
            {
                dto.DegreeType = "";
            }
            if (cTypes.ContainsKey(node.IdCommunityType))
            {
                dto.CommunityType = cTypes[node.IdCommunityType];
            }

            if (enrollment != null)
            {
                IdRole           = enrollment.IdRole;
                LastAccessOn     = enrollment.LastAccessOn;
                SubscribedOn     = enrollment.SubscribedOn;
                PreviousAccessOn = enrollment.PreviousAccessOn;
                if (enrollment.Accepted && enrollment.Enabled)
                {
                    if (Community != null && Community.Status != Communities.CommunityStatus.Blocked)
                    {
                        Status = DomainModel.SubscriptionStatus.activemember;
                    }
                    else
                    {
                        Status = DomainModel.SubscriptionStatus.communityblocked;
                    }
                }
                else if (!enrollment.Enabled && enrollment.Accepted)
                {
                    Status = DomainModel.SubscriptionStatus.blocked;
                }
                else if (!enrollment.Accepted)
                {
                    Status = DomainModel.SubscriptionStatus.waiting;
                }
            }
            return(dto);
        }