Example #1
0
 public dtoCommunityItem(lm.Comol.Core.DomainModel.liteCommunityInfo community, Int32 idCommunity)
 {
     if (community != null)
     {
         Id                                 = community.Id;
         Name                               = community.Name;
         IdOrganization                     = community.IdOrganization;
         IdType                             = community.IdTypeOfCommunity;
         CreatedOn                          = community.CreatedOn;
         ClosedOn                           = community.ClosedOn;
         SubscriptionStartOn                = community.SubscriptionStartOn;
         SubscriptionEndOn                  = community.SubscriptionEndOn;
         MaxUsersWithDefaultRole            = community.MaxUsersWithDefaultRole;
         MaxOverDefaultSubscriptionsAllowed = community.MaxOverDefaultSubscriptionsAllowed;
         AllowUnsubscribe                   = community.AllowUnsubscribe;
         AllowSubscription                  = community.AllowSubscription;
         if (community.isArchived)
         {
             Status = Communities.CommunityStatus.Stored;
         }
         else if (community.isClosedByAdministrator)
         {
             Status = Communities.CommunityStatus.Blocked;
         }
         else
         {
             Status = Communities.CommunityStatus.Active;
         }
         ConfirmSubscription = community.ConfirmSubscription;
     }
     else
     {
         Id     = -idCommunity;
         Status = Communities.CommunityStatus.Blocked;
     }
 }
        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);
        }
 public dtoCommunityPlainItem(lm.Comol.Core.BaseModules.CommunityManagement.dtoTreeCommunityNode node, List <lm.Comol.Core.BaseModules.CommunityManagement.dtoTreeCommunityNode> nodes, 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)
 {
     Paths = nodes.Select(i => new dtoPathItem()
     {
         IdFather = i.IdFather, FathersName = i.FathersName, isPrimary = i.isPrimary, Path = i.Path
     }).ToList();
     Community = CreateCommunity(node, community, associations, responsibles, cTimes, degreesTypes, cTypes, enrollment);
 }