Beispiel #1
0
        private static void SaveRegistrant(IRegistrant registration)
        {
            var registrant = new Registrant
            {
                FirstName    = registration.FirstName,
                LastName     = registration.LastName,
                EmailAddress = registration.EmailAddress,
                Occupation   = registration.Occupation,
                BirthDate    = registration.BirthDate
            };

            DATABASE.Registrants.InsertOnSubmit(registrant);
            DATABASE.SubmitChanges();
        }
Beispiel #2
0
 public EventController(IEventCategory eventCategory,
                        IEvent eventBusiness,
                        IRegistrant registrant,
                        IGroup group,
                        EF.AARSContext context,
                        IMapper mapper)
 {
     this.context = context;
     this.eventCategoryBusiness = eventCategory;
     this.eventBusiness         = eventBusiness;
     this.registrantBusiness    = registrant;
     this.groupBusiness         = group;
     this.mapper = mapper;
 }
        public static void Run()
        {
            var dataSvc = new DataService();

            DomainService domain =
                new DomainService(
                    new UserFactory(dataSvc));

            var user = domain.RegisterUser("Marek", "password");
            var joe  = domain.RegisterUser("Joe", "pwd");

            Console.WriteLine($"{user}\n");
            Console.WriteLine($"{joe}\n");

            var group = new UserGroup();

            group.AddMember(user);
            group.AddMember(joe);

            var regGroup = new RegistrantGroup(group, "friends", "passwd");

            regGroup.Register();

            IAppointment appointment =
                user.MakeAppointment(DateTime.Now.Date.AddHours(30));

            Console.WriteLine($"{appointment}\n");
            user = domain.ChangePassword("Marek", "password", "newpassword");
            Console.WriteLine($"{user}\n");

            var registrants = new IRegistrant[]
            {
                new PersistableUser(joe, dataSvc, "pwd"),
                new PersistableUser(user, dataSvc, "password")
            };

            MassRegister(registrants);
            ScramblePasswords(registrants);
            Console.ReadLine();
        }
 protected void AddToRegistrant(IRegistrant registrant)
 {
     AddToRegistrant(registrant.GetRegisteredTypeAssociation());
 }
 public new void AddToRegistrant(IRegistrant registrant)
 {
     base.AddToRegistrant(registrant);
 }
Beispiel #6
0
        static void Main(string[] args)
        {
            DomainService domain =
                new DomainService(
                    new UserFactory(
                        new DataService()),
                    new UserGroupFactory());



            //IUser user = domain.RegisterUser("zoranh", "magicword");
            //Console.WriteLine("{0}\n", user);

            //IAppointment appointment =
            //   user.MakeAppointment(DateTime.Now.Date.AddHours(40));
            //Console.WriteLine("{0}\n", appointment);

            //user = domain.ChangeUserPassword("zoranh", "magicword", "somethingmorecomplex");

            //Console.WriteLine("{0}\n", user);



            //Console.WriteLine(new string('-', 60));



            //IUser jill = domain.RegisterUser("Jill", "pwd");
            //IUser joe = domain.RegisterUser("Joe", "pwd");
            //IUser jack = domain.RegisterUser("Jack", "pwd");

            //IUserGroup group = new UserGroup("friends");
            //group.AddMember(jill);
            //group.AddMember(joe);
            //group.AddMember(jack);

            //IRegistrantGroup regGroup = new PersistableGroup(group, "secret");

            //regGroup.Register();



            //Console.WriteLine(new string('-', 60));



            //IUser jill = domain.RegisterUser("Jill", "pwd");
            //IUser joe = domain.RegisterUser("Joe", "pwd");
            //IUser jack = domain.RegisterUser("Jack", "pwd");

            //IUserGroup group2 = new UserGroup("friends");
            //group2.AddMember(jill);
            //group2.AddMember(joe);
            //group2.AddMember(jack);

            //domain.RegisterGroup(group2, "secret");



            //Console.WriteLine(new string('-', 60));



            //List<IUser> users = new List<IUser>(){
            //    domain.RegisterUser("Jill", "pwd"),
            //    domain.RegisterUser("Joe", "pwd"),
            //    domain.RegisterUser("Jack", "pwd")};

            //IUserGroup group3 = domain.RegisterGroup(users, "friends", "secret");
            //domain.ChangeGroupPassword(group3, "secret", "complicatedsecret");



            Console.WriteLine(new string('-', 60));

            IUser jill = new User("Jill");
            IUser joe  = new User("Joe");
            IUser jack = new User("Jack");

            IUserGroup group4 = new UserGroup("friends");

            group4.AddMember(jill);
            group4.AddMember(joe);
            group4.AddMember(jack);

            DataService dataSvc = new DataService();

            IEnumerable <IRegistrant> registrants =
                new IRegistrant[]
            {
                new PersistableUser(jill, dataSvc, "pwd"),
                new PersistableUser(joe, dataSvc, "pwd"),
                new PersistableUser(jack, dataSvc, "pwd"),
                new PersistableGroup(group4, "secret")
            };

            //MassRegister(registrants);
            ScramblePassword(registrants);



            Console.ReadLine();
        }
 public static void RegisterTypes(this IRegistrant registrant, IServiceCollection container, IResolverService resolver)
 {
     registrant.GetRegisteredTypeAssociation().RegisterTypes(container, resolver);
 }
 IRegistration IRegisterer.RegisterForLeagueByAge(
     IRegistrant personToRegister,
     ILeagueSeason leagueSeasonToRegisterFor)
 {
     return(IRegistration.Null);
 }
 public static void RegisterTypes(this IRegistrant registrant, ContainerBuilder container, IResolverService resolverService)
 {
     registrant.GetRegisteredTypeAssociation().RegisterTypes(container, resolverService);
 }