public static SoftFluent.Json.NET.SpaceCollection PageLoadSpacesSupportBySupport(int pageIndex, int pageSize, int supportId)
 {
     SoftFluent.Json.NET.Support support = SoftFluent.Json.NET.Support.Load(supportId);
     if ((support == null))
     {
         return(new SoftFluent.Json.NET.SpaceCollection());
     }
     return(SoftFluent.Json.NET.SpaceCollection.PageLoadSpacesSupportBySupport(pageIndex, pageSize, null, support));
 }
        private void LoadSpacesSupportBySupport(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, System.Data.IDataReader reader, SoftFluent.Json.NET.Support support)
        {
            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 supportState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
            if ((support != null))
            {
                supportState = support.EntityState;
            }
            this._spacesSupportSupport = support;
            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.Json.NET.Space space = new SoftFluent.Json.NET.Space();
                    ((CodeFluent.Runtime.ICodeFluentEntity)(space)).ReadRecord(reader);
                    if ((this.BaseContains(space) == false))
                    {
                        this.BaseAdd(space);
                        count = (count + 1);
                    }
                    space.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                }
            }
            if ((support != null))
            {
                support.EntityState = supportState;
            }
        }
예제 #3
0
        internal void SaveSupportRelations()
        {
            if ((this._support == null))
            {
                return;
            }
            System.Collections.IEnumerator enumerator = ((CodeFluent.Runtime.ICodeFluentSet)(this._support)).Relations.GetEnumerator();
            bool b;

            for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
            {
                System.Collections.DictionaryEntry        entry        = ((System.Collections.DictionaryEntry)(enumerator.Current));
                SoftFluent.Json.NET.Support               support      = ((SoftFluent.Json.NET.Support)(entry.Key));
                CodeFluent.Runtime.CodeFluentRelationType relationType = ((CodeFluent.Runtime.CodeFluentRelationType)(entry.Value));
                if (((relationType == CodeFluent.Runtime.CodeFluentRelationType.Added) &&
                     ((support.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked)
                      == false)))
                {
                    CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence;
                    persistence.CreateStoredProcedureCommand(null, "Support", "SaveSpaceSupport");
                    persistence.AddParameter("@Space_Id", this.Id, ((int)(-1)));
                    persistence.AddParameter("@Support_Id", support.Id, ((int)(-1)));
                    persistence.ExecuteNonQuery();
                }
                else
                {
                    CodeFluent.Runtime.CodeFluentPersistence persistence1 = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence;
                    persistence1.CreateStoredProcedureCommand(null, "Support", "DeleteSpaceSupport");
                    persistence1.AddParameter("@Space_Id", this.Id, ((int)(-1)));
                    persistence1.AddParameter("@Support_Id", support.Id, ((int)(-1)));
                    persistence1.ExecuteNonQuery();
                }
                if ((support.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked))
                {
                    support.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                }
            }
            ((CodeFluent.Runtime.ICodeFluentSet)(this._support)).Relations.Clear();
        }
 public static System.Data.IDataReader DataLoadSpacesSupportBySupport(SoftFluent.Json.NET.Support support)
 {
     System.Data.IDataReader reader = SoftFluent.Json.NET.SpaceCollection.PageDataLoadSpacesSupportBySupport(null, support);
     return(reader);
 }
 public static System.Data.IDataReader PageDataLoadSpacesSupportBySupport(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Json.NET.Support support)
 {
     if ((support == null))
     {
         return(null);
     }
     if ((support.Id == -1))
     {
         CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "support", "SoftFluent.Json.NET.Support");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Space", "LoadSpacesSupportBySupport");
     persistence.AddParameter("@SupportId", support.Id, ((int)(-1)));
     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.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence.ExecuteReader();
     return(reader);
 }
 public static SoftFluent.Json.NET.SpaceCollection LoadSpacesSupportBySupport(SoftFluent.Json.NET.Support support)
 {
     SoftFluent.Json.NET.SpaceCollection ret = SoftFluent.Json.NET.SpaceCollection.PageLoadSpacesSupportBySupport(int.MinValue, int.MaxValue, null, support);
     return(ret);
 }
 public static SoftFluent.Json.NET.SpaceCollection PageLoadSpacesSupportBySupport(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Json.NET.Support support)
 {
     if ((pageIndex < 0))
     {
         pageIndex = 0;
     }
     if ((pageSize < 0))
     {
         if ((pageOptions != null))
         {
             pageSize = pageOptions.DefaultPageSize;
         }
         else
         {
             pageSize = int.MaxValue;
         }
     }
     SoftFluent.Json.NET.SpaceCollection ret    = new SoftFluent.Json.NET.SpaceCollection();
     System.Data.IDataReader             reader = null;
     try
     {
         reader = SoftFluent.Json.NET.SpaceCollection.PageDataLoadSpacesSupportBySupport(pageOptions, support);
         if ((reader == null))
         {
             return(ret);
         }
         ret.LoadSpacesSupportBySupport(pageIndex, pageSize, pageOptions, reader, support);
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         CodeFluent.Runtime.CodeFluentPersistence.CompleteCommand(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName);
     }
     return(ret);
 }
 public SpaceCollection(SoftFluent.Json.NET.Support spacesSupportSupport)
 {
     this._blm2725435566        = new CodeFluent.Runtime.Utilities.BindingListManager <SoftFluent.Json.NET.Space>(this);
     this._spacesSupportSupport = spacesSupportSupport;
 }