示例#1
0
 public static SoftFluent.Samples.Thinktecture.IdentityServer.LoginCollection PageLoadByUser(int pageIndex, int pageSize, System.Guid userId)
 {
     SoftFluent.Samples.Thinktecture.IdentityServer.User user = SoftFluent.Samples.Thinktecture.IdentityServer.User.Load(userId);
     if ((user == null))
     {
         return(new SoftFluent.Samples.Thinktecture.IdentityServer.LoginCollection());
     }
     return(SoftFluent.Samples.Thinktecture.IdentityServer.LoginCollection.PageLoadByUser(pageIndex, pageSize, null, user));
 }
示例#2
0
        private void LoadByUser(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, System.Data.IDataReader reader, SoftFluent.Samples.Thinktecture.IdentityServer.User user)
        {
            if ((reader == null))
            {
                throw new System.ArgumentNullException("reader");
            }
            if ((pageIndex < 0))
            {
                pageIndex = 0;
            }
            if ((pageSize < 0))
            {
                if ((pageOptions != null))
                {
                    pageSize = pageOptions.DefaultPageSize;
                }
                else
                {
                    pageSize = int.MaxValue;
                }
            }
            CodeFluent.Runtime.CodeFluentEntityState userState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
            if ((user != null))
            {
                userState = user.EntityState;
            }
            this._loginsUserUser = user;
            this.BaseList.Clear();
            this.BaseTable.Clear();
            int  count     = 0;
            int  readCount = 0;
            bool readerRead;

            for (readerRead = reader.Read(); ((readerRead == true) &&
                                              ((count < this.MaxCount) &&
                                               (count < pageSize))); readerRead = reader.Read())
            {
                readCount = (readCount + 1);
                if ((CodeFluent.Runtime.CodeFluentPersistence.CanAddEntity(pageIndex, pageSize, pageOptions, readCount) == true))
                {
                    SoftFluent.Samples.Thinktecture.IdentityServer.Login login = new SoftFluent.Samples.Thinktecture.IdentityServer.Login();
                    ((CodeFluent.Runtime.ICodeFluentEntity)(login)).ReadRecord(reader);
                    if ((this.BaseContains(login) == false))
                    {
                        this.BaseAdd(login);
                        count = (count + 1);
                    }
                    login.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                }
            }
            if ((user != null))
            {
                user.EntityState = userState;
            }
        }
示例#3
0
        internal void SaveUsersRelations()
        {
            if ((this._users == null))
            {
                return;
            }
            System.Collections.IEnumerator enumerator = ((CodeFluent.Runtime.ICodeFluentSet)(this._users)).Relations.GetEnumerator();
            bool b;

            for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
            {
                System.Collections.DictionaryEntry entry = ((System.Collections.DictionaryEntry)(enumerator.Current));
                SoftFluent.Samples.Thinktecture.IdentityServer.User user         = ((SoftFluent.Samples.Thinktecture.IdentityServer.User)(entry.Key));
                CodeFluent.Runtime.CodeFluentRelationType           relationType = ((CodeFluent.Runtime.CodeFluentRelationType)(entry.Value));
                if (((relationType == CodeFluent.Runtime.CodeFluentRelationType.Added) &&
                     ((user.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked)
                      == false)))
                {
                    CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName).Persistence;
                    persistence.CreateStoredProcedureCommand(null, "User", "SaveRoleUsers");
                    persistence.AddParameter("@Role_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
                    persistence.AddParameter("@User_Id", user.Id, CodeFluentPersistence.DefaultGuidValue);
                    persistence.ExecuteNonQuery();
                }
                else
                {
                    CodeFluent.Runtime.CodeFluentPersistence persistence1 = CodeFluentContext.Get(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName).Persistence;
                    persistence1.CreateStoredProcedureCommand(null, "User", "DeleteRoleUsers");
                    persistence1.AddParameter("@Role_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
                    persistence1.AddParameter("@User_Id", user.Id, CodeFluentPersistence.DefaultGuidValue);
                    persistence1.ExecuteNonQuery();
                }
                if ((user.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked))
                {
                    user.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                }
            }
            ((CodeFluent.Runtime.ICodeFluentSet)(this._users)).Relations.Clear();
        }
示例#4
0
        public static int DeleteByUserAndProviderKey(SoftFluent.Samples.Thinktecture.IdentityServer.User user, string providerKey)
        {
            if ((user == null))
            {
                throw new System.ArgumentNullException("user");
            }
            if ((user.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
            {
                CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "user", "SoftFluent.Samples.Thinktecture.IdentityServer.User");
            }
            if ((providerKey == default(string)))
            {
                throw new System.ArgumentNullException("providerKey");
            }
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "Login", "DeleteByUserAndProviderKey");
            persistence.AddParameter("@UserId", user.Id, CodeFluentPersistence.DefaultGuidValue);
            persistence.AddParameter("@ProviderKey", providerKey, default(string));
            int count;

            count = persistence.ExecuteScalar(-1);
            return(count);
        }
示例#5
0
 public static System.Data.IDataReader DataLoadByUser(SoftFluent.Samples.Thinktecture.IdentityServer.User user)
 {
     System.Data.IDataReader reader = SoftFluent.Samples.Thinktecture.IdentityServer.LoginCollection.PageDataLoadByUser(null, user);
     return(reader);
 }
示例#6
0
 public static System.Data.IDataReader PageDataLoadByUser(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Samples.Thinktecture.IdentityServer.User user)
 {
     if ((user == null))
     {
         return(null);
     }
     if ((user.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "user", "SoftFluent.Samples.Thinktecture.IdentityServer.User");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Login", "LoadByUser");
     persistence.AddParameter("@UserId", user.Id, CodeFluentPersistence.DefaultGuidValue);
     if ((pageOptions != null))
     {
         System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator();
         bool b;
         int  index = 0;
         for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
         {
             CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current));
             persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name);
             persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction)));
             index = (index + 1);
         }
     }
     System.Data.IDataReader reader = CodeFluentContext.Get(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName).Persistence.ExecuteReader();
     return(reader);
 }
