////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Constructor. </summary>
        ///
        /// <remarks>   Aedmonds, 8/25/2017. </remarks>
        ///
        /// <param name="regMode">  The register mode. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public RegistrationAllowmentResult(RegistrationMode regMode)
        {
            switch (regMode)
            {
            case RegistrationMode.WhiteList:
                Allowed          = false;
                Denied           = true;
                ApprovalRequired = false;
                Message          = "Registration is only available for Techmer employees.";
                break;

            case RegistrationMode.BlackList:
                Allowed          = true;
                Denied           = false;
                ApprovalRequired = false;
                Message          = "Invalid email address for registration";
                break;

            case RegistrationMode.Invitation:
                Allowed          = false;
                Denied           = false;
                ApprovalRequired = true;
                Message          = "Registration is only available for invited parties.";
                break;
            }
        }
Exemple #2
0
 protected override void OnSetup()
 {
     this.window = this.AssociatedObject.FindParent <Window>();
     if (this.KeyGesture != null)
     {
         this.currentRegistrationMode             = this.RegistrationMode;
         this.PreviewKeyDownScope.PreviewKeyDown += this.OnPreviewKeyDown;
     }
 }
            public LicenceRegistrationHelper CreateNew(RegistrationMode registrationMode)
            {
                string typeName = Enum.GetName(typeof(RegistrationMode), registrationMode);

                if (!_registrationHelpers.Keys.Contains(typeName))
                {
                    throw new NotImplementedException($"{typeName} is not implemented.");
                }
                return(new LicenceRegistrationHelper((ILicenceRegistrationHelper)Activator
                                                     .CreateInstance(_registrationHelpers[typeName])));
            }
 public SalesRepTerritoryAssignment CreateSalesRepTerritoryAssignment(long userId,
                                                                      RegistrationMode eventType, long salesRepId)
 {
     return(new SalesRepTerritoryAssignment
     {
         SalesRep = new SalesRepresentative(userId)
         {
             SalesRepresentativeId = salesRepId
         },
         EventTypeSetupPermission = eventType
     });
 }
Exemple #5
0
        public void RegisterFactory <TResult>(Func <TResult> factory, RegistrationMode mode, RegistrationLifestyle lifestyle) where TResult : class
        {
            switch (lifestyle)
            {
            case RegistrationLifestyle.Singleton:
                _container.RegisterSingleton(factory);
                break;

            case RegistrationLifestyle.Transient:
                _container.Register(factory);
                break;
            }
        }
        public void RegisterFactory <T1, TResult>(Func <T1, TResult> factory, RegistrationMode mode, RegistrationLifestyle lifestyle) where TResult : class
        {
            var registration = _container.Register <T1, TResult>((serviceFactory, arg1) => factory(arg1));

            switch (lifestyle)
            {
            case RegistrationLifestyle.Singleton:
                registration.SetDefaultLifetime <PerContainerLifetime>();
                break;

            case RegistrationLifestyle.SingletonPerScope:
                registration.SetDefaultLifetime <PerScopeLifetime>();
                break;
            }
        }
 protected override void OnSetup()
 {
     if (this.designTime)
     {
         return;
     }
     this.shortCut  = this.KeyGesture;
     this.parameter = this.Parameter;
     this.window    = this.AssociatedObject.FindParent <Window>();
     if (this.shortCut != null)
     {
         this.currentRegistrationMode             = this.RegistrationMode;
         this.PreviewKeyDownScope.PreviewKeyDown += this.OnPreviewKeyDown;
     }
 }
Exemple #8
0
        public void RegisterFactory <T1, TResult>(Func <T1, TResult> factory, RegistrationMode mode, RegistrationLifestyle lifestyle) where TResult : class
        {
            var register = _builder.Register(c => factory(c.Resolve <T1>()));

            switch (lifestyle)
            {
            case RegistrationLifestyle.Singleton:
                register.SingleInstance();
                break;

            case RegistrationLifestyle.SingletonPerScope:
                register.InstancePerLifetimeScope();
                break;
            }
        }
