Esempio n. 1
0
 public static SoftFluent.Json.NET.SupportCollection PageLoadSupportSpacesBySpace(int pageIndex, int pageSize, int spaceId)
 {
     SoftFluent.Json.NET.Space space = SoftFluent.Json.NET.Space.Load(spaceId);
     if ((space == null))
     {
         return(new SoftFluent.Json.NET.SupportCollection());
     }
     return(SoftFluent.Json.NET.SupportCollection.PageLoadSupportSpacesBySpace(pageIndex, pageSize, null, space));
 }
Esempio n. 2
0
        private void LoadSupportSpacesBySpace(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, System.Data.IDataReader reader, SoftFluent.Json.NET.Space space)
        {
            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 spaceState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
            if ((space != null))
            {
                spaceState = space.EntityState;
            }
            this._supportSpaceSpaces = space;
            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.Support support = new SoftFluent.Json.NET.Support();
                    ((CodeFluent.Runtime.ICodeFluentEntity)(support)).ReadRecord(reader);
                    if ((this.BaseContains(support) == false))
                    {
                        this.BaseAdd(support);
                        count = (count + 1);
                    }
                    support.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                }
            }
            if ((space != null))
            {
                space.EntityState = spaceState;
            }
        }
Esempio n. 3
0
        internal void SaveSpacesRelations()
        {
            if ((this._spaces == null))
            {
                return;
            }
            System.Collections.IEnumerator enumerator = ((CodeFluent.Runtime.ICodeFluentSet)(this._spaces)).Relations.GetEnumerator();
            bool b;

            for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
            {
                System.Collections.DictionaryEntry        entry        = ((System.Collections.DictionaryEntry)(enumerator.Current));
                SoftFluent.Json.NET.Space                 space        = ((SoftFluent.Json.NET.Space)(entry.Key));
                CodeFluent.Runtime.CodeFluentRelationType relationType = ((CodeFluent.Runtime.CodeFluentRelationType)(entry.Value));
                if (((relationType == CodeFluent.Runtime.CodeFluentRelationType.Added) &&
                     ((space.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", space.Id, ((int)(-1)));
                    persistence.AddParameter("@Support_Id", this.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", space.Id, ((int)(-1)));
                    persistence1.AddParameter("@Support_Id", this.Id, ((int)(-1)));
                    persistence1.ExecuteNonQuery();
                }
                if ((space.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked))
                {
                    space.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                }
            }
            ((CodeFluent.Runtime.ICodeFluentSet)(this._spaces)).Relations.Clear();
        }
Esempio n. 4
0
 public static System.Data.IDataReader DataLoadSupportSpacesBySpace(SoftFluent.Json.NET.Space space)
 {
     System.Data.IDataReader reader = SoftFluent.Json.NET.SupportCollection.PageDataLoadSupportSpacesBySpace(null, space);
     return(reader);
 }
Esempio n. 5
0
 public static System.Data.IDataReader PageDataLoadSupportSpacesBySpace(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Json.NET.Space space)
 {
     if ((space == null))
     {
         return(null);
     }
     if ((space.Id == -1))
     {
         CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "space", "SoftFluent.Json.NET.Space");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Support", "LoadSupportSpacesBySpace");
     persistence.AddParameter("@SpaceId", space.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);
 }
Esempio n. 6
0
 public static SoftFluent.Json.NET.SupportCollection LoadSupportSpacesBySpace(SoftFluent.Json.NET.Space space)
 {
     SoftFluent.Json.NET.SupportCollection ret = SoftFluent.Json.NET.SupportCollection.PageLoadSupportSpacesBySpace(int.MinValue, int.MaxValue, null, space);
     return(ret);
 }
Esempio n. 7
0
 public static SoftFluent.Json.NET.SupportCollection PageLoadSupportSpacesBySpace(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Json.NET.Space space)
 {
     if ((pageIndex < 0))
     {
         pageIndex = 0;
     }
     if ((pageSize < 0))
     {
         if ((pageOptions != null))
         {
             pageSize = pageOptions.DefaultPageSize;
         }
         else
         {
             pageSize = int.MaxValue;
         }
     }
     SoftFluent.Json.NET.SupportCollection ret = new SoftFluent.Json.NET.SupportCollection();
     System.Data.IDataReader reader            = null;
     try
     {
         reader = SoftFluent.Json.NET.SupportCollection.PageDataLoadSupportSpacesBySpace(pageOptions, space);
         if ((reader == null))
         {
             return(ret);
         }
         ret.LoadSupportSpacesBySpace(pageIndex, pageSize, pageOptions, reader, space);
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         CodeFluent.Runtime.CodeFluentPersistence.CompleteCommand(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName);
     }
     return(ret);
 }
Esempio n. 8
0
 public SupportCollection(SoftFluent.Json.NET.Space supportSpaceSpaces)
 {
     this._blm2244011348      = new CodeFluent.Runtime.Utilities.BindingListManager <SoftFluent.Json.NET.Support>(this);
     this._supportSpaceSpaces = supportSpaceSpaces;
 }