protected override LoadContainer BuildTopology(TopologyExtractorFactoryContext topologyExtractorContext)
        {
            TopologyExtractorFactory loadBalancingLocalFactory = topologyExtractorContext.GetLoadBalancingLocalFactory(false);
            DirectoryServer          localServer   = base.ServiceContext.Directory.GetLocalServer();
            TopologyExtractor        extractor     = loadBalancingLocalFactory.GetExtractor(localServer);
            LoadContainer            loadContainer = extractor.ExtractTopology();

            ExAssert.RetailAssert(loadContainer != null, "Extracted toplogy for server '{0}' should never be null.", new object[]
            {
                localServer
            });
            DatabaseCollector databaseCollector = new DatabaseCollector();

            loadContainer.Accept(databaseCollector);
            IOperationRetryManager operationRetryManager = LoadBalanceOperationRetryManager.Create(1, TimeSpan.Zero, base.ServiceContext.Logger);

            foreach (LoadContainer loadContainer2 in databaseCollector.Databases)
            {
                DirectoryDatabase directoryDatabase = loadContainer2.DirectoryObject as DirectoryDatabase;
                if (directoryDatabase != null)
                {
                    DatabaseProcessor @object = new DatabaseProcessor(base.ServiceContext.Settings, base.ServiceContext.DrainControl, base.ServiceContext.Logger, directoryDatabase);
                    operationRetryManager.TryRun(new Action(@object.ProcessDatabase));
                }
            }
            return(loadContainer);
        }
Beispiel #2
0
        protected virtual ILoadBalanceService CreateLoadBalancerClient(DirectoryServer server, IDirectoryProvider directory)
        {
            ILoadBalanceService result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                LoadBalancerClient loadBalancerClient = LoadBalancerClient.Create(server.Fqdn, directory, this.logger);
                disposeGuard.Add <LoadBalancerClient>(loadBalancerClient);
                bool flag = true;
                ILoadBalanceService loadBalanceService = loadBalancerClient;
                if (!loadBalancerClient.ServerVersion[1])
                {
                    flag = false;
                    loadBalanceService = this.CreateCompatibilityLoadBalanceClient(server);
                }
                else if (!loadBalancerClient.ServerVersion[2])
                {
                    loadBalanceService = new SoftDeletedRemovalCapabilityDecorator(loadBalanceService, server);
                }
                if (!loadBalancerClient.ServerVersion[3])
                {
                    loadBalanceService = new ConsumerMetricsLoadBalanceCapabilityDecorator(loadBalanceService, server);
                }
                if (!loadBalancerClient.ServerVersion[5])
                {
                    loadBalanceService = new CapacitySummaryCapabilityDecorator(loadBalanceService, server, this.serviceContext);
                }
                if (flag)
                {
                    disposeGuard.Success();
                }
                result = loadBalanceService;
            }
            return(result);
        }
        public async Task <IActionResult> PutDirectoryServer(int id, DirectoryServer directoryServer)
        {
            if (id != directoryServer.ID)
            {
                return(BadRequest());
            }

            _context.Entry(directoryServer).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DirectoryServerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <DirectoryServer> > PostDirectoryServer(DirectoryServer directoryServer)
        {
            _context.DirectoryServers.Add(directoryServer);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDirectoryServer", new { id = directoryServer.ID }, directoryServer));
        }
        public IEnumerable <DirectoryDatabase> GetDatabasesOwnedByServer(DirectoryServer server)
        {
            IOperationRetryManager retryManager = LoadBalanceOperationRetryManager.Create(this.logger);

            foreach (MailboxDatabase database in this.ConfigurationSession.GetDatabasesOnServer(server.Identity))
            {
                DirectoryDatabase           result          = null;
                MailboxDatabase             databaseCopy    = database;
                OperationRetryManagerResult operationResult = retryManager.TryRun(delegate
                {
                    result = this.DirectoryDatabaseFromDatabase(databaseCopy);
                });
                if (!operationResult.Succeeded)
                {
                    this.logger.LogError(operationResult.Exception, "Could not retrieve database {0} for server {1}.", new object[]
                    {
                        databaseCopy.Name,
                        server.Name
                    });
                }
                else if (result != null)
                {
                    yield return(result);
                }
            }
            yield break;
        }
Beispiel #6
0
        protected virtual IInjectorService CreateInjectorClient(DirectoryServer server, IDirectoryProvider directory)
        {
            IInjectorService result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                InjectorClient injectorClient = InjectorClient.Create(server.Fqdn, directory, this.logger);
                disposeGuard.Add <InjectorClient>(injectorClient);
                bool             flag            = true;
                IInjectorService injectorService = injectorClient;
                if (!injectorClient.ServerVersion[1])
                {
                    flag            = false;
                    injectorService = this.CreateCompatibilityInjectorClient(server);
                }
                if (!injectorClient.ServerVersion[2])
                {
                    injectorService = new ConsumerMetricsInjectorCapabilityDecorator(injectorService);
                }
                if (flag)
                {
                    disposeGuard.Success();
                }
                result = injectorService;
            }
            return(result);
        }
