Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.ServiceModel;
- using Common;
- namespace Client
- {
- public class Program
- {
- static void Main(string[] args)
- {
- ChannelFactory<IApoteka> factory = new ChannelFactory<IApoteka>("ApotekaService");
- IApoteka proxy = factory.CreateChannel();
- Lek lek1 = new Lek(1, "Brufen", 20, new List<string> { "Jabuka", "Kruska", "Dinja" });
- proxy.DodajLek(lek1);
- IspisiSveLekove(proxy.dobaviSveLekove());
- proxy.PromeniKolicinuLek(1, 5, false);
- IspisiSveLekove(proxy.PronadjiLekNaOsnovuSastojka("Jabuka"));
- try
- {
- proxy.PromeniKolicinuLek(1, 80, false);
- }catch(FaultException<CustomException> ex)
- {
- Console.WriteLine("Err: "+ex.Message);
- }
- try
- {
- proxy.ObrisiLek(45);
- }
- catch (FaultException<CustomException> ex)
- {
- Console.WriteLine("Err: " + ex.Message);
- }
- Console.WriteLine("Pritisni taster za kraj");
- Console.ReadKey();
- }
- private static void IspisiSveLekove(List<Lek> lekovi)
- {
- Console.WriteLine("------Lekovi-----");
- foreach(Lek lek in lekovi)
- {
- Console.WriteLine(lek);
- }
- Console.WriteLine("------------");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement