예제 #1
0
        static void Main(string[] args)
        {
            EFUnitOfWork UOW = new EFUnitOfWork();
            //opret jesper
            var tlfJesper    = new Telephone("88888888", "TeleDanmark", "Erhverv");
            var mailJesper   = new Email("*****@*****.**");
            var adr1         = new Adress("Ringvej", "7a", "8000", "Aarhus C");
            var adr2         = new Adress("Landmands vej", "1", "2900", "Hellerup");
            var personJesper = new Person(tlfJesper, adr1, "Jesper", "Jespersen", "Jes", "Mand", mailJesper);

            //giv jesper en alternativ adresse
            AltAdresse jesperAlternativ = new AltAdresse();

            jesperAlternativ.AlternativeAdress = adr2;
            jesperAlternativ.TypeOfAdress      = "Secondary";
            personJesper.altAdresser.Add(jesperAlternativ);

            //opret Peter
            var tlf2      = new Telephone("77777777", "TeleDanmark", "Erhverv");
            var mailPeter = new Email("*****@*****.**");
            //peter bor sammen med Jesper på samme primær adresse
            var person2 = new Person(tlf2, adr1, "Peter", "Jensen", "", "Mand", mailPeter);

            UOW.addPerson(personJesper);
            UOW.addPerson(person2);
            UOW.Commit();

            PersonIndex newIndex = new PersonIndex();

            var x = UOW.GetPersonByEmail("*****@*****.**");

            newIndex.PrintPerson(x.Result);
        }
예제 #2
0
        static void Main(string[] args)
        {

            #region Setup
            //opret jesper
            var tlfJesper = new Telephone("88888888", "TeleDanmark", "Erhverv");
            var mailJesper = new Email("*****@*****.**");
            var adr1 = new Adress("Ringvej", "7a", "8000", "Aarhus C");
            var adr2 = new Adress("Landmands vej", "1", "2900", "Hellerup");
            var personJesper = new Person(tlfJesper, adr1, "Jesper", "Jespersen", "Jes", "Mand", mailJesper);

            //giv jesper en alternativ adresse
            AltAdresse jesperAlternativ = new AltAdresse();
            jesperAlternativ.AlternativeAdress = adr2;
            jesperAlternativ.TypeOfAdress = "Secondary";
            personJesper.altAdresser.Add(jesperAlternativ);

            //opret Peter
            var tlf2 = new Telephone("77777777", "TeleDanmark", "Erhverv");
            var mailPeter = new Email("*****@*****.**");
            //peter bor sammen med Jesper på samme primær adresse
            var person2 = new Person(tlf2, adr1, "Peter", "Jensen", "", "Mand", mailPeter);

            DocumentDBUnitOfWork x = new DocumentDBUnitOfWork(new DBContext());

            x._PersonRepository.AddUser(personJesper).Wait();
            var person = x._PersonRepository.GetUserByEmail(mailJesper.UniqueEmail);
            Console.WriteLine("fandt: \n" + person.GivenName + " " + person.MiddleName + " " + person.FamilyName);
            x._PersonRepository.DeleteUserByEmail(mailJesper.UniqueEmail);

            #endregion

        }
예제 #3
0
    public Person(Telephone phone, Adress primaryAdress, string name, string famileName, string middleName, string type,
                  Email mail = null)
    {
        PersonType = type;
        Email      = mail;
        Telephones.Add(phone);
        AltAdresse PrimaryAdress = new AltAdresse();

        PrimaryAdress.TypeOfAdress      = "Primary";
        PrimaryAdress.AlternativeAdress = primaryAdress;
        altAdresser.Add(PrimaryAdress);

        Type       = type;
        GivenName  = name;
        MiddleName = middleName;
        FamilyName = famileName;
    }