Exemple #9
0
        public bool AssignSalesRepOwnerToTerritory(long salesRepId, long territoryId,
                                                   RegistrationMode eventTypeSetupPermission)
        {
            long organizationRoleUserId = _organizationRoleUserRepository.
                                          GetOrganizationRoleUser(salesRepId).Id;
            var entityToInsert = new OrganizationRoleUserTerritoryEntity(territoryId,
                                                                         organizationRoleUserId)
            {
                EventTypeSetupPermission = (int)eventTypeSetupPermission
            };

            using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                return(myAdapter.SaveEntity(entityToInsert));
            }
        }
        public void RegisterFactory <T1, TResult>(Func <T1, TResult> factory, RegistrationMode mode, RegistrationLifestyle lifestyle) where TResult : class
        {
            switch (lifestyle)
            {
            case RegistrationLifestyle.Transient:
                _serviceCollection.AddTransient(provider => factory(provider.GetService <T1>()));
                break;

            case RegistrationLifestyle.Singleton:
                _serviceCollection.AddSingleton(provider => factory(provider.GetService <T1>()));
                break;

            case RegistrationLifestyle.SingletonPerScope:
                _serviceCollection.AddScoped(provider => factory(provider.GetService <T1>()));
                break;
            }
        }
Exemple #11
0
        public void RegisterFactory <TResult>(Func <TResult> factory, RegistrationMode mode, RegistrationLifestyle lifestyle) where TResult : class
        {
            switch (lifestyle)
            {
            case RegistrationLifestyle.Singleton:
                _container.Register(Component.For <TResult>().UsingFactoryMethod(factory).LifeStyle.Singleton);
                break;

            case RegistrationLifestyle.SingletonPerScope:
                _container.Register(Component.For <TResult>().UsingFactoryMethod(factory)
                                    .LifeStyle.Scoped());
                break;

            case RegistrationLifestyle.Transient:
                _container.Register(Component.For <TResult>().UsingFactoryMethod(factory).LifeStyle.Transient);
                break;
            }
        }
        public void RegisterFactory <TResult>(Func <TResult> factory, RegistrationMode mode, RegistrationLifestyle lifestyle) where TResult : class
        {
            var binding = _configuration.Bind <TResult>().ToMethod(context => factory());

            switch (lifestyle)
            {
            case RegistrationLifestyle.Singleton:
                binding.InSingletonScope();
                break;

            case RegistrationLifestyle.Transient:
                binding.InTransientScope();
                break;

            default:
                throw new NotSupportedException();
            }
        }
Exemple #13
0
        /// <summary>
        /// 帳簿項目の編集(複製)のために <see cref="ActionRegistrationWindow"/> クラスの新しいインスタンスを初期化します。
        /// </summary>
        /// <param name="builder">DAOビルダ</param>
        /// <param name="selectedActionId">帳簿項目ID</param>
        /// <param name="mode">登録モード</param>
        public ActionRegistrationWindow(DaoBuilder builder, int selectedActionId, RegistrationMode mode = RegistrationMode.Edit)
        {
            this.builder        = builder;
            this.selectedBookId = null;
            this.selectedMonth  = null;
            this.selectedDate   = null;
            switch (mode)
            {
            case RegistrationMode.Edit:
            case RegistrationMode.Copy:
                this.selectedActionId = selectedActionId;
                break;
            }

            this.InitializeComponent();
            this.LoadWindowSetting();

            this.WVM.RegMode = mode;
        }
        public void RegisterFactory <T1, TResult>(Func <T1, TResult> factory, RegistrationMode mode, RegistrationLifestyle lifestyle) where TResult : class
        {
            IReuse reuse = null;

            switch (lifestyle)
            {
            case RegistrationLifestyle.Singleton:
                reuse = new SingletonReuse();
                break;

            case RegistrationLifestyle.SingletonPerScope:
                reuse = new CurrentScopeReuse();
                break;

            case RegistrationLifestyle.SingletonPerObjectGraph:
                throw new NotSupportedException("");
            }

            _container.RegisterDelegate(r => factory(r.Resolve <T1>()), reuse);
        }