Beispiel #7
0
 private IInjectorService CreateCompatibilityInjectorClient(DirectoryServer server)
 {
     this.logger.LogVerbose("Creating full compatibility injector client for server {0}", new object[]
     {
         server.Name
     });
     return(new BackCompatibleInjectorClient(this.serviceContext.Service, this.serviceContext.MoveInjector));
 }
Beispiel #8
0
        private LoadContainer GetServerContainer()
        {
            DirectoryServer server = this.context.Directory.GetServer(base.Arguments.ServerGuid);

            if (server == null)
            {
                throw new ServerNotFoundException(base.Arguments.ServerGuid.ToString());
            }
            return(this.GetTopologyForDirectoryObject(server));
        }
Beispiel #9
0
        /// <summary>
        /// Creates the responder with a directory server.
        /// </summary>
        /// <param name="directoryServer">Directory server to use</param>
        public HttpJsonResponder(DirectoryServer directoryServer)
        {
            if (directoryServer == null)
            {
                throw new ArgumentNullException("directoryServer");
            }

            this.directoryServer = directoryServer;

            httpListener = new HttpListener();
            InitializeListener();
        }
Beispiel #10
0
        protected ILoadBalanceService CreateCompatibilityLoadBalanceClient(DirectoryServer server)
        {
            this.logger.LogVerbose("Creating full compatibility LB client for server {0}", new object[]
            {
                server.Name
            });
            BackCompatibleLoadBalanceClient               service  = new BackCompatibleLoadBalanceClient(null, server);
            BandAsMetricCapabilityDecorator               service2 = new BandAsMetricCapabilityDecorator(service, this.serviceContext, server);
            SoftDeletedRemovalCapabilityDecorator         service3 = new SoftDeletedRemovalCapabilityDecorator(service2, server);
            ConsumerMetricsLoadBalanceCapabilityDecorator service4 = new ConsumerMetricsLoadBalanceCapabilityDecorator(service3, server);

            return(new CapacitySummaryCapabilityDecorator(service4, server, this.serviceContext));
        }
        public void TestSites()
        {
            using (Forest forest = Forest.GetForest(ActiveDirectoryContext))
            {
                using (ActiveDirectorySite site = forest.Sites[0])
                    using (ActiveDirectorySite s = ActiveDirectorySite.FindByName(ActiveDirectoryContext, site.Name))
                    {
                        Assert.Equal(site.Name, s.Name);
                        Assert.True(s.Domains.Contains(forest.RootDomain));
                        Assert.NotNull(s.AdjacentSites);
                        Assert.NotNull(s.BridgeheadServers);
                        Assert.NotNull(s.PreferredRpcBridgeheadServers);
                        Assert.NotNull(s.PreferredSmtpBridgeheadServers);
                        Assert.NotNull(s.Subnets);

                        Assert.True(s.SiteLinks.Count > 0);
                        using (ActiveDirectorySiteLink adsl = s.SiteLinks[0])
                        {
                            Assert.True(s.SiteLinks.Contains(adsl));
                            Assert.Equal(0, s.SiteLinks.IndexOf(adsl));
                            Assert.True(adsl.Sites.Contains(s));
                            Assert.True(adsl.Cost >= 0);
                            Assert.True(adsl.TransportType == ActiveDirectoryTransportType.Rpc || adsl.TransportType == ActiveDirectoryTransportType.Smtp);
                        }

                        Assert.True(s.Servers.Contains(s.InterSiteTopologyGenerator));

                        using (DirectoryServer ds = s.Servers[0])
                        {
                            Assert.NotNull(ds.InboundConnections);
                            Assert.NotNull(ds.OutboundConnections);
                            Assert.True(ds.IPAddress.IndexOf('.') >= 0);
                            Assert.Equal(s.Name, ds.SiteName);

                            Assert.True(ds.Partitions.Count > 0);
                            string firstPartition = ds.Partitions[0];
                            Assert.True(ds.Partitions.Contains(firstPartition));
                            Assert.Equal(0, ds.Partitions.IndexOf(firstPartition));

                            string [] partitions = new string[0];
                            Assert.Throws <ArgumentException>(() => ds.Partitions.CopyTo(partitions, 0));
                            Assert.Throws <ArgumentNullException>(() => ds.Partitions.CopyTo(null, 0));
                            Assert.Throws <ArgumentOutOfRangeException>(() => ds.Partitions.CopyTo(partitions, -1));

                            partitions = new string[ds.Partitions.Count];
                            ds.Partitions.CopyTo(partitions, 0);
                            Assert.True(partitions.Contains(firstPartition));
                        }
                    }
            }
        }
Beispiel #12
0
        private HeatMapCapacityData GetServerCapacityDatum(DirectoryIdentity objectIdentity, bool refreshData, DirectoryIdentity localServerIdentity)
        {
            if (objectIdentity.Equals(localServerIdentity))
            {
                return(this.serviceContext.LocalServerHeatMap.ToCapacityData());
            }
            DirectoryServer     server = (DirectoryServer)this.serviceContext.Directory.GetDirectoryObject(objectIdentity);
            HeatMapCapacityData capacitySummary;

            using (ILoadBalanceService loadBalanceClientForServer = this.serviceContext.ClientFactory.GetLoadBalanceClientForServer(server, false))
            {
                capacitySummary = loadBalanceClientForServer.GetCapacitySummary(objectIdentity, refreshData);
            }
            return(capacitySummary);
        }
Beispiel #13
0
        /// <summary>
        /// Creates the responder with a directory server.
        /// </summary>
        /// <param name="directoryServer">Directory server to use</param>
        public HttpJsonResponder(DirectoryServer directoryServer)
        {
            _logger = Log.createClient("HttpJsonResponder");

            if (directoryServer == null)
            {
                Log.write(TLog.Warning, "Cannot start the Json Responder, directory server is null.");
                return;
            }

            this.directoryServer = directoryServer;

            httpListener = new HttpListener();
            InitializeListener();
        }
Beispiel #14
0
        private HeatMapCapacityData GetDatabaseCapacityDatum(DirectoryIdentity objectIdentity, bool refreshData, DirectoryIdentity localServerIdentity)
        {
            DirectoryDatabase directoryDatabase = (DirectoryDatabase)this.serviceContext.Directory.GetDirectoryObject(objectIdentity);
            DirectoryServer   directoryServer   = directoryDatabase.ActivationOrder.FirstOrDefault <DirectoryServer>();

            if (directoryServer == null || localServerIdentity.Equals(directoryServer.Identity))
            {
                TopologyExtractorFactoryContext topologyExtractorFactoryContext = this.serviceContext.GetTopologyExtractorFactoryContext();
                TopologyExtractorFactory        loadBalancingLocalFactory       = topologyExtractorFactoryContext.GetLoadBalancingLocalFactory(refreshData);
                LoadContainer loadContainer = loadBalancingLocalFactory.GetExtractor(directoryDatabase).ExtractTopology();
                return(loadContainer.ToCapacityData());
            }
            HeatMapCapacityData capacitySummary;

            using (ILoadBalanceService loadBalanceClientForDatabase = this.serviceContext.ClientFactory.GetLoadBalanceClientForDatabase(directoryDatabase))
            {
                capacitySummary = loadBalanceClientForDatabase.GetCapacitySummary(objectIdentity, refreshData);
            }
            return(capacitySummary);
        }
Beispiel #15
0
 private TClient GetClient <TClient>(DirectoryServer server, bool allowFallback, Func <DirectoryServer, IDirectoryProvider, TClient> clientFactory, Func <DirectoryServer, TClient> fallbackClientFactory) where TClient : class
 {
     try
     {
         return(clientFactory(server, server.Directory));
     }
     catch (EndpointNotFoundTransientException ex)
     {
         this.logger.Log(MigrationEventType.Warning, "Could not open connection to server {0}: {1}.", new object[]
         {
             server.Fqdn,
             ex
         });
         if (!allowFallback)
         {
             throw;
         }
     }
     return(fallbackClientFactory(server));
 }
