Esempio n. 1
0
        private static void FillAttributeFillData(OBJS.Data DataSet, Type BaseType, object Item, string DefaultItemName)
        {
            List <PropertyInfo> NestedProps = GetProprites(OBJS.Types.AttributeFill, BaseType);

            if (NestedProps.Count == 0)
            {
                return;
            }

            foreach (PropertyInfo NestedProp in NestedProps)
            {
                OBJS.XMLDatabaseRetriveItem XMLDatabaseRetriveItem = (OBJS.XMLDatabaseRetriveItem)NestedProp.GetCustomAttributes(typeof(OBJS.XMLDatabaseRetriveItem), true).FirstOrDefault();

                string DataSetName = (XMLDatabaseRetriveItem.DataSet == string.Empty) ? NestedProp.Name : XMLDatabaseRetriveItem.DataSet;
                DefaultItemName = (XMLDatabaseRetriveItem.ItemName != string.Empty) ? XMLDatabaseRetriveItem.ItemName : DefaultItemName;

                Type ListType = NestedProp.PropertyType.GetGenericArguments()[0];

                System.Collections.IList IList = (System.Collections.IList)NestedProp.GetValue(Item, null);
                if (IList != null)
                {
                    foreach (Object ListItem in IList)
                    {
                        FillData(DataSet, ListType, ListItem);
                    }
                }
            }
        }
Esempio n. 2
0
        private static void GetAttributeFillItems(object Item, Type NewObject, OBJS.Data Data)
        {
            List <PropertyInfo> NestedProps = GetProprites(OBJS.Types.AttributeFill, NewObject);

            foreach (PropertyInfo NestedProp in NestedProps)
            {
                OBJS.XMLDatabaseRetriveItem XMLDatabaseRetriveItem = (OBJS.XMLDatabaseRetriveItem)NestedProp.GetCustomAttributes(typeof(OBJS.XMLDatabaseRetriveItem), true).FirstOrDefault();

                List <OBJS.Data.DataValue> DataItem = Data.GetAllNodes(XMLDatabaseRetriveItem.NodeName);

                if (DataItem.Count == 0)
                {
                    continue;
                }

                string DataSetName = (XMLDatabaseRetriveItem.DataSet == string.Empty) ? NestedProp.Name : XMLDatabaseRetriveItem.DataSet;

                List <OBJS.Data.DataValue> NestedDettingsData = Data.GetAllNodes(XMLDatabaseRetriveItem.NodeName);

                Type ListType = NestedProp.PropertyType.GetGenericArguments()[0];

                System.Collections.IList IList = (System.Collections.IList)NestedProp.GetValue(Item, null);
                foreach (OBJS.Data.DataValue Node in NestedDettingsData)
                {
                    IList.Add(GetItemObject(ListType, new List <OBJS.Data.DataValue>()
                    {
                        Node
                    }));
                }
            }
        }
Esempio n. 3
0
        private static void FillNestedMultiNode(OBJS.Data DataSet, Type BaseType, object Item, string DefaultItemName)
        {
            List <PropertyInfo> NestedProps = GetProprites(OBJS.Types.NestedMulitNode, BaseType);

            foreach (PropertyInfo NestedProp in NestedProps)
            {
                OBJS.XMLDatabaseRetriveItem XMLDatabaseRetriveItem = (OBJS.XMLDatabaseRetriveItem)NestedProp.GetCustomAttributes(typeof(OBJS.XMLDatabaseRetriveItem), true).FirstOrDefault();

                string DataSetName = (XMLDatabaseRetriveItem.DataSet == string.Empty) ? NestedProp.Name : XMLDatabaseRetriveItem.DataSet;
                DefaultItemName = (XMLDatabaseRetriveItem.ItemName != string.Empty) ? XMLDatabaseRetriveItem.ItemName : DefaultItemName;

                Type ListType = NestedProp.PropertyType.GetGenericArguments()[0];

                System.Collections.IList IList = (System.Collections.IList)NestedProp.GetValue(Item, null);
                if (IList != null)
                {
                    OBJS.Data Data = new OBJS.Data();
                    Data.DataSet        = DataSetName;
                    Data.IsSettingsItem = true;

                    foreach (Object ListItem in IList)
                    {
                        FillData(Data, ListType, ListItem);
                    }
                    DataSet.SetRetriveValue(Data);
                }
            }
        }
Esempio n. 4
0
        private static void GetNestedItems(object Item, Type NewObject, OBJS.Data Data)
        {
            List <PropertyInfo> NestedProps = GetProprites(OBJS.Types.NestedList, NewObject);

            foreach (PropertyInfo NestedProp in NestedProps)
            {
                OBJS.XMLDatabaseRetriveItem XMLDatabaseRetriveItem = (OBJS.XMLDatabaseRetriveItem)NestedProp.GetCustomAttributes(typeof(OBJS.XMLDatabaseRetriveItem), true).FirstOrDefault();

                string DataSetName = (XMLDatabaseRetriveItem.DataSet == string.Empty) ? NestedProp.Name : XMLDatabaseRetriveItem.DataSet;

                List <OBJS.Data> NestedDettingsData = Data.GetNestedData(DataSetName);

                try
                {
                    foreach (OBJS.Data DataValues in NestedDettingsData)
                    {
                        Type ListType = NestedProp.PropertyType.GetGenericArguments()[0];
                        if (XMLDatabaseRetriveItem.NestedListClassType != null)
                        {
                            ListType = XMLDatabaseRetriveItem.NestedListClassType;
                        }

                        System.Collections.IList IList = (System.Collections.IList)NestedProp.GetValue(Item, null);
                        if (IList == null)
                        {
                            Type   genericListType = typeof(List <>);
                            Type[] typeArgs        = new[] { ListType };
                            var    generic         = genericListType.MakeGenericType(typeArgs);
                            IList = (System.Collections.IList)Activator.CreateInstance(generic);
                            NestedProp.SetValue(Item, IList, null);
                        }
                        object ItemObject = GetItem(DataValues, ListType, null);
                        IList.Add(ItemObject);
                    }
                }
                catch (Exception e)
                {
                    e.ToString();
                }
            }
        }