public static SoftFluent.Samples.AspNetIdentity1.UserCollection PageLoadUsersRolesByRole(int pageIndex, int pageSize, string roleId)
 {
     SoftFluent.Samples.AspNetIdentity1.Role role = SoftFluent.Samples.AspNetIdentity1.Role.Load(roleId);
     if ((role == null))
     {
         return(new SoftFluent.Samples.AspNetIdentity1.UserCollection());
     }
     return(SoftFluent.Samples.AspNetIdentity1.UserCollection.PageLoadUsersRolesByRole(pageIndex, pageSize, null, role));
 }
        private void LoadUsersRolesByRole(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, System.Data.IDataReader reader, SoftFluent.Samples.AspNetIdentity1.Role role)
        {
            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 roleState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
            if ((role != null))
            {
                roleState = role.EntityState;
            }
            this._usersRoleRoles = role;
            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.AspNetIdentity1.User user = new SoftFluent.Samples.AspNetIdentity1.User();
                    ((CodeFluent.Runtime.ICodeFluentEntity)(user)).ReadRecord(reader);
                    if ((this.BaseContains(user) == false))
                    {
                        this.BaseAdd(user);
                        count = (count + 1);
                    }
                    user.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                }
            }
            if ((role != null))
            {
                role.EntityState = roleState;
            }
        }
Пример #3
0
        internal void SaveRolesRelations()
        {
            if ((this._roles == null))
            {
                return;
            }
            System.Collections.IEnumerator enumerator = ((CodeFluent.Runtime.ICodeFluentSet)(this._roles)).Relations.GetEnumerator();
            bool b;

            for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
            {
                System.Collections.DictionaryEntry        entry        = ((System.Collections.DictionaryEntry)(enumerator.Current));
                SoftFluent.Samples.AspNetIdentity1.Role   role         = ((SoftFluent.Samples.AspNetIdentity1.Role)(entry.Key));
                CodeFluent.Runtime.CodeFluentRelationType relationType = ((CodeFluent.Runtime.CodeFluentRelationType)(entry.Value));
                if (((relationType == CodeFluent.Runtime.CodeFluentRelationType.Added) &&
                     ((role.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked)
                      == false)))
                {
                    CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence;
                    persistence.CreateStoredProcedureCommand(null, "User", "SaveRoleUsers");
                    persistence.AddParameter("@Role_Id", role.Id, default(string));
                    persistence.AddParameter("@User_Id", this.Id, default(string));
                    persistence.ExecuteNonQuery();
                }
                else
                {
                    CodeFluent.Runtime.CodeFluentPersistence persistence1 = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence;
                    persistence1.CreateStoredProcedureCommand(null, "User", "DeleteRoleUsers");
                    persistence1.AddParameter("@Role_Id", role.Id, default(string));
                    persistence1.AddParameter("@User_Id", this.Id, default(string));
                    persistence1.ExecuteNonQuery();
                }
                if ((role.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked))
                {
                    role.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                }
            }
            ((CodeFluent.Runtime.ICodeFluentSet)(this._roles)).Relations.Clear();
        }
 public static System.Data.IDataReader DataLoadUsersRolesByRole(SoftFluent.Samples.AspNetIdentity1.Role role)
 {
     System.Data.IDataReader reader = SoftFluent.Samples.AspNetIdentity1.UserCollection.PageDataLoadUsersRolesByRole(null, role);
     return(reader);
 }
 public static System.Data.IDataReader PageDataLoadUsersRolesByRole(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Samples.AspNetIdentity1.Role role)
 {
     if ((role == null))
     {
         return(null);
     }
     if ((role.Id == default(string)))
     {
         CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "role", "SoftFluent.Samples.AspNetIdentity1.Role");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "User", "LoadUsersRolesByRole");
     persistence.AddParameter("@RoleId", role.Id, default(string));
     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.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence.ExecuteReader();
     return(reader);
 }
 public static SoftFluent.Samples.AspNetIdentity1.UserCollection LoadUsersRolesByRole(SoftFluent.Samples.AspNetIdentity1.Role role)
 {
     SoftFluent.Samples.AspNetIdentity1.UserCollection ret = SoftFluent.Samples.AspNetIdentity1.UserCollection.PageLoadUsersRolesByRole(int.MinValue, int.MaxValue, null, role);
     return(ret);
 }
 public static SoftFluent.Samples.AspNetIdentity1.UserCollection PageLoadUsersRolesByRole(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Samples.AspNetIdentity1.Role role)
 {
     if ((pageIndex < 0))
     {
         pageIndex = 0;
     }
     if ((pageSize < 0))
     {
         if ((pageOptions != null))
         {
             pageSize = pageOptions.DefaultPageSize;
         }
         else
         {
             pageSize = int.MaxValue;
         }
     }
     SoftFluent.Samples.AspNetIdentity1.UserCollection ret = new SoftFluent.Samples.AspNetIdentity1.UserCollection();
     System.Data.IDataReader reader = null;
     try
     {
         reader = SoftFluent.Samples.AspNetIdentity1.UserCollection.PageDataLoadUsersRolesByRole(pageOptions, role);
         if ((reader == null))
         {
             return(ret);
         }
         ret.LoadUsersRolesByRole(pageIndex, pageSize, pageOptions, reader, role);
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         CodeFluent.Runtime.CodeFluentPersistence.CompleteCommand(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName);
     }
     return(ret);
 }
 public UserCollection(SoftFluent.Samples.AspNetIdentity1.Role usersRoleRoles)
 {
     this._blm1175450145  = new CodeFluent.Runtime.Utilities.BindingListManager <SoftFluent.Samples.AspNetIdentity1.User>(this);
     this._usersRoleRoles = usersRoleRoles;
 }