Exemplo n.º 1
0
        private void btn_service_Click(object sender, RoutedEventArgs e)
        {
            PersonClient personService = new PersonClient("WSHttpBinding_IPerson");

            Person person1 = personService.GetPerson();



            PersonListBox.Items.Add(person1.Name + " " + person1.Surname);
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            fixture = WebexTestFixture.Instance;
            Assert.IsNotNull(fixture);

            //webex = fixture.webex;
            webex = fixture.CreateWebex();
            Assert.IsNotNull(webex);

            person = webex.People;
            Assert.IsNotNull(person);

            other = fixture.CreatUser();
            Assert.IsNotNull(other);
        }
Exemplo n.º 3
0
        public void SetUp()
        {
            fixture = SparkTestFixture.Instance;
            Assert.IsNotNull(fixture);

            //spark = fixture.spark;
            spark = fixture.CreateSpark();
            Assert.IsNotNull(spark);

            person = spark.People;
            Assert.IsNotNull(person);

            other = fixture.CreatUser();
            Assert.IsNotNull(other);
        }
Exemplo n.º 4
0
        private void searchButton()
        {
            var a = nameText.Text;
             nameText.Equals("");

             List<PersonDTO> p = new List<PersonDTO>();

             PersonClient pc = new PersonClient();
             var pl = pc.GetPersonList();

             foreach(PersonDTO person in pl)
             {
            if (person.FirstName.Equals(a) || person.LastName.Equals(a))
            {
               p.Add(person);
            }
             }

             FillBox(p);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            var client     = new PersonClient("BasicHttpBinding_IPerson");
            var clientCalc = new CalculatorServiceReference.CalculatorClient("WSHttpBinding_ICalculator");

            Console.WriteLine(client.PrintAdress());
            Console.WriteLine(client.PrintFullName());
            Console.WriteLine();
            Console.WriteLine("Multiplicerar 50 med 100");
            Console.WriteLine(clientCalc.Multiply(50, 100));
            Console.WriteLine();

            client.EditFirstName("Sven");
            client.EditLastName("Karlsson");
            client.EditTel(042160497);
            client.EditAdress("Smack");
            Console.WriteLine(client.PrintAdress());
            Console.WriteLine(client.PrintFullName());

            Console.ReadLine();
        }
Exemplo n.º 6
0
        public static void Main(string[] args)
        {
            CredentialCache.DefaultNetworkCredentials.UserName = ConfigurationManager.AppSettings["DefaultCredentials"].Split(':')[0];
            CredentialCache.DefaultNetworkCredentials.Password = ConfigurationManager.AppSettings["DefaultCredentials"].Split(':')[1];
            var uri    = (HttpUrl)UrlParser.Parse(new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["ServerUri"].ConnectionString).DataSource);
            var client = new PersonClient(uri, ConfigurationManager.AppSettings["DefaultAuthenticationScheme"]);
            var person = new Person()
            {
                Firstname = "Test", Lastname = "Testing", Roles = new[] { "Role" }
            };

            person.Key = client.Create(person);
            Console.WriteLine("Created person '{0}'.", person.Key);
            int totalEntities;
            var persons = client.List(out totalEntities, 0, 0, null);

            Console.WriteLine("Listing all {0} person(s):", totalEntities);
            foreach (var item in persons)
            {
                Console.WriteLine("Person {0}", person.Key);
            }

            Console.ReadLine();
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            PersonClient client = new PersonClient();

            Console.WriteLine(client.CreateNewPerson("Liza", "Renzhyna", "*****@*****.**", "12345678", null));
        }