Beispiel #16
0
        public virtual TopologyExtractor GetExtractor(DirectoryObject directoryObject)
        {
            DirectoryMailbox directoryMailbox = directoryObject as DirectoryMailbox;

            if (directoryMailbox != null)
            {
                return(this.CreateMailboxExtractor(directoryMailbox));
            }
            DirectoryDatabase directoryDatabase = directoryObject as DirectoryDatabase;

            if (directoryDatabase != null)
            {
                return(this.CreateDatabaseExtractor(directoryDatabase));
            }
            DirectoryServer directoryServer = directoryObject as DirectoryServer;

            if (directoryServer != null)
            {
                return(this.CreateServerExtractor(directoryServer));
            }
            DirectoryDatabaseAvailabilityGroup directoryDatabaseAvailabilityGroup = directoryObject as DirectoryDatabaseAvailabilityGroup;

            if (directoryDatabaseAvailabilityGroup != null)
            {
                return(this.CreateDagExtractor(directoryDatabaseAvailabilityGroup));
            }
            DirectoryForest directoryForest = directoryObject as DirectoryForest;

            if (directoryForest != null)
            {
                return(this.CreateForestExtractor(directoryForest));
            }
            DirectoryContainerParent directoryContainerParent = directoryObject as DirectoryContainerParent;

            if (directoryContainerParent != null)
            {
                return(this.CreateContainerParentExtractor(directoryContainerParent));
            }
            return(null);
        }
Beispiel #17
0
 protected virtual TopologyExtractor CreateServerExtractor(DirectoryServer directoryServer)
 {
     return(this.CreateContainerParentExtractor(directoryServer));
 }
 /// <summary>
 /// Generic Constructor
 /// </summary>
 public AssetManager(DirectoryServer server)
 {
     directoryServer = server;
 }
Beispiel #19
0
        public static void SeedAsync(ApplicationDbContext context)
        {
            if (!context.Categories.Any())
            {
                var pictures = new List <Picture>
                {
                    new Picture {
                        Path = "1.jpg"
                    },
                    new Picture {
                        Path = "2.jpg"
                    },
                    new Picture {
                        Path = "3.jpg"
                    },
                    new Picture {
                        Path = "4.jpg"
                    },
                    new Picture {
                        Path = "5.jpg"
                    },
                    new Picture {
                        Path = "6.jpg"
                    },
                    new Picture {
                        Path = "7.jpg"
                    },
                };

                pictures.ForEach(p => context.Pictures.Add(p));
                context.SaveChanges();

                var categories = new List <Category>
                {
                    new Category {
                        Name = "Na ostro"
                    },
                    new Category {
                        Name = "Wegetariańskie"
                    },
                    new Category {
                        Name = "Z mięsem"
                    },
                    new Category {
                        Name = "Tradycyjne"
                    },
                    new Category {
                        Name = "Polecane"
                    },
                };

                categories.ForEach(p => context.Categories.Add(p));
                context.SaveChanges();

                var products = new List <Product>
                {
                    new Product {
                        Name        = "Margherita",
                        Description = "ciasto, sos pomidorowy, ser, oregano",
                        Price       = 19.99m,
                        SalePrice   = 19.99m,
                        Available   = true,
                        Pictures    = new List <Picture>()
                        {
                            pictures[6]
                        }
                    },
                    new Product {
                        Name        = "Margheritana",
                        Description = "ciasto, sos pomidorowy, oregano, czosnek",
                        Price       = 20.99m,
                        SalePrice   = 20.99m,
                        Available   = false,
                        Pictures    = new List <Picture>()
                        {
                            pictures[0]
                        }
                    },
                    new Product {
                        Name        = "Americana",
                        Description = "ciasto, ser, sos barbecue, kurczak, cebula, jalapeno",
                        Price       = 26.99m,
                        SalePrice   = 23.99m,
                        Available   = true,
                        Pictures    = new List <Picture>()
                        {
                            pictures[1]
                        }
                    },
                    new Product {
                        Name        = "Siciliana",
                        Description = "ciasto, ser, sos pomidorowy, oliwki, pieczarki, jalapeno, salami",
                        Price       = 28.99m,
                        SalePrice   = 28.99m,
                        Available   = true,
                        Pictures    = new List <Picture>()
                        {
                            pictures[2]
                        }
                    },
                    new Product {
                        Name        = "Italiano",
                        Description = "ciasto, ser, sos śmietanowy, kapary, oregano, oliwki, kurczak",
                        Price       = 27.99m,
                        SalePrice   = 27.99m,
                        Available   = true,
                        Pictures    = new List <Picture>()
                        {
                            pictures[3]
                        }
                    },
                    new Product {
                        Name        = "Simple",
                        Description = "ciasto, ser, szynka, pomidor, papryka",
                        Price       = 27.99m,
                        SalePrice   = 27.99m,
                        Available   = true,
                        Pictures    = new List <Picture>()
                        {
                            pictures[4]
                        }
                    },
                    new Product {
                        Name        = "Inferno",
                        Description = "ciasto, ser, sos pomidorowy, papryczka, oregano",
                        Price       = 22.99m,
                        SalePrice   = 22.99m,
                        Available   = true,
                        Pictures    = new List <Picture>()
                        {
                            pictures[5]
                        }
                    }
                };

                products.ForEach(p => context.Products.Add(p));
                context.SaveChanges();

                var productCategories = new List <ProductCategory>
                {
                    new ProductCategory {
                        Product = products[0], Category = categories[1]
                    },
                    new ProductCategory {
                        Product = products[1], Category = categories[1]
                    },
                    new ProductCategory {
                        Product = products[1], Category = categories[3]
                    },
                    new ProductCategory {
                        Product = products[2], Category = categories[0]
                    },
                    new ProductCategory {
                        Product = products[2], Category = categories[2]
                    },
                    new ProductCategory {
                        Product = products[2], Category = categories[3]
                    },
                    new ProductCategory {
                        Product = products[2], Category = categories[4]
                    },
                    new ProductCategory {
                        Product = products[3], Category = categories[0]
                    },
                    new ProductCategory {
                        Product = products[3], Category = categories[2]
                    },
                    new ProductCategory {
                        Product = products[3], Category = categories[3]
                    },
                    new ProductCategory {
                        Product = products[3], Category = categories[4]
                    },
                    new ProductCategory {
                        Product = products[4], Category = categories[0]
                    },
                    new ProductCategory {
                        Product = products[4], Category = categories[2]
                    },
                    new ProductCategory {
                        Product = products[5], Category = categories[2]
                    },
                    new ProductCategory {
                        Product = products[6], Category = categories[2]
                    },
                };

                productCategories.ForEach(p => context.ProductCategories.Add(p));
                context.SaveChanges();

                var orderStatuses = new List <OrderStatus>
                {
                    new OrderStatus {
                        Status = "Awaiting Payment"
                    },
                    new OrderStatus {
                        Status = "Declined"
                    },
                    new OrderStatus {
                        Status = "Completed"
                    },
                };

                orderStatuses.ForEach(o => context.OrderStatuses.Add(o));
                context.SaveChanges();

                var directoryServer = new DirectoryServer()
                {
                    Name   = "Main Directory Server",
                    URL    = "https://localhost:44339/",
                    Path   = "api/payment/cardSecure",
                    ApiKey = "ad777c2b-d332-4107-838a-b37738fa8e1f"
                };

                context.DirectoryServers.Add(directoryServer);
                context.SaveChanges();

                var bank = new Bank()
                {
                    Name   = "Bank",
                    URL    = "https://localhost:44377/",
                    Path   = "paymentCards/cardPayment",
                    ApiKey = "2a9f86fc-8fd6-439d-99af-30d743180d6a"
                };

                context.Banks.Add(bank);
                context.SaveChanges();
            }
        }
