示例#1
0
        internal void Get_Create_Modify_User(Guid createUserId, Guid?modifyUserId, ref UserViewModel createUser, ref UserViewModel modifyUser)
        {
            var filters = new List <GenericDataFormat.FilterItems>();

            if (createUserId != null)
            {
                filters.Add(new GenericDataFormat.FilterItems()
                {
                    Property = "UserId", Operation = GenericDataFormat.FilterOperations.Equal, Value = createUserId, LogicalOperation = GenericDataFormat.LogicalOperations.Or
                });
            }

            if (modifyUserId != null)
            {
                filters.Add(new GenericDataFormat.FilterItems()
                {
                    Property = "UserId", Operation = GenericDataFormat.FilterOperations.Equal, Value = createUserId
                });
            }
            var requestBody = new GenericDataFormat()
            {
                Filters = filters
            };
            var users = this.GetView <UserViewModel>(requestBody).PageItems;

            createUser = users.SingleOrDefault(x => x.UserId == createUserId);
            if (modifyUserId != null)
            {
                modifyUser = users.SingleOrDefault(x => x.UserId == modifyUserId);
            }
        }
示例#2
0
 internal static bool IsAdmin(UserViewModel user)
 {
     return(user.UserTypeID == DBEnums.UserType.Admin);
 }