コード例 #1
0
        void CustomerEditorForm_CreateAsync(object sender, DataActionEventArgs e)
        {
            CustomerAdapter ca = CreateAdapter <CustomerAdapter>();

            if (!ca.ExistsWithCode(GetEditorData <Customer>()))
            {
                ca.Create(GetEditorData <Customer>());
            }
            else
            {
                e.Cancelled   = true;
                e.UserMessage = "A customer with the specified code already exists.";
            }
        }
コード例 #2
0
        public void CrudTest()
        {
            Customer c = new Customer(RhspDataID.Generate())
            {
                Code = "TEST",
                Name = "Test Company"
            };

            adapter.Create(c);

            Customer c2 = adapter.Get(c.DataID);

            c2.Name += " TEST";
            adapter.Update(c2);

            Customer c3 = adapter.Get(c.DataID);

            Assert.AreEqual(c2.Name, c3.Name);

            adapter.Delete(c.DataID);
        }