using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace dotnetconsulting.WcfSampleClient
{
    class Program
    {
        static void Main(string[] args)
        {

            try
            {
                // Client erzeugen
                ServiceReference1.BankServiceClient bc = new ServiceReference1.BankServiceClient();

                // Betrag abheben
                bc.WithdrawAmount("1234", 99.99m);

                // ...
            }
            catch (FaultException<ServiceReference1.WithdrawException> ex)
            {
                switch (ex.Detail.ReasonCode)
                {
                    case 1: //
                        Console.WriteLine(" Betrag kleiner gleich 0");
                        break;
                    case 2: 
                        Console.WriteLine("Nicht genügend Deckung auf dem Konto");
                        break;
                    default:
                        throw new InvalidOperationException("ReasonCode ungekannt");
                }
            }
        }
    }
}
