예제 #1
0
        public void SetEntries_single_condition()
        {
            ARLoginContext context = null;

            try
            {
                context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                ARSet <NRemedy_Test_Regular_Form>   set   = new ARSet <NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        where s.CharacterField == TestCharacterFieldValue
                        select s.IntegerField;
                Assert.AreEqual(7, q.Count());

                NRemedy_Test_Regular_Form model = new NRemedy_Test_Regular_Form();
                model.IntegerField = 10;//original is 1

                proxy.SetEntryList("'Character Field' = \"" + TestCharacterFieldValue + "\"", model, new string[] { "IntegerField" });

                foreach (var i in q)
                {
                    Assert.AreEqual(10, i);
                }
            }
            finally
            {
                if (context != null)
                {
                    context.Dispose();
                }
            }
        }
예제 #2
0
        public void SetEntries_All()
        {
            ARLoginContext context = null;

            try
            {
                context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);

                NRemedy_Test_Regular_Form newentry = new NRemedy_Test_Regular_Form();
                newentry.CharacterField     = TestCharacterFieldValue;
                newentry.Radio_Button_Field = null;
                newentry.IntegerField       = 1;
                for (int i = 0; i < 7; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                newentry.CharacterField = TestCharacterFieldValueChinese;
                newentry.IntegerField   = 2;
                for (int i = 0; i < 9; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                ARSet <NRemedy_Test_Regular_Form> set = new ARSet <NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        select s.IntegerField;

                int count = q.Count();
                Assert.IsTrue(count > 0);

                NRemedy_Test_Regular_Form model = new NRemedy_Test_Regular_Form();
                model.IntegerField = 110;//original is 1

                proxy.SetEntryList(null, model, new string[] { "IntegerField" });

                //after delete the count should be 0
                foreach (var i in q)
                {
                    Assert.AreEqual(110, i);
                }
            }
            finally
            {
                if (context != null)
                {
                    context.Dispose();
                }
            }
        }
        public void SetEntries_All()
        {
            ARLoginContext context = null;
            try
            {
                context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);

                NRemedy_Test_Regular_Form newentry = new NRemedy_Test_Regular_Form();
                newentry.CharacterField = TestCharacterFieldValue;
                newentry.Radio_Button_Field = null;
                newentry.IntegerField = 1;
                for (int i = 0; i < 7; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                newentry.CharacterField = TestCharacterFieldValueChinese;
                newentry.IntegerField = 2;
                for (int i = 0; i < 9; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        select s.IntegerField;

                int count = q.Count();
                Assert.IsTrue(count > 0);

                NRemedy_Test_Regular_Form model = new NRemedy_Test_Regular_Form();
                model.IntegerField = 110;//original is 1

                proxy.SetEntryList(null,model,new string[] { "IntegerField" });

                //after delete the count should be 0
                foreach(var i in q)
                {
                    Assert.AreEqual(110, i);
                }
            }
            finally
            {
                if (context != null)
                    context.Dispose();
            }
        }
        public void SetEntries_single_condition()
        {
            ARLoginContext context = null;
            try
            {
                context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        where s.CharacterField == TestCharacterFieldValue
                        select s.IntegerField;
                Assert.AreEqual(7, q.Count());

                NRemedy_Test_Regular_Form model = new NRemedy_Test_Regular_Form();
                model.IntegerField = 10;//original is 1

                proxy.SetEntryList("'Character Field' = \"" + TestCharacterFieldValue + "\"", model, new string[] { "IntegerField" });

                foreach (var i in q)
                {
                    Assert.AreEqual(10, i);
                }
            }
            finally
            {
                if (context != null)
                    context.Dispose();
            }
        }