示例#1
0
        public static IList <TModel> GetEntryList <TModel>(this ARProxy <TModel> proxy,
                                                           string qualification,
                                                           uint StartIndex,
                                                           uint?RetrieveCount,
                                                           TotalMatch totalMatch,
                                                           List <ARSortInfo> sortInfo,
                                                           params Expression <Func <TModel, object> >[] propertiesTobeUp)
            where TModel : ARBaseForm
        {
            if (propertiesTobeUp == null || propertiesTobeUp.Length == 0)
            {
                return(null);
            }
            ITypeMetaProvider <TModel> metaProvider = new ExpressionTypeMetaProvider <TModel>(propertiesTobeUp);

            ModelMeteData <TModel> MetaData = new ModelMeteData <TModel>();

            MetaData.FormName = metaProvider.GetFormNameFromModelType();

            var props = metaProvider.GetPropertyInfoes(BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.Instance, null);

            MetaData.Properties = new List <PropertyAndField <TModel> >();

            foreach (var p in props)
            {
                if ((p.AccessLevel & ModelBinderAccessLevel.OnlyBind) == ModelBinderAccessLevel.OnlyBind)
                {
                    MetaData.Properties.Add(p);
                }
            }

            return(proxy.GetEntryList(StartIndex, qualification, MetaData, RetrieveCount, totalMatch, sortInfo));
        }
示例#2
0
        public static void SetEntry <TModel>(
            this ARProxy <TModel> proxy, TModel model, params Expression <Func <TModel, object> >[] propertiesTobeUp)
            where TModel : ARBaseForm
        {
            if (propertiesTobeUp == null || propertiesTobeUp.Length == 0)
            {
                return;
            }
            ITypeMetaProvider <TModel> metaProvider = new ExpressionTypeMetaProvider <TModel>(propertiesTobeUp);

            ModelMeteData <TModel> MetaData = new ModelMeteData <TModel>();

            MetaData.FormName = metaProvider.GetFormNameFromModelType();
            var entryIdProp = metaProvider.GetEntryIdPropertyInfo();

            if (entryIdProp == null)
            {
                throw new CustomAttributeFormatException("Can not find EntryId's PropertyInfo.");
            }
            MetaData.EntryId = (string)entryIdProp.GetValue(model);
            MetaData.Model   = model;
            var props = metaProvider.GetPropertyInfoes(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance, null);

            MetaData.Properties = new List <PropertyAndField <TModel> >();

            foreach (var p in props)
            {
                if ((p.AccessLevel & ModelBinderAccessLevel.OnlyUnBind) == ModelBinderAccessLevel.OnlyUnBind)
                {
                    MetaData.Properties.Add(p);
                }
            }

            proxy.SetEntry(MetaData);
        }
示例#3
0
        public static TModel GetEntry <TModel>(
            this ARProxy <TModel> proxy, string EntryId, params Expression <Func <TModel, object> >[] propertiesTobeUp)
            where TModel : ARBaseForm
        {
            if (propertiesTobeUp == null || propertiesTobeUp.Length == 0)
            {
                return(null);
            }
            ITypeMetaProvider <TModel> metaProvider = new ExpressionTypeMetaProvider <TModel>(propertiesTobeUp);

            ModelMeteData <TModel> MetaData = new ModelMeteData <TModel>();

            MetaData.FormName = metaProvider.GetFormNameFromModelType();
            MetaData.EntryId  = EntryId;

            var props = metaProvider.GetPropertyInfoes(BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.Instance, null);

            MetaData.Properties = new List <PropertyAndField <TModel> >();

            foreach (var p in props)
            {
                if ((p.AccessLevel & ModelBinderAccessLevel.OnlyBind) == ModelBinderAccessLevel.OnlyBind)
                {
                    MetaData.Properties.Add(p);
                }
            }

            return(proxy.GetEntry(MetaData));
        }
示例#4
0
        public static void SetEntryList <TModel>(
            this ARProxy <TModel> proxy, string qualification, TModel model, params Expression <Func <TModel, object> >[] propertiesTobeUp)
            where TModel : ARBaseForm
        {
            if (propertiesTobeUp == null || propertiesTobeUp.Length == 0)
            {
                return;
            }
            ITypeMetaProvider <TModel> metaProvider = new ExpressionTypeMetaProvider <TModel>(propertiesTobeUp);

            ModelMeteData <TModel> MetaData = new ModelMeteData <TModel>();

            MetaData.FormName = metaProvider.GetFormNameFromModelType();

            MetaData.Model = model;
            var props = metaProvider.GetPropertyInfoes(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance, null);

            MetaData.Properties = new List <PropertyAndField <TModel> >();

            foreach (var p in props)
            {
                if ((p.AccessLevel & ModelBinderAccessLevel.OnlyUnBind) == ModelBinderAccessLevel.OnlyUnBind)
                {
                    MetaData.Properties.Add(p);
                }
            }

            int            total   = -1;
            List <AREntry> entries = proxy.GetARServer().GetEntryList(MetaData.FormName, qualification, null, 0, null, ref total, null);

            foreach (var entry in entries)
            {
                string entryid = string.Join("|", entry.EntryIds.ToArray());
                MetaData.EntryId = entryid;
                proxy.SetEntry(MetaData);
            }
        }