Ejemplo n.º 1
0
        public IList <T> GetEntryList(
            string qualification,
            List <uint> FieldIdList,
            uint StartIndex,
            uint?RetrieveCount,
            TotalMatch totalMatch,
            List <ARSortInfo> sortInfo
            )
        {
            ModelMeteData <T> meta = new ModelMeteData <T>();

            meta.FormName = _metaProvider.GetFormNameFromModelType();
            var properties = _metaProvider.GetPropertyInfoes(BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.Instance, null);
            List <PropertyAndField <T> > props = new List <PropertyAndField <T> >();

            foreach (var p in properties)
            {
                if (FieldIdList.Find(delegate(UInt32 arfv) { return(arfv == p.DatabaseId); }) != 0)
                {
                    props.Add(p);
                }
            }
            meta.Properties = props;

            return(GetEntryList(StartIndex, qualification, meta, RetrieveCount, totalMatch, sortInfo));
        }
Ejemplo n.º 2
0
        public IList <T> GetEntryList(
            string qualification,
            uint StartIndex,
            PropertyFilterDelegate2 filter,
            uint?RetrieveCount,
            TotalMatch totalMatch,
            List <ARSortInfo> sortInfo
            )
        {
            ModelMeteData <T> metaData = new ModelMeteData <T>();

            metaData.FormName = _metaProvider.GetFormNameFromModelType();
            var props = _metaProvider.GetPropertyInfoes(
                BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.Instance,
                filter
                );

            metaData.Properties = new List <PropertyAndField <T> >();
            foreach (var p in props)
            {
                if ((p.AccessLevel & ModelBinderAccessLevel.OnlyBind) == ModelBinderAccessLevel.OnlyBind)
                {
                    metaData.Properties.Add(p);
                }
            }

            return(GetEntryList(StartIndex, qualification, metaData, RetrieveCount, totalMatch, sortInfo));
        }
Ejemplo n.º 3
0
        public IList <T> GetEntryList(
            string qualification,
            IEnumerable <string> Properties,
            uint?RetrieveCount,
            uint StartIndex,
            TotalMatch totalMatch,
            List <ARSortInfo> sortInfo
            )
        {
            List <string> valid = null;

            if (Properties != null)
            {
                valid = new List <string>(Properties);
            }
            else
            {
                valid = new List <string>();
            }

            return(GetEntryList(
                       qualification,
                       StartIndex,
                       delegate(PropertyInfo pi)
            {
                if (pi == null)
                {
                    throw new ArgumentNullException("pi");
                }
                return valid.Contains(pi.Name);
            },
                       RetrieveCount,
                       totalMatch,
                       sortInfo
                       ));
        }
Ejemplo n.º 4
0
        //formname
        //Properties
        //              FieldId
        //              DataType
        //              Setter null|not null
        public IList <T> GetEntryList(
            uint StartIndex,
            string qualification,
            ModelMeteData <T> MetaData,
            uint?RetrieveCount,
            TotalMatch totalMatch,
            List <ARSortInfo> sortInfo
            )
        {
            if (MetaData == null)
            {
                throw new ArgumentNullException("MetaData");
            }
            if (string.IsNullOrEmpty(MetaData.FormName))
            {
                throw new ArgumentException("MetaData.FormName must provider valid value.");
            }
            if (MetaData.Properties == null && MetaData.Properties.Count == 0)
            {
                throw new ArgumentException("MetaData.Properties must provider valid value.");
            }
            if (loginContext.LoginStatus != ARLoginStatus.Success || loginContext.ServerInstance == null)
            {
                throw new UnLoginException();
            }
            int total = 0;

            if (totalMatch == null)
            {
                total = -1;
            }
            List <AREntry> raw_entries = null;
            Dictionary <uint, PropertyAndField <T> > mapps = new Dictionary <uint, PropertyAndField <T> >();

            List <uint> fil = new List <uint>();

            foreach (var prop in MetaData.Properties)
            {
                fil.Add(prop.DatabaseId);
                mapps.Add(prop.DatabaseId, prop);
            }
            raw_entries = loginContext.ServerInstance.GetEntryList
                              (MetaData.FormName, qualification, fil, StartIndex, RetrieveCount, ref total, sortInfo);

            if (raw_entries == null)
            {
                return(null);
            }
            List <T> listT = new List <T>();

            foreach (var raw in raw_entries)
            {
                //TOTEST:join form condition may have some issue
                T model = Activator.CreateInstance <T>();
                //string entryid = string.Join("|", raw.EntryIds.ToArray());
                //mapps[1].SetValue(model,entryid);
                foreach (var fv in raw.FieldValues)
                {
                    mapps[fv.FieldId].SetValueC(model, fv.Value);
                }
                listT.Add(model);
            }
            if (totalMatch != null)
            {
                totalMatch.Value = total;
            }
            return(listT);
        }