コード例 #1
0
 public bool UnlinkUserFromAllGroups(User user)
 {
     SqlCommand cmd = GenerateCommand();
     UnlinkAllItemsAtOnce(new Guid("{4304A12F-8B13-4621-8F5D-5A224E9F61E6}"), user.ItemId, cmd);
     cmd.Transaction.Commit();
     return true;
 }
コード例 #2
0
 public bool DeleteUser(User deleteUser)
 {
     var cmd = GenerateCommand();
     UnlinkAllItemsAtOnce(new Guid("{4304A12F-8B13-4621-8F5D-5A224E9F61E6}"), deleteUser.ItemId, cmd);
     var query = GenerateQuery(new Guid("{E50E5ACF-5A12-469F-8374-DFDEDD1586C2}"), deleteUser.ItemId);
     var result = ExecuteNonQuery(query, cmd);
     cmd.Transaction.Commit();
     return true;
 }
コード例 #3
0
        public bool Create(User newUser)
        {
            if (newUser.ItemId.Equals(Guid.Empty))
            {
                newUser.ItemId = Guid.NewGuid();
            }

            SetFriendlyName(newUser);

            dataAccess.CreateUser(newUser);
            return true;
        }
コード例 #4
0
        public bool CreateUser(User createUser)
        {
            var query = GenerateQuery(new Guid("{ECAEB0D7-EA3B-4EFF-BB94-78584F71B5FF}"),
                createUser.ItemId,
                createUser.Name,
                createUser.FirstName,
                createUser.FriendlyName,
                createUser.Birthday.GetValueOrDefault(),
                createUser.OptiGemId.GetValueOrDefault(),
                createUser.LoginName,
                createUser.AuthorizedUntil.GetValueOrDefault(),
                createUser.eMailAddress
                );

            return ExecChangeLineQuery(query);
        }
コード例 #5
0
        public bool Edit(Guid userId, User newData)
        {
            User oldUser = GetItemById(userId);

            oldUser.AuthorizedUntil = newData.AuthorizedUntil;
            oldUser.Birthday = newData.Birthday;
            oldUser.eMailAddress = newData.eMailAddress;
            oldUser.FirstName = newData.FirstName;
            oldUser.Name = newData.Name;
            oldUser.OptiGemId = newData.OptiGemId;
            oldUser.LoginName = newData.LoginName;
            oldUser.FriendlyName = newData.FriendlyName;

            SetFriendlyName(oldUser);

            return dataAccess.UpdateUser(oldUser);
        }
コード例 #6
0
 public int GetCountUserGroups(User user)
 {
     var query = GenerateQuery(new Guid("{BD4E82CE-626A-41E4-B97C-0464D88DE01F}"), user.ItemId);
     var result = ExecScalar<int>(query);
     return result;
 }
コード例 #7
0
 public IList<UserGroup> GetAllPossibleUserGroupsForUser(User user)
 {
     var query = GenerateQuery(new Guid("{8969F494-77C3-4952-894A-D9350FF56A77}"), user.ItemId);
     var result = GetManyItems<UserGroup>(query, ReadGroup<UserGroup>);
     return result;
 }
コード例 #8
0
        public bool UpdateUser(User updateUser)
        {
            var query = GenerateQuery(new Guid("{DBF04FEE-7345-48C7-8F53-808971C41CA1}"),
                updateUser.ItemId,
                updateUser.Name,
                updateUser.FirstName,
                updateUser.FriendlyName,
                updateUser.Birthday.GetValueOrDefault(),
                updateUser.OptiGemId.GetValueOrDefault(),
                updateUser.LoginName,
                updateUser.AuthorizedUntil.GetValueOrDefault(),
                updateUser.eMailAddress
                );

            return ExecChangeLineQuery(query);
        }
コード例 #9
0
 public bool UnlinkUserFromUserGroup(User user, UserGroup group)
 {
     var query = GenerateQuery(new Guid("{659A4A2D-4452-4BF8-8F0B-0C9716933959}"), user.ItemId, group.ItemId);
     var result = ExecChangeLineQuery(query);
     return result;
 }
コード例 #10
0
 public bool LinkUserToUserGroup(User user, UserGroup group)
 {
     var query = GenerateQuery(new Guid("{190B5B7D-1630-474E-B5A1-CA4DAE7113F9}"), user.ItemId, group.ItemId);
     var result = ExecChangeLineQuery(query);
     return result;
 }
コード例 #11
0
 public bool IsUserInUserGroup(User user, UserGroup group)
 {
     var query = GenerateQuery(new Guid("{5B24F27B-4B96-4915-BA58-31F6ABF54537}"), user.ItemId, group.ItemId);
     var rowCount = ExecScalar<int>(query);
     var result = rowCount == 1;
     return result;
 }
コード例 #12
0
 public IList<UserGroup> GetUserGroupsOfUser(User user)
 {
     var query = GenerateQuery(new Guid("{2D66FC3F-7BBE-4E34-B85D-719CEF3152B1}"), user.ItemId);
     var result = GetManyItems<UserGroup>(query, ReadGroup<UserGroup>);
     return result;
 }
コード例 #13
0
 private User SetFriendlyName(User user)
 {
     user.FriendlyName = string.IsNullOrWhiteSpace(user.FirstName) ?
                                     user.Name :
                                     user.FirstName + " " + user.Name;
     return user;
 }
コード例 #14
0
 public bool UnlinkUserFromUserGroup(User user, Guid userGroupId)
 {
     var group = dataAccess.GetUserGroupById(userGroupId);
     var result = dataAccess.UnlinkUserFromUserGroup(user, group);
     return result;
 }
コード例 #15
0
 public bool UnlinkUserFromAllGroups(User user)
 {
     return dataAccess.UnlinkUserFromAllGroups(user);
 }
コード例 #16
0
        public bool LinkUserToUserGroup(User user, Guid userGroupId)
        {
            var group = dataAccess.GetUserGroupById(userGroupId);
            if (group == null)
            {
                return false;
            }

            var alreadyInGroup = dataAccess.IsUserInUserGroup(user, group);
            if (alreadyInGroup)
            {
                return false;
            }

            var result = dataAccess.LinkUserToUserGroup(user, group);
            return result;
        }