Exemple #1
0
 public dtoBaseDashboardSettings(liteDashboardSettings s)
 {
     Id          = s.Id;
     Deleted     = s.Deleted;
     Name        = s.Name;
     Description = s.Description;
     Type        = s.Type;
     Status      = s.Status;
     ForAll      = s.ForAll;
     Active      = s.Active;
     IdCommunity = s.IdCommunity;
     if (s.Assignments.Any())
     {
         Assignments = s.Assignments.Where(a => a.Deleted == BaseStatusDeleted.None).Select(a =>
                                                                                            new dtoDashboardAssignment()
         {
             Id            = a.Id,
             IdPerson      = a.IdPerson,
             IdProfileType = a.IdProfileType,
             IdRole        = a.IdRole,
             Type          = a.Type
         }).ToList();
     }
     else
     {
         Assignments = new List <dtoDashboardAssignment>();
     }
 }
Exemple #2
0
 public dtoHomeSettingsStep(WizardDashboardStep type, liteDashboardSettings settings)
     : base(type)
 {
     if (settings != null)
     {
         Pages = settings.Pages.Where(p => p.Deleted == BaseStatusDeleted.None && p.Type != DashboardViewType.Subscribe && p.Type != DashboardViewType.Search).Count();
         if (Pages == 0)
         {
             Errors.Add(EditingErrors.NoViews);
         }
         Status = ((Pages == 0) ? Core.Wizard.WizardItemStatus.warning : Core.Wizard.WizardItemStatus.valid);
     }
     else
     {
         Status = Wizard.WizardItemStatus.disabled;
     }
 }
        public dtoDashboardSettings(liteDashboardSettings s, ModuleDashboard permissions, Int32 idCurrentUser, Dictionary <lm.Comol.Core.Dashboard.Domain.AvailableStatus, String> status)
        {
            Id               = s.Id;
            Deleted          = s.Deleted;
            Name             = s.Name;
            Description      = s.Description;
            Type             = s.Type;
            Status           = s.Status;
            ForAll           = s.ForAll;
            Active           = s.Active;
            FullWidth        = s.FullWidth;
            IdCommunity      = s.IdCommunity;
            IdCreatedBy      = s.IdCreatedBy;
            IdModifiedBy     = s.IdModifiedBy;
            ModifiedOn       = s.ModifiedOn;
            TranslatedStatus = status[s.Status];
            if (s.Assignments.Any())
            {
                Assignments = s.Assignments.Where(a => (s.Deleted == BaseStatusDeleted.None && a.Deleted == BaseStatusDeleted.None) || (s.Deleted == BaseStatusDeleted.Manual && a.Deleted == BaseStatusDeleted.Cascade)).Select(a =>
                                                                                                                                                                                                                                 new dtoDashboardAssignment()
                {
                    Id            = a.Id,
                    IdPerson      = a.IdPerson,
                    IdProfileType = a.IdProfileType,
                    IdRole        = a.IdRole,
                    Type          = a.Type
                }).ToList();
            }
            else
            {
                Assignments = new List <dtoDashboardAssignment>();
            }

            Boolean editingEnabled = true;// (s.Type != sType.CommunityType || (s.CommunityTypes != null && !s.CommunityTypes.Where(i => idCommunityTypes.Contains(i)).Any()));

            Permissions = new dtoPermission();

            Permissions.AllowView           = permissions.List || permissions.Administration || permissions.Edit;
            Permissions.AllowDelete         = editingEnabled && s.Deleted == BaseStatusDeleted.Manual && (permissions.Administration || permissions.DeleteOther || (permissions.DeleteMy && idCurrentUser == s.IdCreatedBy));
            Permissions.AllowVirtualDelete  = editingEnabled && !(s.ForAll && s.Active) && s.Deleted == BaseStatusDeleted.None && (permissions.Administration || permissions.DeleteOther || (permissions.DeleteMy && idCurrentUser == s.IdCreatedBy));
            Permissions.AllowUnDelete       = editingEnabled && s.Deleted == BaseStatusDeleted.Manual && (permissions.Administration || permissions.DeleteOther || (permissions.DeleteMy && idCurrentUser == s.IdCreatedBy));
            Permissions.AllowEdit           = s.Deleted == BaseStatusDeleted.None && (permissions.Administration || permissions.Edit);
            Permissions.AllowSetAvailable   = (s.Pages != null && s.Pages.Where(p => p.Deleted == BaseStatusDeleted.None).Any()) && s.Deleted == BaseStatusDeleted.None && s.Status != lm.Comol.Core.Dashboard.Domain.AvailableStatus.Available && (permissions.Administration || permissions.Edit);
            Permissions.AllowSetUnavailable = !(s.ForAll && s.Active) && s.Deleted == BaseStatusDeleted.None && s.Status == lm.Comol.Core.Dashboard.Domain.AvailableStatus.Available && (permissions.Administration || permissions.Edit);
            Permissions.AllowClone          = s.Deleted == BaseStatusDeleted.None && (permissions.Administration || permissions.Clone);
        }
