예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("ID: ");
            int id = Int32.Parse(Console.ReadLine());

            // Take a Category ID and name
            CategoryClient client = new CategoryClient();

            client.Open();
            Console.WriteLine(client.GetCategoryID(id));
            Console.WriteLine("\r\n");
            Console.WriteLine(client.GetCategoryName(id));
            client.Close();

            ProductsClient productClient = new ProductsClient();

            productClient.Open();
            Console.WriteLine(productClient.GetCategoryName(id));
            Console.WriteLine("\r\n");
            Console.WriteLine(productClient.GetProductName(id));
            Console.WriteLine("\r\n");
            Console.WriteLine(productClient.GetProductQty(id));
            Console.WriteLine("\r\n");
            Console.WriteLine(productClient.GetCategoryID(id));
            productClient.Close();

            Console.ReadKey();
        }
예제 #2
0
 private static void GetProductQty(int ProductID)
 {
     try
     {
         ProductsClient client     = new ProductsClient();
         int            ProductQty = client.GetProductQty(ProductID);
         Console.WriteLine(string.Format("Product qty {0} for Product ID {1}", ProductQty, ProductID));
     }
     catch (FaultException <ServiceException> ex)
     {
         Console.WriteLine(string.Format("Errors occured in service : {0} ", ex.Detail.Message));
     }
 }
예제 #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            int            id     = 1;
            CategoryClient client = new CategoryClient();

            client.Open();
            txtCategoryID.Text   = client.GetCategoryID(id).ToString();
            txtCategoryName.Text = client.GetCategoryName(id);
            client.Close();

            ProductsClient productClient = new ProductsClient();

            productClient.Open();
            txtProductID.Text           = id.ToString();
            txtProductName.Text         = productClient.GetProductName(id).ToString();
            txtProductCategoryID.Text   = productClient.GetCategoryID(id).ToString();
            txtProductCategoryName.Text = productClient.GetCategoryName(id).ToString();
            txtProductQty.Text          = productClient.GetProductQty(id).ToString();
            productClient.Close();
        }