Beispiel #1
0
 public static SoftFluent.Samples.GED.Security.UserRoleCollection PageLoadByUser(int pageIndex, int pageSize, System.Guid userId)
 {
     SoftFluent.Samples.GED.Security.User user = SoftFluent.Samples.GED.Security.User.Load(userId);
     if ((user == null))
     {
         return(new SoftFluent.Samples.GED.Security.UserRoleCollection());
     }
     return(SoftFluent.Samples.GED.Security.UserRoleCollection.PageLoadByUser(pageIndex, pageSize, null, user));
 }
Beispiel #2
0
        private void LoadByUser(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, System.Data.IDataReader reader, SoftFluent.Samples.GED.Security.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._usersRoleRole = null;
            this._rolesUserUser = user;
            this.BaseList.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.GED.Security.UserRole userRole = new SoftFluent.Samples.GED.Security.UserRole();
                    ((CodeFluent.Runtime.ICodeFluentEntity)(userRole)).ReadRecord(reader);
                    if ((this.BaseContains(userRole) == false))
                    {
                        this.BaseAdd(userRole);
                        count = (count + 1);
                    }
                    userRole.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                }
            }
            if ((user != null))
            {
                user.EntityState = userState;
            }
        }
Beispiel #3
0
 public static SoftFluent.Samples.GED.Security.UserRoleCollection LoadByUser(SoftFluent.Samples.GED.Security.User user)
 {
     SoftFluent.Samples.GED.Security.UserRoleCollection ret = SoftFluent.Samples.GED.Security.UserRoleCollection.PageLoadByUser(int.MinValue, int.MaxValue, null, user);
     return(ret);
 }
Beispiel #4
0
 public static SoftFluent.Samples.GED.Security.UserRoleCollection PageLoadByUser(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Samples.GED.Security.User user)
 {
     if ((pageIndex < 0))
     {
         pageIndex = 0;
     }
     if ((pageSize < 0))
     {
         if ((pageOptions != null))
         {
             pageSize = pageOptions.DefaultPageSize;
         }
         else
         {
             pageSize = int.MaxValue;
         }
     }
     SoftFluent.Samples.GED.Security.UserRoleCollection ret = new SoftFluent.Samples.GED.Security.UserRoleCollection();
     System.Data.IDataReader reader = null;
     try
     {
         reader = SoftFluent.Samples.GED.Security.UserRoleCollection.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.GED.Constants.SoftFluent_Samples_GEDStoreName);
     }
     return(ret);
 }
Beispiel #5
0
 public UserRoleCollection(SoftFluent.Samples.GED.Security.Role usersRoleRole, SoftFluent.Samples.GED.Security.User rolesUserUser)
 {
     this._blm3368444072 = new CodeFluent.Runtime.Utilities.BindingListManager <SoftFluent.Samples.GED.Security.UserRole>(this);
     this._usersRoleRole = usersRoleRole;
     this._rolesUserUser = rolesUserUser;
 }
Beispiel #6
0
 public static System.Data.IDataReader DataLoadByUser(SoftFluent.Samples.GED.Security.User user)
 {
     System.Data.IDataReader reader = SoftFluent.Samples.GED.Security.UserRoleCollection.PageDataLoadByUser(null, user);
     return(reader);
 }
Beispiel #7
0
 public static System.Data.IDataReader PageDataLoadByUser(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Samples.GED.Security.User user)
 {
     if ((user == null))
     {
         return(null);
     }
     if ((user.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "user", "SoftFluent.Samples.GED.Security.User");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.GED.Constants.SoftFluent_Samples_GEDStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "UserRole", "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.GED.Constants.SoftFluent_Samples_GEDStoreName).Persistence.ExecuteReader();
     return(reader);
 }