Exemple #4
0
 public dtoViewSettings(liteDashboardSettings s)
     : this()
 {
     Id        = s.Id;
     Deleted   = s.Deleted;
     Name      = s.Name;
     Type      = s.Type;
     Status    = s.Status;
     ForAll    = s.ForAll;
     Active    = s.Active;
     FullWidth = s.FullWidth;
     if (s.Pages.Any())
     {
         Pages = s.Pages.Select(p =>
                                new dtoPageSettings()
         {
             Id = p.Id,
             AutoUpdateLayout       = p.AutoUpdateLayout,
             DisplayAsTile          = p.DisplayAsTile,
             Deleted                = p.Deleted,
             Type                   = p.Type,
             MaxItems               = p.MaxItems,
             MaxMoreItems           = p.MaxMoreItems,
             PlainLayout            = p.PlainLayout,
             TileLayout             = p.TileLayout,
             MiniTileDisplayItems   = p.MiniTileDisplayItems,
             Noticeboard            = p.Noticeboard,
             Range                  = p.Range,
             More                   = p.More,
             TileRedirectOn         = p.TileRedirectOn,
             ExpandOrganizationList = p.ExpandOrganizationList,
         }).ToList();
     }
     if (s.Container != null)
     {
         Container.AvailableGroupBy = s.Container.AvailableGroupBy.ToList();
         Container.AvailableOrderBy = s.Container.AvailableOrderBy.ToList();
         Container.AvailableViews   = s.Container.AvailableViews.ToList();
         Container.Default          = s.Container.Default;
     }
 }
Exemple #5
0
        public virtual object Clone()
        {
            liteDashboardSettings clone = new liteDashboardSettings();

            clone.Type         = Type;
            clone.IdCommunity  = IdCommunity;
            clone.Container    = (ContainerSettings)Container.Clone();
            clone.Pages        = Pages.Select(p => (litePageSettings)p.Clone()).ToList();
            clone.ForAll       = ForAll;
            clone.FullWidth    = FullWidth;
            clone.Status       = Status;
            clone.IdCreatedBy  = IdCreatedBy;
            clone.IdModifiedBy = IdModifiedBy;
            clone.ModifiedOn   = ModifiedOn;
            clone.Active       = (Active) ? false : Active;
            if (Assignments.Any())
            {
                clone.Assignments = Assignments.Where(a => a.Deleted == BaseStatusDeleted.None).Select(a => (liteDashboardAssignment)a.Clone()).ToList();
            }
            clone.Deleted = Deleted;
            clone.Id      = Id;
            return(clone);
        }
Exemple #6
0
 public dtoSettingsStep(WizardDashboardStep type, liteDashboardSettings settings)
     : base(type)
 {
     DashboardStatus = (settings == null) ? AvailableStatus.Draft : settings.Status;
     if (settings != null)
     {
         Persons      = settings.GetAssignments(DashboardAssignmentType.User).Count();
         Roles        = settings.GetAssignments(DashboardAssignmentType.RoleType).Count();
         ProfileTypes = settings.GetAssignments(DashboardAssignmentType.ProfileType).Count();
         if (!settings.ForAll && Persons == 0 && Roles == 0 && ProfileTypes == 0)
         {
             Errors.Add(EditingErrors.NoAssignedItems);
             Status = Wizard.WizardItemStatus.warning;
         }
         else
         {
             Status = Wizard.WizardItemStatus.valid;
         }
     }
     else
     {
         Status = Wizard.WizardItemStatus.none;
     }
 }