コード例 #1
0
        public void GetEntryList_by_expression_qulifier_fieldIds_haspage_hascount_noorder_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                TotalMatch total = new TotalMatch();
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                var retlist = proxy.GetEntryList(
                    m => m.CharacterField.Contains("%你好%"),
                    0,
                    5,
                    total,
                    null,
                    m => m.CharacterField,
                    m => m.RequestID
                    );
                Assert.AreEqual(5, retlist.Count);
                Assert.AreEqual(11, total.Value);
                foreach (var entry in retlist)
                {
                    Assert.AreEqual(true, entry.CharacterField.Contains("你好"));
                }

                Assert.AreEqual(4, Convert.ToInt32(retlist.Max(m => m.RequestID)) - Convert.ToInt32(retlist.Min(m => m.RequestID)));
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
コード例 #2
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));
        }
コード例 #3
0
        public void ARProxy_GetEntryList_qulifier_fieldIds_nopage_hascount_hasorder_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                TotalMatch    total    = new TotalMatch();
                List <UInt32> fieldIds = new List <UInt32>();
                fieldIds.Add(TestCharacterFieldId);
                fieldIds.Add(TestIntFieldId);
                fieldIds.Add(1u);
                List <ARSortInfo> sortInfo = new List <ARSortInfo>();
                sortInfo.Add(new ARSortInfo
                {
                    FieldId = TestCharacterFieldId,
                    Order   = SortOrder.SORT_DESCENDING
                });

                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);

                var retlist = proxy.GetEntryList(
                    "'Character Field' LIKE \"%你好%\"",
                    fieldIds,
                    0,
                    null,
                    total,
                    sortInfo
                    );
                Assert.AreEqual(11, retlist.Count);
                Assert.AreEqual(11, total.Value);
                foreach (var entry in retlist)
                {
                    Assert.AreEqual(true, entry.CharacterField.Contains("你好"));
                }

                Assert.AreEqual(10, Convert.ToInt32(retlist.Max(m => m.RequestID)) - Convert.ToInt32(retlist.Min(m => m.RequestID)));

                Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", retlist[0].CharacterField);
                Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", retlist[1].CharacterField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
コード例 #4
0
        public static IList <TModel> GetEntryList <TModel>(this ARProxy <TModel> proxy,
                                                           Expression <Func <TModel, bool> > expression,
                                                           uint StartIndex,
                                                           uint?RetrieveCount,
                                                           TotalMatch totalMatch,
                                                           List <ARSortInfo> sortInfo,
                                                           params Expression <Func <TModel, object> >[] propertiesTobeUp)
            where TModel : ARBaseForm
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression must not null. If want to delete all entries, try to use m => true");
            }
            ConditionExpressionVisitor visitor = new ConditionExpressionVisitor();
            var             expEvaled          = Evaluator.PartialEval(expression);
            ConditionResult tr = visitor.Translate(expEvaled);
            string          qu = tr.Qulification == null ? null : tr.Qulification.ToString();

            return(GetEntryList(proxy, qu, StartIndex, RetrieveCount, totalMatch, sortInfo, propertiesTobeUp));
        }
コード例 #5
0
        public void GetEntryList_by_expression_qulifier_fieldIds_haspage_hascount_noorder_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                TotalMatch total = new TotalMatch();
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                var retlist = proxy.GetEntryList(
                    m => m.CharacterField.Contains("%你好%"),
                    0,
                    5,
                    total,
                    null,
                     m => m.CharacterField,
                     m => m.RequestID
                    );
                Assert.AreEqual(5, retlist.Count);
                Assert.AreEqual(11, total.Value);
                foreach (var entry in retlist)
                {
                    Assert.AreEqual(true, entry.CharacterField.Contains("你好"));
                }

                Assert.AreEqual(4, Convert.ToInt32(retlist.Max(m => m.RequestID)) - Convert.ToInt32(retlist.Min(m => m.RequestID)));

            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);

            }
            finally
            {
                context.Dispose();
            }
        }
コード例 #6
0
        public void ARProxy_GetEntryList_qulifier_fieldIds_nopage_hascount_hasorder_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                TotalMatch total = new TotalMatch();
                List<UInt32> fieldIds = new List<UInt32>();
                fieldIds.Add(TestCharacterFieldId);
                fieldIds.Add(TestIntFieldId);
                fieldIds.Add(1u);
                List<ARSortInfo> sortInfo = new List<ARSortInfo>();
                sortInfo.Add(new ARSortInfo
                {
                    FieldId = TestCharacterFieldId,
                    Order = SortOrder.SORT_DESCENDING
                });

                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);

                var retlist = proxy.GetEntryList(
                    "'Character Field' LIKE \"%你好%\"",
                    fieldIds,
                    0,
                    null,
                    total,
                    sortInfo
                    );
                Assert.AreEqual(11, retlist.Count);
                Assert.AreEqual(11, total.Value);
                foreach (var entry in retlist)
                {
                    Assert.AreEqual(true, entry.CharacterField.Contains("你好"));
                }

                Assert.AreEqual(10, Convert.ToInt32(retlist.Max(m => m.RequestID)) - Convert.ToInt32(retlist.Min(m => m.RequestID)));

                Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", retlist[0].CharacterField);
                Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", retlist[1].CharacterField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);

            }
            finally
            {
                context.Dispose();
            }
        }