コード例 #1
0
 public static SoftFluent.Samples.GED.Security.UserRoleCollection PageLoadByRole(int pageIndex, int pageSize, System.Guid roleId)
 {
     SoftFluent.Samples.GED.Security.Role role = SoftFluent.Samples.GED.Security.Role.Load(roleId);
     if ((role == null))
     {
         return(new SoftFluent.Samples.GED.Security.UserRoleCollection());
     }
     return(SoftFluent.Samples.GED.Security.UserRoleCollection.PageLoadByRole(pageIndex, pageSize, null, role));
 }
コード例 #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;
            }
        }
コード例 #3
0
 public static System.Data.IDataReader DataLoadByRole(SoftFluent.Samples.GED.Security.Role role)
 {
     System.Data.IDataReader reader = SoftFluent.Samples.GED.Security.UserRoleCollection.PageDataLoadByRole(null, role);
     return(reader);
 }
コード例 #4
0
 public static System.Data.IDataReader PageDataLoadByRole(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Samples.GED.Security.Role role)
 {
     if ((role == null))
     {
         return(null);
     }
     if ((role.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "role", "SoftFluent.Samples.GED.Security.Role");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.GED.Constants.SoftFluent_Samples_GEDStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "UserRole", "LoadByRole");
     persistence.AddParameter("@RoleId", role.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);
 }
コード例 #5
0
 public static SoftFluent.Samples.GED.Security.UserRoleCollection LoadByRole(SoftFluent.Samples.GED.Security.Role role)
 {
     SoftFluent.Samples.GED.Security.UserRoleCollection ret = SoftFluent.Samples.GED.Security.UserRoleCollection.PageLoadByRole(int.MinValue, int.MaxValue, null, role);
     return(ret);
 }
コード例 #6
0
 public static SoftFluent.Samples.GED.Security.UserRoleCollection PageLoadByRole(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Samples.GED.Security.Role role)
 {
     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.PageDataLoadByRole(pageOptions, role);
         if ((reader == null))
         {
             return(ret);
         }
         ret.LoadByRole(pageIndex, pageSize, pageOptions, reader, role);
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         CodeFluent.Runtime.CodeFluentPersistence.CompleteCommand(SoftFluent.Samples.GED.Constants.SoftFluent_Samples_GEDStoreName);
     }
     return(ret);
 }
コード例 #7
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;
 }