Click here to Skip to main content
15,891,687 members
Articles / Desktop Programming / XAML

Managing Workflow Services with Windows Server AppFabric

Rate me:
Please Sign up or sign in to vote.
4.96/5 (11 votes)
3 Sep 2010CPOL20 min read 66.4K   1.9K   37  
Introduces Windows Server AppFabric.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.ApplicationServer.Caching;

namespace TestClient2
{
    class Program
    {
        static DataCache _defaultCache;

        static void Main(string[] args)
        {
            Console.WriteLine("Enter Catalog Id:");
            string catalogId = Console.ReadLine();
            //SetupCache();
            //string catalogId = GetCache();
            
            SalesRef.SaleServiceClient proxy = new SalesRef.SaleServiceClient();
            SalesRef.PurchaseOrder order = new SalesRef.PurchaseOrder();
            order.AddressLine1 = "lebanon";
            order.CatalogID = new Guid(catalogId);
            order.City = "beirut";
            order.EmailAddress = "mhalabi@devlifestyle.net";
            order.FirstName = "mohamad";
            order.LastName = "halabi";
            order.TelephoneNumber = "123";
            order.ZipCode = "01";
            List<SalesRef.ItemInfo> Items = new List<SalesRef.ItemInfo>();
            Items.Add(new SalesRef.ItemInfo() { ItemId = "Mon24Wid", ItemDescription = "24 Inch Monitor", ItemStockQuantity = 2434, ItemPrice = 265.99f, ItemOrderQuantity = 1 });
            Items.Add(new SalesRef.ItemInfo() { ItemId = "Q28Proc", ItemDescription = "Quad Core 2.8 GHz Processor", ItemStockQuantity = 3105, ItemPrice = 305.99f, ItemOrderQuantity = 1 });
            Items.Add(new SalesRef.ItemInfo() { ItemId = "XABC-123MB", ItemDescription = "XABC-123 Motherboard", ItemStockQuantity = 2153, ItemPrice = 185.99f, ItemOrderQuantity = 0 });
            Items.Add(new SalesRef.ItemInfo() { ItemId = "2GB-DDR2800", ItemDescription = "2GB DDR2800 RAM", ItemStockQuantity = 3253, ItemPrice = 39.99f, ItemOrderQuantity = 2 });
            order.Items = Items.ToArray();

            SalesRef.OrderStatus status = proxy.SubmitOrder(order);

            Console.WriteLine("Done");
            Console.ReadLine();
        }

        static void SetupCache()
        {
            DataCacheServerEndpoint[] servers = new DataCacheServerEndpoint[1];
            servers[0] = new DataCacheServerEndpoint("Mohamad-PC", 22233);

            // Setup the DataCacheFactory configuration.
            DataCacheFactoryConfiguration factoryConfig = new DataCacheFactoryConfiguration();
            factoryConfig.Servers = servers;

            // Create a configured DataCacheFactory object.
            DataCacheFactory mycacheFactory = new DataCacheFactory(factoryConfig);

            // Get a cache client for the cache "default".
            _defaultCache = mycacheFactory.GetCache("default");

        }
        static string GetCache()
        {
            if (_defaultCache.Get("catalogId") != null)
            {
                return (string)_defaultCache.Get("catalogId");
            }

            return "";

        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
Lebanon Lebanon

Comments and Discussions