コード例 #1
0
ファイル: Program.cs プロジェクト: johannaastrom/TheShopWCF
        static void Main(string[] args)
        {
            ShopServiceClient client = new ShopServiceClient();

            bool isOn = true;

            while (isOn)
            {
                Console.WriteLine("Welcome to The Shop. Here are our products:");
                foreach (var item in client.GetProducts())
                {
                    Console.WriteLine(item.Id + ". " + item.Name);
                }

                Console.WriteLine("Press A to add, R to remove and U to update product.");
                switch (Console.ReadKey(true).Key)
                {
                case ConsoleKey.A:
                    AddNewProduct(client);
                    break;

                case ConsoleKey.R:
                    RemoveProduct(client);
                    break;

                case ConsoleKey.U:
                    UpdateProduct(client);
                    break;

                default:
                    isOn = false;
                    break;
                }
            }
        }
コード例 #2
0
        public WarehouseGUI()
        {
            InitializeComponent();

            proxyShop = new ShopServiceClient(new InstanceContext(this));
            proxyShop.SetClientBaseAddress();
            proxyWH = new WarehouseServiceClient();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: johannaastrom/TheShopWCF
        private static void RemoveProduct(ShopServiceClient client)
        {
            Console.WriteLine("Write id number of id to remove product");
            int removeProduct = int.Parse(Console.ReadLine());

            client.RemoveProduct(removeProduct);
            Console.WriteLine("product removed.");
            Console.Clear();
        }
コード例 #4
0
        public ProductsPage()
        {
            ShopServiceClient shopProxy = new ShopServiceClient();

            InitializeComponent();

            productBox.ItemsSource = ssc.GetAllProducts();
            ;
            moneyLeft.Content = "Money left: €"; //+ ;
        }
コード例 #5
0
        public MainForm()
        {
            InitializeComponent();

            serviceClient = new ShopServiceClient();
            dicItems      = new Dictionary <string, Item>();

            wb.DocumentText = Resources.BasketIsEmpty;
            wb.IsWebBrowserContextMenuEnabled = false;
            lblTotalAmount.Text = 0.ToString(".00");
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: johannaastrom/TheShopWCF
        private static void AddNewProduct(ShopServiceClient client)
        {
            Console.WriteLine("Write name of new product:");
            string newProduct = Console.ReadLine();

            client.AddProduct(new Product
            {
                Name = newProduct
            });
            Console.WriteLine("New product created.");
            Console.Clear();
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: johannaastrom/TheShopWCF
        private static void UpdateProduct(ShopServiceClient client)
        {
            Console.WriteLine("Write id number of id to remove product");
            int updatedId = int.Parse(Console.ReadLine());

            Console.WriteLine("Write new name of product");
            var updatedProduct = Console.ReadLine();

            client.UpdateProduct(new Product
            {
                Id   = updatedId,
                Name = updatedProduct
            });
            Console.Clear();
        }
コード例 #8
0
        public ShopGUI()
        {
            InitializeComponent();
            proxy = new ShopServiceClient(new InstanceContext(this));
            proxy.SetClientBaseAddress();
            proxy.Subscribe();

            orders = proxy.getOrders();
            Orders.Items.Clear();
            foreach (Order order in orders)
            {
                Orders.Items.Add(order.id + " " + Enum.GetName(typeof(Title), order.title) + " " + order.quant);
            }

            Dictionary <Title, int> stocks = proxy.getStocks();

            Stock.Items.Clear();
            foreach (Title t in stocks.Keys)
            {
                Stock.Items.Add(Enum.GetName(typeof(Title), t) + " " + stocks[t]);
            }
        }
コード例 #9
0
        static void Main(string[] args)
        {
            ShopServiceClient shopProxy = new ShopServiceClient();

            Console.WriteLine("All Products\n");
            foreach (Product p in shopProxy.GetAllProducts())
            {
                Console.WriteLine(p.Name);
            }

            //Console.WriteLine("Please enter your name: ");
            //string name = Console.ReadLine();
            //while (true)
            //{
            //    Console.WriteLine("Type a note (or hit enter to quit): ");
            //    string note = Console.ReadLine();
            //    if (string.IsNullOrEmpty(note))
            //    {
            //        break;
            //    }
            //    shopProxy.PostNote(name, note);
            //}
        }
コード例 #10
0
 public Printer()
 {
     proxy = new ShopServiceClient(new InstanceContext(this));
     proxy.SetClientBaseAddress();
     proxy.Subscribe();
 }
コード例 #11
0
        public LoginWindow()
        {
            ShopServiceClient shopProxy = new ShopServiceClient();

            InitializeComponent();
        }