Ejemplo n.º 1
0
        private void PageMethodsWebFormsDelete()
        {
            if (lstPageMethodsWebForms.SelectedItems.Count != 1)
            {
                MessageBox.Show("Please select one item in the list.", "PageMethods WebForms - Delete");
                return;
            }

            int theId = 0;

            if (int.TryParse((string)lstPageMethodsWebForms.SelectedItems[0].Tag, out theId))
            {
                ProxyConfiguration config = new ProxyConfiguration("http://localhost:59878");
                IFooPageMethods fooSvc = SimpleProxy.Proxy.For<IFooPageMethods>(config);

                fooSvc.Delete(new FooByIdParameters { id = theId });
            }
            else
            {
                MessageBox.Show("Invalid Foo.", "PageMethods WebForms - Delete");

                lstPageMethodsWebForms.SelectedItems.Clear();
            }

            PageMethodsWebFormsRefresh();
        }
Ejemplo n.º 2
0
        private void PageMethodsWebFormsAdd()
        {
            string bar = BarDialog.ShowDialog(string.Empty);

            ProxyConfiguration config = new ProxyConfiguration("http://localhost:59878");
            IFooPageMethods fooSvc = SimpleProxy.Proxy.For<IFooPageMethods>(config);

            fooSvc.Add(new AddParameters { foo = new Foo { Bar = bar } });
            //fooSvc.Add(new Foo { Bar = bar });

            PageMethodsWebFormsRefresh();
        }
Ejemplo n.º 3
0
        private void PageMethodsWebFormsRefresh()
        {
            ProxyConfiguration config = new ProxyConfiguration("http://localhost:59878");
            IFooPageMethods fooSvc = SimpleProxy.Proxy.For<IFooPageMethods>(config);

            GetAllFoosResponse result = fooSvc.FindAll();

            IEnumerable<Foo> foos = result.D;

            lstPageMethodsWebForms.Items.Clear();

            foreach (Foo foo in foos)
            {
                lstPageMethodsWebForms.Items.Add(foo.ToListViewItem());
            }
        }
Ejemplo n.º 4
0
        private void PageMethodsWebFormsUpdate()
        {
            if (lstPageMethodsWebForms.SelectedItems.Count != 1)
            {
                MessageBox.Show("Please select one item in the list.", "PageMethods WebForms - Update");
                return;
            }

            int theId = 0;

            if (int.TryParse((string)lstPageMethodsWebForms.SelectedItems[0].Tag, out theId))
            {
                ProxyConfiguration config = new ProxyConfiguration("http://localhost:59878");
                IFooPageMethods fooSvc = SimpleProxy.Proxy.For<IFooPageMethods>(config);

                GetFooByIdResponse response = fooSvc.GetById(new FooByIdParameters { id = theId });
                Foo foo = response.D;

                string theBar = BarDialog.ShowDialog(foo.Bar);

                if (null != theBar)
                {
                    foo.Bar = theBar;

                    fooSvc.Update(new UpdateParameters { id = foo.Id, value = foo });
                }
            }
            else
            {
                MessageBox.Show("Invalid Foo.", "PageMethods WebForms - Update");

                lstPageMethodsWebForms.SelectedItems.Clear();
            }

            PageMethodsWebFormsRefresh();
        }