コード例 #1
0
        private static bool IsDuplicateName(string newName, int userId)
        {
            LightboxFinder finder = new LightboxFinder {
                UserId = userId, Name = newName
            };
            int count = Lightbox.GetCount(finder);

            return(count > 0);
        }
コード例 #2
0
        public static void EnsureUserHasDefaultLightbox(User user)
        {
            if (user.IsNew || user.IsNull)
            {
                return;
            }

            LightboxFinder finder = new LightboxFinder {
                UserId = user.UserId.GetValueOrDefault(), IsDefault = true
            };
            int count = Lightbox.GetCount(finder);

            if (count == 0)
            {
                Lightbox lb = Lightbox.New();
                lb.UserId     = user.UserId.GetValueOrDefault();
                lb.Name       = "My Assets";
                lb.IsDefault  = true;
                lb.CreateDate = DateTime.Now;
                Lightbox.Update(lb);

                AuditLogManager.LogUserAction(user, AuditUserAction.AddLightbox, "System created default lightbox as there were no other ligthboxes");
            }
        }