Beispiel #20
0
 public SoftDeletedRemovalCapabilityDecorator(ILoadBalanceService service, DirectoryServer targetServer) : base(service, targetServer)
 {
 }
Beispiel #21
0
 public int IndexOf(DirectoryServer server)
 {
 }
 public ReplicationConnection(DirectoryContext context, string name, DirectoryServer sourceServer, ActiveDirectorySchedule schedule)
 {
 }
        protected override void Seed(BankContext context)
        {
            var roleManager = new RoleManager <IdentityRole>(
                new RoleStore <IdentityRole>(new ApplicationDbContext()));

            var userManager = new UserManager <ApplicationUser>(
                new UserStore <ApplicationUser>(new ApplicationDbContext()));

            roleManager.Create(new IdentityRole("Admin"));
            roleManager.Create(new IdentityRole("User"));
            roleManager.Create(new IdentityRole("Worker"));

            var user = new ApplicationUser {
                UserName = "******"
            };
            string password = "******";

            userManager.Create(user, password);
            userManager.AddToRole(user.Id, "User");

            var user2 = new ApplicationUser {
                UserName = "******"
            };
            string password2 = "Password.2";

            userManager.Create(user2, password2);
            userManager.AddToRole(user2.Id, "User");

            var user3 = new ApplicationUser {
                UserName = "******"
            };
            string password3 = "Admin.1";

            userManager.Create(user3, password3);
            userManager.AddToRole(user3.Id, "Admin");

            var worker = new ApplicationUser {
                UserName = "******"
            };
            string workerpass = "******";

            userManager.Create(worker, workerpass);
            userManager.AddToRole(worker.Id, "Worker");

            var currencies = new List <Currency>
            {
                new Currency {
                    Name          = "złoty",
                    Code          = "PLN",
                    EffectiveDate = DateTime.Now,
                    Bid           = 1.0000m,
                    Ask           = 1.0000m
                },
                new Currency {
                    Name          = "euro",
                    Code          = "EUR",
                    EffectiveDate = DateTime.Now,
                    Bid           = 4.4601m,
                    Ask           = 4.5503m
                },
                new Currency {
                    Name          = "dolar amerykański",
                    Code          = "USD",
                    EffectiveDate = DateTime.Now,
                    Bid           = 3.6382m,
                    Ask           = 3.7118m
                },
                new Currency {
                    Name          = "frank szwajcarski",
                    Code          = "CHF",
                    EffectiveDate = DateTime.Now,
                    Bid           = 4.1106m,
                    Ask           = 4.1936m
                },
                new Currency {
                    Name          = "funt szterling",
                    Code          = "GBP",
                    EffectiveDate = DateTime.Now,
                    Bid           = 4.9354m,
                    Ask           = 5.0352m
                },
            };

            currencies.ForEach(c => context.Currencies.Add(c));
            context.SaveChanges();

            RefreshCurrency.RefreshCurrenciesAsync().ConfigureAwait(false);

            var transactionTypes = new List <TransactionType>
            {
                new TransactionType {
                    Type = "TRANSFER"
                },
                new TransactionType {
                    Type = "CARD_PAYMENT"
                },
                new TransactionType {
                    Type = "CASH_WITHDRAWAL"
                },
                new TransactionType {
                    Type = "CASH_DEPOSIT"
                },
                new TransactionType {
                    Type = "CURR_EXCHANGE"
                },
                new TransactionType {
                    Type = "CREDIT_TRANSFER"
                },
            };

            transactionTypes.ForEach(t => context.TransactionTypes.Add(t));
            context.SaveChanges();

            var bankAccountTypes = new List <BankAccountType>
            {
                new BankAccountType {
                    Type = "PAY_ACC_FOR_YOUNG", Commission = 0m
                },
                new BankAccountType {
                    Type = "PAY_ACC_FOR_ADULT", Commission = 5m
                },
                new BankAccountType {
                    Type = "FOR_CUR_ACC", Commission = 7m
                }
            };

            bankAccountTypes.ForEach(b => context.BankAccountTypes.Add(b));
            context.SaveChanges();

            var creditType = new CreditType {
                Name = "kredyt gotówkowy", Commission = 8.99m, Rates = 0m
            };

            context.CreditTypes.Add(creditType);
            context.SaveChanges();

            var bankAccounts = new List <BankAccount>
            {
                new BankAccount {
                    Balance           = 100.50m,
                    AvailableFounds   = 100.50m,
                    Lock              = 0m,
                    BankAccountNumber = "12 1234 1234 1234 1234 1234 1230",
                    CreationDate      = new DateTime(2020, 06, 04),
                    BankAccountType   = bankAccountTypes[0],
                    Currency          = currencies[0],
                },

                new BankAccount {
                    Balance           = 50m,
                    AvailableFounds   = 50m,
                    Lock              = 0m,
                    BankAccountNumber = "12 1234 1234 1234 1234 1234 1231",
                    CreationDate      = new DateTime(2020, 06, 03),
                    BankAccountType   = bankAccountTypes[1],
                    Currency          = currencies[0],
                },

                new BankAccount {
                    Balance           = 20m,
                    AvailableFounds   = 20m,
                    Lock              = 0m,
                    BankAccountNumber = "12 1234 1234 1234 1234 1234 1232",
                    CreationDate      = new DateTime(2020, 09, 06),
                    BankAccountType   = bankAccountTypes[2],
                    Currency          = currencies[1]
                }
            };

            bankAccounts.ForEach(b => context.BankAccounts.Add(b));
            context.SaveChanges();

            var paymentCards = new List <PaymentCard>
            {
                new PaymentCard
                {
                    PaymentCardNumber = "1234 1234 1234 1230",
                    Code        = "0321",
                    Blocked     = false,
                    SecureCard  = true,
                    BankAccount = bankAccounts[0]
                },
                new PaymentCard
                {
                    PaymentCardNumber = "1234 1234 1234 1231",
                    Code        = "3021",
                    Blocked     = true,
                    SecureCard  = false,
                    BankAccount = bankAccounts[1]
                },
                new PaymentCard
                {
                    PaymentCardNumber = "1234 1234 1234 1232",
                    Code        = "3201",
                    Blocked     = false,
                    SecureCard  = true,
                    BankAccount = bankAccounts[2]
                },
            };

            paymentCards.ForEach(p => context.PaymentCards.Add(p));
            context.SaveChanges();

            var profiles = new List <Profile>
            {
                new Profile
                {
                    FirstName    = "John",
                    LastName     = "Travolta",
                    Email        = user.UserName,
                    BankAccounts = new List <BankAccount>()
                    {
                        bankAccounts[0], bankAccounts[2]
                    }
                },
                new Profile
                {
                    FirstName    = "John",
                    LastName     = "Travolta",
                    Email        = user2.UserName,
                    BankAccounts = new List <BankAccount>()
                    {
                        bankAccounts[1]
                    }
                },
                new Profile {
                    Email = user3.UserName
                },
                new Profile {
                    Email = worker.UserName
                },
            };

            profiles.ForEach(p => context.Profiles.Add(p));
            context.SaveChanges();

            var acquirer = new Acquirer()
            {
                Name                  = "Giga Pizza",
                URL                   = "https://localhost:44395/",
                OrderDetailsPath      = "api/orders/",
                UpdateOrderStatusPath = "api/orders/updateStatus",
                OrderSummaryPath      = "summary/",
                Description           = "Brak pomysłu na obiad? Zamów pizzę online. Giga Pizza to giga przyjemność!",
                BankAccountNumebr     = "52 7949 1333 2906 6136 7434 4779",
                ApiKey                = "2a9f86fc-8fd6-439d-99af-30d743180d6a"
            };

            context.Acquirers.Add(acquirer);
            context.SaveChanges();

            var directoryServer = new DirectoryServer()
            {
                Name   = "Main Directory Server",
                ApiKey = "06b9e986-9609-4892-933f-9ced84f3e1c8"
            };

            context.DirectoryServers.Add(directoryServer);
            context.SaveChanges();
        }
