コード例 #1
0
ファイル: DBCollection.cs プロジェクト: xyyhqq/eXpand
        public DBCollection[] SpanToNotLoadEnable(int spanNumbers)
        {
            var dbCollections = new DBCollection[spanNumbers];

            if (spanNumbers == 1)
            {
                return new[] { this }
            }
            ;
            for (int i = 1; i < spanNumbers + 1; i++)
            {
                var collection = new DBCollection(Session, ObjectType, true)
                {
                    Sorting = Sorting
                };
                dbCollections[i - 1] = collection;
            }
            int j = 0;

            for (int i = 0; i < Count; i++)
            {
                dbCollections[j].Add(this[i]);
                j++;
                if (j == spanNumbers)
                {
                    j = 0;
                }
            }

            return(dbCollections);
        }
コード例 #2
0
ファイル: DBCollection.cs プロジェクト: xyyhqq/eXpand
//        public string Serialize()
//        {
//            var objects = (object[]) ArrayList.Adapter(this).ToArray(ObjectType);
//            return StreamUtils.Serialize(objects, ObjectType);
//        }

        public static void RemoveAllById(DBCollection collection1, DBCollection collection2)
        {
            for (int i = collection1.Count - 1; i > -1; i--)
            {
                var    dbObject = (DBObject)collection1[i];
                object keyValue = dbObject.ClassInfo.KeyProperty.GetValue(dbObject);
                if (collection2.Lookup(keyValue) != null)
                {
                    collection1.Remove(dbObject);
                }
            }
        }
コード例 #3
0
ファイル: DBCollection.cs プロジェクト: xyyhqq/eXpand
        public static void DeleteAll(XPCollection xpCollection, bool disableConstrains)
        {
            var collection = new DBCollection(xpCollection);

            using (collection)
            {
                var xpPageSelector = new XPPageSelector(collection)
                {
                    PageSize = 100
                };
                for (int i = 0; i < xpPageSelector.PageCount; i++)
                {
                    xpPageSelector.CurrentPage = i;
                    for (int j = xpPageSelector.Collection.Count - 1; j > -1; j--)
                    {
                        var dbObject = (DBObject)xpCollection[j];
                        dbObject.ConstrainsDisabled = disableConstrains;
                        dbObject.Delete();
                    }
                }
            }
        }
コード例 #4
0
ファイル: DBCollection.cs プロジェクト: xyyhqq/eXpand
        public DBCollection[] SpanTo(int spanNumbers)
        {
            var dbCollections = new DBCollection[spanNumbers];

            if (spanNumbers < 2)
            {
                return new[] { this }
            }
            ;
            var arrayList = new ArrayList[spanNumbers];

            for (int i = 0; i < spanNumbers; i++)
            {
                arrayList[i] = new ArrayList {
                    0
                };
            }

            for (int i = 0; i < Count; i++)
            {
                for (int j = 1; j < spanNumbers + 1; j++)
                {
                    if (i < Count)
                    {
                        var ixpSimpleObject = (IXPSimpleObject)this[i];
                        arrayList[j - 1].Add(ixpSimpleObject.ClassInfo.KeyProperty.GetValue(ixpSimpleObject));
                        i++;
                    }
                }
                i--;
            }
            for (int i = 0; i < arrayList.Length; i++)
            {
                dbCollections[i] = new DBCollection(Session, ObjectType, new InOperator("ID", arrayList[i]),
                                                    SortProperties);
            }
            return(dbCollections);
        }
コード例 #5
0
ファイル: DBCollection.cs プロジェクト: aries544/eXpand
 public static DBCollection GetColletion(Session session, Type objectType, int pageSize, int pageIndex)
 {
     var dbCollection = new DBCollection(session, objectType);
     return dbCollection.GetColletion(pageSize, pageIndex);
 }