示例#7
0
 public static SoftFluent.Samples.Thinktecture.IdentityServer.LoginCollection LoadByUser(SoftFluent.Samples.Thinktecture.IdentityServer.User user)
 {
     SoftFluent.Samples.Thinktecture.IdentityServer.LoginCollection ret = SoftFluent.Samples.Thinktecture.IdentityServer.LoginCollection.PageLoadByUser(int.MinValue, int.MaxValue, null, user);
     return(ret);
 }
示例#8
0
 public static SoftFluent.Samples.Thinktecture.IdentityServer.LoginCollection PageLoadByUser(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Samples.Thinktecture.IdentityServer.User user)
 {
     if ((pageIndex < 0))
     {
         pageIndex = 0;
     }
     if ((pageSize < 0))
     {
         if ((pageOptions != null))
         {
             pageSize = pageOptions.DefaultPageSize;
         }
         else
         {
             pageSize = int.MaxValue;
         }
     }
     SoftFluent.Samples.Thinktecture.IdentityServer.LoginCollection ret = new SoftFluent.Samples.Thinktecture.IdentityServer.LoginCollection();
     System.Data.IDataReader reader = null;
     try
     {
         reader = SoftFluent.Samples.Thinktecture.IdentityServer.LoginCollection.PageDataLoadByUser(pageOptions, user);
         if ((reader == null))
         {
             return(ret);
         }
         ret.LoadByUser(pageIndex, pageSize, pageOptions, reader, user);
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         CodeFluent.Runtime.CodeFluentPersistence.CompleteCommand(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName);
     }
     return(ret);
 }
示例#9
0
 public LoginCollection(SoftFluent.Samples.Thinktecture.IdentityServer.User loginsUserUser)
 {
     this._blm84013426    = new CodeFluent.Runtime.Utilities.BindingListManager <SoftFluent.Samples.Thinktecture.IdentityServer.Login>(this);
     this._loginsUserUser = loginsUserUser;
 }
 public RoleCollection(SoftFluent.Samples.Thinktecture.IdentityServer.User rolesUserUsers)
 {
     this._blm2209789505  = new CodeFluent.Runtime.Utilities.BindingListManager <SoftFluent.Samples.Thinktecture.IdentityServer.Role>(this);
     this._rolesUserUsers = rolesUserUsers;
 }
 public UserClaimCollection(SoftFluent.Samples.Thinktecture.IdentityServer.User claimsUserUser)
 {
     this._blm4077870955  = new CodeFluent.Runtime.Utilities.BindingListManager <SoftFluent.Samples.Thinktecture.IdentityServer.UserClaim>(this);
     this._claimsUserUser = claimsUserUser;
 }