Exemplo n.º 8
0
 public PersonClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(PersonClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Exemplo n.º 9
0
 public PersonClient(EndpointConfiguration endpointConfiguration) :
     base(PersonClient.GetBindingForEndpoint(endpointConfiguration), PersonClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Exemplo n.º 10
0
 public PersonClient() :
     base(PersonClient.GetDefaultBinding(), PersonClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IPerson.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Exemplo n.º 11
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(PersonClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IPerson));
 }
Exemplo n.º 12
0
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(PersonClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_IPerson));
 }
 public void InitializeTest()
 {
     _connection   = Substitute.For <IConnectionInternal>();
     _personClient = new PersonClient(_connection);
 }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            #region Inicjalizacja Strumienia Wyjścia Na Konsole
            var sw = new StreamWriter(Console.OpenStandardOutput());
            sw.AutoFlush = true;
            Console.SetOut(sw);
            #endregion


            #region Klasa abstrakcyjna / polimorfizm

            // Instancja klasy Person nie może zostać utwrzona
            // Person person = new Person();

            // Tworzę PersonClient i zwykłego PersonVisitor
            Person client  = new PersonClient();
            Person visitor = new PersonVisitor();

            // Jest to możliwe, ponieważ PersonClient i PersonVisitor implementuje klasę Person.
            // Wywołuję metodę GetUserInfo która jest abstrakcyjna, a ciało metody zostało zaimplementowane
            // w sposób inny w obu podklasach

            client.GetPersonInfo(sw);
            visitor.GetPersonInfo(sw);

            #endregion

            #region Overlapping

            // Realizacja overlapping z wykorzystaniem kompozycji

            // Tworzę potrzebne asocjacje między klasami
            // W tym przykładzie całościa jest klasa Employee, a częsciami, między którymi zachodzi overlapping, EmployeeServiceman oraz EmployeeStorekeeper.
            Association <Employee, EmployeeServiceman> .CreateAssociation(1, 0);

            Association <Employee, EmployeeStorekeeper> .CreateAssociation(1, 0);

            // Pobieram utworzone asociacje między obiektami i przypisuje je do zmiennych.
            var servicemanAssociation = Association <Employee, EmployeeServiceman> .GetAssociation();

            var storekeeperAssociation = Association <Employee, EmployeeStorekeeper> .GetAssociation();

            // Blokada tworzenia części (klas między którymi zachodzi overlapping), bez istnienia klasy całości (nadklasy).
            // EmployeeServiceman employeeServiceman = new EmployeeServiceman(DateTime.Now, "ENGINEER");
            // EmployeeStorekeeper employeeStorekeeper = new EmployeeStorekeeper(DateTime.Now, true);

            // Utworzenie klas miedyz ktorymi zachodzi overlapping
            Employee serviceman  = new Employee(servicemanAssociation, DateTime.Now.AddYears(30), "ENGINEER");
            Employee storekeeper = new Employee(storekeeperAssociation, DateTime.Now.AddYears(25), true);

            // Pobranie wartości unikatowych dla podklas
            WriteColor($"Jaka ma specjalizacje: {serviceman.HasSpecialization(servicemanAssociation)}", ConsoleColor.Blue);
            WriteColor($"Posiada licencje na wozki widlowe: {storekeeper.HasForkliftLicense(storekeeperAssociation)}", ConsoleColor.Green);

            // A teraz pokazanie że overlapping działa
            Employee servicemanAndStorekeeper = new Employee(storekeeperAssociation, servicemanAssociation, DateTime.Now.AddYears(25), false, "ROBOTICS");

            // Wyświetlenie właściwości między którymi zachodzi overlapping
            WriteColor($"Jaka ma specjalizacje: {servicemanAndStorekeeper.HasSpecialization(servicemanAssociation)}", ConsoleColor.Blue);
            WriteColor($"Posiada licencje na wozki widlowe: {servicemanAndStorekeeper.HasForkliftLicense(storekeeperAssociation)}", ConsoleColor.Green);

            #endregion

            #region Wielodziedziczenie

            // Realizacja wielodziedziczenia z wykorzystaniem kompozycji

            // W tym przykładzie całościa jest klasa AllInOneModule, a częścią GPSModule. Klasa dziedziczy z BluetoothModule.
            Association <AllInOneModule, GPSModule> .CreateAssociation(1, 0);

            // Pobieram utworzone asociacje między obiektami i przypisuje je do zmiennych.
            var AIOMAssociation = Association <AllInOneModule, GPSModule> .GetAssociation();

            // Stworzenie zwykłej instancji klasy GPSModule
            GPSModule gpsModule = new GPSModule(new string[] { "AVLSAT", "EzLink", "Kingneed" });

            // Wyswietlenie wyniku metody GetAmoutOfConnectedDevices()
            // Dla zwykłego modułu GPS Wyświetlone zostaną tylko informacje o satelitach
            WriteColor(gpsModule.GetAmoutOfConnectedDevices(), ConsoleColor.DarkGreen);

            // Utworzenie wielodziedziczenionej klasy z użyciem kompozycji
            AllInOneModule aioModule = new AllInOneModule(AIOMAssociation, "5.0", new string[] { "AVLSAT", "EzLink", "Kingneed" });

            // Wyswietlenie wyniku metody GetAmoutOfConnectedDevices()
            // Dla wielodziedziczonego modułu GPS oraz Bluetooth wyświetlone zostaną informacje z obu modułów.
            WriteColor(aioModule.GetAmoutOfConnectedDevices(), ConsoleColor.Blue);
            #endregion

            #region Wieloaspektowe

            // Realizacja dziedziczenia wieloaspektowego metodą 1.
            // Atrybuty i metody ze zlikwidowanego aspektu umieszczam w nadklasie
            // Klasa przed zlikwidowaniem widoczna na obrazie "Wieloaspektowe.png"

            License license = new License {
                Identificator = "ABC123"
            };

            // Licencja nie może być jednocześnie pudełkowa i cyfrowa.
            try
            {
                license.BoxNumber = "EFG678";
            }
            catch (Exception ex)
            {
                WriteColor($"BLAD: {ex.Message}", ConsoleColor.Red);
            }
            #endregion

            #region Dynamic

            // Implementacja dziedziczenia dynamicznego z użyciem kompozycji i konstruktora kopiującego

            // Tworzę potrzebne asocjacje między klasami
            // W tym przykładzie całościa jest klasa User, a częsciami, między którymi zachodzi dziedziczenie dynamiczne, NormalUser oraz UserAdministrator.
            Association <User, NormalUser> .CreateAssociation(1, 0);

            Association <User, UserAdministrator> .CreateAssociation(1, 0);

            // Pobieram utworzone asociacje między obiektami i przypisuje je do zmiennych.
            var normalUserAssociation = Association <User, NormalUser> .GetAssociation();

            var administratorUserAssociation = Association <User, UserAdministrator> .GetAssociation();

            // Tworzę Administratora
            User admin = new User(administratorUserAssociation, normalUserAssociation);

            // Wywołuje metodę dostępną tylko dla administratora
            WriteColor(admin.HasIsUserLogged(administratorUserAssociation), ConsoleColor.DarkGreen);

            // Następnie uzytkownik który był adminiem staje się zwykłym użytkownikiem zachowując swoje właściwości.
            admin = new User(normalUserAssociation, administratorUserAssociation);

            // Występuje bład gdyż użytkownik nie posiada metody pokazującej zalogowanych uzytkowników.
            try
            {
                WriteColor(admin.HasIsUserLogged(administratorUserAssociation), ConsoleColor.Red);
            }
            catch (Exception ex)
            {
                WriteColor($"BLAD: {ex.Message}", ConsoleColor.Red);
            }

            #endregion


            Console.ReadLine();
        }
 public PersonServices(PersonClient personClient)
 {
     _personClient = personClient;
 }