Beispiel #24
0
 public ConsumerMetricsLoadBalanceCapabilityDecorator(ILoadBalanceService service, DirectoryServer targetServer) : base(service, targetServer)
 {
 }
	// Methods
	public int Add(DirectoryServer server) {}
 public CapacitySummaryCapabilityDecorator(ILoadBalanceService service, DirectoryServer targetServer, LoadBalanceAnchorContext context) : base(service, targetServer)
 {
     this.context = context;
 }
Beispiel #27
0
 // Methods
 public int Add(DirectoryServer server)
 {
 }
Beispiel #28
0
 public void Remove(DirectoryServer server)
 {
 }
Beispiel #29
0
 public void Insert(int index, DirectoryServer server)
 {
 }
	public void AddRange(DirectoryServer[] servers) {}
 public ReplicationConnection(DirectoryContext context, string name, DirectoryServer sourceServer, ActiveDirectorySchedule schedule, ActiveDirectoryTransportType transport)
 {
 }
	public void Insert(int index, DirectoryServer server) {}
Beispiel #33
0
 public bool Contains(DirectoryServer server)
 {
 }
 public BandAsMetricCapabilityDecorator(ILoadBalanceService service, LoadBalanceAnchorContext serviceContext, DirectoryServer targetServer) : base(service, targetServer)
 {
     AnchorUtil.ThrowOnNullArgument(serviceContext, "serviceContext");
     this.serviceContext = serviceContext;
 }
	public void CopyTo(DirectoryServer[] array, int index) {}
        static void Main()
        {
            try
            {
                string targetDomainName = "fabrikam.com";

                string targetServer  = "server1.fabrikam.com";
                string sourceServer  = "server2.fabrikam.com";
                string partitionName = "CN=Configuration,DC=fabrikam,DC=com";

                // get to the domain controller
                DomainController dc = DomainController.FindOne(
                    new DirectoryContext(
                        DirectoryContextType.Domain,
                        targetDomainName));

                // to use alternate credentials use the below code
                // DomainController dc = DomainController.FindOne(
                //                          new DirectoryContext(
                //                                          DirectoryContextType.Domain,
                //                                          targetDomainName,
                //                                          "alt-username",
                //                                          "alt-password"));
                //
                //


                // invoke kcc to check replication consistency
                dc.CheckReplicationConsistency();
                Console.WriteLine("\nCheck replication consistency succeed\n");

                // sync replica from a source server
                dc.SyncReplicaFromServer(partitionName, sourceServer);
                Console.WriteLine("\nSynchronize naming context \"{0}\" " +
                                  "with server {1} succeed",
                                  partitionName,
                                  sourceServer);

                // sync replica from all neighbors
                dc.TriggerSyncReplicaFromNeighbors(partitionName);
                Console.WriteLine("\nSynchronize naming context \"{0}\" " +
                                  "with all neighbors succeed", partitionName);

                // sync replica from all servers
                dc.SyncFromAllServersCallback = SyncFromAllServersCallbackRoutine;
                Console.WriteLine("\nStart sync with all servers:");
                dc.SyncReplicaFromAllServers(partitionName,
                                             SyncFromAllServersOptions.AbortIfServerUnavailable);

                Console.WriteLine("\nSynchronize naming context \"{0}\" " +
                                  "with all servers succeed", partitionName);

                // replication connection

                // create new replication connections
                DirectoryServer sourceDC = DomainController.GetDomainController(
                    new DirectoryContext(
                        DirectoryContextType.DirectoryServer,
                        sourceServer));

                // to use alternate credentials use the below code
                // DirectoryServer sourceDC = DomainController.GetDomainController(
                //                              new DirectoryContext(
                //                                 DirectoryContextType.DirectoryServer,
                //                                 sourceServer,
                //                                 "alt-username",
                //                                 "alt-password"));
                //



                ReplicationConnection connection =
                    new ReplicationConnection(
                        new DirectoryContext(
                            DirectoryContextType.DirectoryServer,
                            targetServer),
                        "myconnection",
                        sourceDC);

                // to use alternate credentials use the below code
                // ReplicationConnection connection =
                //                      new ReplicationConnection(
                //                              new DirectoryContext(
                //                                 DirectoryContextType.DirectoryServer,
                //                                 targetServer,
                //                                 "alt-username",
                //                                 "alt-password"),
                //                              "myconnection",
                //                              sourceDC);
                //


                // set change notification status
                connection.ChangeNotificationStatus = NotificationStatus.IntraSiteOnly;

                // create customized replication schedule
                ActiveDirectorySchedule schedule = new ActiveDirectorySchedule();
                schedule.SetDailySchedule(HourOfDay.Twelve,
                                          MinuteOfHour.Zero,
                                          HourOfDay.Fifteen,
                                          MinuteOfHour.Zero);

                schedule.SetSchedule(DayOfWeek.Sunday,
                                     HourOfDay.Eight,
                                     MinuteOfHour.Zero,
                                     HourOfDay.Eleven,
                                     MinuteOfHour.Zero);

                schedule.SetSchedule(DayOfWeek.Saturday,
                                     HourOfDay.Seven,
                                     MinuteOfHour.Zero,
                                     HourOfDay.Ten,
                                     MinuteOfHour.Zero);

                connection.ReplicationSchedule            = schedule;
                connection.ReplicationScheduleOwnedByUser = true;
                connection.Save();
                Console.WriteLine("\nNew replication connection is created successfully");

                connection = ReplicationConnection.FindByName(
                    new DirectoryContext(
                        DirectoryContextType.DirectoryServer,
                        targetServer),
                    "myconnection");

                // to use alternate credentials use the below code
                // connection = ReplicationConnection.FindByName(
                //                             new DirectoryContext(
                //                                 DirectoryContextType.DirectoryServer,
                //                                 targetServer,
                //                                 "alt-username",
                //                                 "alt-password"),
                //                             "myconnection");
                //

                Console.WriteLine("\nGet replication connection \"{0}\" information:",
                                  connection.Name);

                Console.WriteLine("ChangeNotificationStatus is {0}",
                                  connection.ChangeNotificationStatus);
                Console.WriteLine("ReplicationSpan is {0}", connection.ReplicationSpan);
                Console.WriteLine("ReplicationScheduleOwnedByUser is {0}",
                                  connection.ReplicationScheduleOwnedByUser);

                // delete the replication connection
                connection.Delete();
                Console.WriteLine("\nReplication connection is deleted\n");
            }
            catch (Exception e)
            {
                Console.WriteLine("\r\nUnexpected exception occured:\r\n\t" +
                                  e.GetType().Name + ":" + e.Message);
            }
        }
 // Methods
 public bool Contains(DirectoryServer directoryServer)
 {
 }
 // Constructors
 public ReplicationConnection(DirectoryContext context, string name, DirectoryServer sourceServer)
 {
 }
 public void CopyTo(DirectoryServer[] directoryServers, int index)
 {
 }
	public void Remove(DirectoryServer server) {}
 public int IndexOf(DirectoryServer directoryServer)
 {
 }