Exemple #15
0
        public void CreateSalesRepTerritoryMapsEventTypeSetupPermissionsToTerritoryAssignments()
        {
            var owningUsersAndEventTypes = new List <OrderedPair <OrganizationRoleUser, RegistrationMode> >
            {
                new OrderedPair <OrganizationRoleUser, RegistrationMode>(
                    new OrganizationRoleUser(2, (long)Roles.SalesRep, 3),
                    RegistrationMode.Public),
            };
            var userSalesRepIds = new List <OrderedPair <long, long> >
            {
                new OrderedPair <long, long>(2, 7)
            };
            RegistrationMode expectedEventType = owningUsersAndEventTypes.Single().SecondValue;

            SalesRepTerritory salesRepTerritory = _territoryFactory.CreateSalesRepTerritory
                                                      (new TerritoryEntity(), owningUsersAndEventTypes, userSalesRepIds);

            Assert.AreEqual(expectedEventType,
                            salesRepTerritory.SalesRepTerritoryAssignments.Single().EventTypeSetupPermission,
                            "Sales Rep Territory Event Type Setup Permission was mapped incorrectly.");
        }
Exemple #16
0
        public void RegisterFactory <T1, TResult>(Func <T1, TResult> factory, RegistrationMode mode, RegistrationLifestyle lifestyle) where TResult : class
        {
            _container.Configure(c =>
            {
                var export = c.ExportFactory(factory);

                switch (lifestyle)
                {
                case RegistrationLifestyle.Singleton:
                    export.Lifestyle.Singleton();
                    break;

                case RegistrationLifestyle.SingletonPerScope:
                    export.Lifestyle.SingletonPerScope();
                    break;

                case RegistrationLifestyle.SingletonPerObjectGraph:
                    export.Lifestyle.SingletonPerObjectGraph();
                    break;
                }
            });
        }
        /// <summary>
        ///
        /// </summary>
        public void Register(RegistrationMode mode = RegistrationMode.Default)
        {
            this.mode = mode;
            this.Hide();
            this.IsFinished        = false;
            this.AuthenticationKey = string.Empty;

            string uri = string.Empty;

            switch (this.mode)
            {
            case RegistrationMode.IRC:
                uri = ClientRegistrationForm.IrcAuthorizationUri;
                break;

            case RegistrationMode.Default:
            default:
                uri = ClientRegistrationForm.AuthorizationUri;
                break;
            }
            this.webBrowser1.Url = new Uri(uri);
        }
Exemple #18
0
        public void RegisterFactory <T1, TResult>(Func <T1, TResult> factory, RegistrationMode mode, RegistrationLifestyle lifestyle) where TResult : class
        {
            var lifecycle = GetLifecycle(lifestyle);

            _container.Configure(r => r.For <TResult>(lifecycle).Use(context => factory(context.GetInstance <T1>())));
        }
Exemple #19
0
 public bool AssignSalesRepToTerritory(long salesRepId, long territoryId, RegistrationMode eventType)
 {
     return(_territoryRepository.AssignSalesRepOwnerToTerritory(salesRepId, territoryId, eventType));
 }
Exemple #20
0
 public void RegisterFactory <T1, T2, T3, TResult>(Func <T1, T2, T3, TResult> factory, RegistrationMode mode, RegistrationLifestyle lifestyle) where TResult : class
 {
     // requires t1, t2, t3 to be a reference type where no other containers require this
     throw new NotSupportedException();
 }
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Default constructor. </summary>
        ///
        /// <remarks>   Aedmonds, 8/25/2017. </remarks>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public RegistrationAllowmentProvider()
        {
            regMode = RegistrationMode.Invitation;
        }