コード例 #6
0
ファイル: DBCollection.cs プロジェクト: aries544/eXpand
        public DBCollection[] SpanToNotLoadEnable(int spanNumbers)
        {
            var dbCollections = new DBCollection[spanNumbers];
            if (spanNumbers == 1)
                return new[] {this};
            for (int i = 1; i < spanNumbers + 1; i++)
            {
                var collection = new DBCollection(Session, ObjectType, true) {Sorting = Sorting};
                dbCollections[i - 1] = collection;
            }
            int j = 0;
            for (int i = 0; i < Count; i++)
            {
                dbCollections[j].Add(this[i]);
                j++;
                if (j == spanNumbers)
                    j = 0;
            }

            return dbCollections;
        }
コード例 #7
0
ファイル: DBCollection.cs プロジェクト: aries544/eXpand
        public DBCollection[] SpanTo(int spanNumbers)
        {
            var dbCollections = new DBCollection[spanNumbers];
            if (spanNumbers < 2)
                return new[] {this};
            var arrayList = new ArrayList[spanNumbers];
            for (int i = 0; i < spanNumbers; i++)
            {
                arrayList[i] = new ArrayList {0};
            }

            for (int i = 0; i < Count; i++)
            {
                for (int j = 1; j < spanNumbers + 1; j++)
                {
                    if (i < Count)
                    {
                        var ixpSimpleObject = (IXPSimpleObject) this[i];
                        arrayList[j - 1].Add(ixpSimpleObject.ClassInfo.KeyProperty.GetValue(ixpSimpleObject));
                        i++;
                    }
                }
                i--;
            }
            for (int i = 0; i < arrayList.Length; i++)
                dbCollections[i] = new DBCollection(Session, ObjectType, new InOperator("ID", arrayList[i]),
                                                    SortProperties);
            return dbCollections;
        }
コード例 #8
0
ファイル: DBCollection.cs プロジェクト: aries544/eXpand
//        public string Serialize()
//        {
//            var objects = (object[]) ArrayList.Adapter(this).ToArray(ObjectType);
//            return StreamUtils.Serialize(objects, ObjectType);
//        }

        public static void RemoveAllById(DBCollection collection1, DBCollection collection2)
        {
            for (int i = collection1.Count - 1; i > -1; i--)
            {
                var dbObject = (DBObject) collection1[i];
                object keyValue = dbObject.ClassInfo.KeyProperty.GetValue(dbObject);
                if (collection2.Lookup(keyValue) != null)
                    collection1.Remove(dbObject);
            }
        }
コード例 #9
0
ファイル: DBCollection.cs プロジェクト: aries544/eXpand
 public static void DeleteAll(XPCollection xpCollection, bool disableConstrains)
 {
     var collection = new DBCollection(xpCollection);
     using (collection)
     {
         var xpPageSelector = new XPPageSelector(collection) {PageSize = 100};
         for (int i = 0; i < xpPageSelector.PageCount; i++)
         {
             xpPageSelector.CurrentPage = i;
             for (int j = xpPageSelector.Collection.Count - 1; j > -1; j--)
             {
                 var dbObject = (DBObject) xpCollection[j];
                 dbObject.ConstrainsDisabled = disableConstrains;
                 dbObject.Delete();
             }
         }
     }
 }
コード例 #10
0
ファイル: DBObject.cs プロジェクト: aries544/eXpand
 public static int GetLastKey(Session session, XPClassInfo classInfo)
 {
     Type type = GetBaseType(classInfo.ClassType);
     var collection = new DBCollection(session, type, null,
                                       new[]
                                           {new SortProperty("ID", SortingDirection.Descending)})
                          {TopReturnedObjects = 1};
     int value = collection.Count > 0
                     ? (int) ((IXPSimpleObject) collection[0]).ClassInfo.KeyProperty.GetValue(collection[0])
                     : 0;
     collection.Dispose();
     return value;
 }
コード例 #11
0
ファイル: DBCollection.cs プロジェクト: xyyhqq/eXpand
        public static DBCollection GetColletion(Session session, Type objectType, int pageSize, int pageIndex)
        {
            var dbCollection = new DBCollection(session, objectType);

            return(dbCollection.GetColletion(pageSize, pageIndex));
        }