private void Seed()
        {
            using var context = new DataContext(ContextOptions);
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            var addresses = FactoryService.CreateBatchOfAddresses();

            context.Addresses.AddRange(addresses);

            var customers = FactoryService.CreateBatchOfCustomers();

            context.Customers.AddRange(customers);

            var invoice = FactoryService.CreateInvoice();

            context.Invoices.AddRange(invoice);

            var newInstalls = new NewInstall()
            {
                Id       = 1,
                Customer = customers.FirstOrDefault(),
                Door     = new RollerShutterDoor()
            };

            context.NewInstalls.AddRange(newInstalls);

            context.SaveChanges();
        }
Exemple #2
0
        private InstallHeader CreateInstall(ApplicationManagementClient proxy, Application app)
        {
            using (var fileStream = new FileStream(InstallFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                var install = new NewInstall
                {
                    ApplicationId               = app.ApplicationId,
                    CreatedByUserName           = Environment.UserName,
                    Version                     = Version,
                    InstallFileName             = Path.GetFileName(InstallFilePath),
                    InstallCommandLine          = InstallCommandLine,
                    ShouldRemovePreviousVersion = ShouldRemovePreviousVersion
                };
                var i = proxy.CreateInstall(install, fileStream);

                LogMessage(MessageImportance.Low, String.Format("Created new install id = {0}", i.InstallId));

                return(i);
            }
        }
Exemple #3
0
        private string CreateSerialNumber(NewInstall newInstall)
        {
            int jobNumber = _context.NewInstalls.Where(n => n.Customer.Id == newInstall.Customer.Id).Count();

            return($"{newInstall.Customer.Name.ToUpper().Substring(0, 4)}-{DateTime.Now:yyyy-MM}-{++jobNumber:0000}");
        }
        private InstallHeader CreateInstall(ApplicationManagementClient proxy, Application app)
        {
            using (var fileStream = new FileStream(InstallFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                var install = new NewInstall
                                  {
                                      ApplicationId = app.ApplicationId,
                                      CreatedByUserName = Environment.UserName,
                                      Version = Version,
                                      InstallFileName = Path.GetFileName(InstallFilePath),
                                      InstallCommandLine = InstallCommandLine,
                                      ShouldRemovePreviousVersion = ShouldRemovePreviousVersion
                                  };
                var i = proxy.CreateInstall(install, fileStream);

                LogMessage(MessageImportance.Low, String.Format("Created new install id = {0}", i.InstallId));

                return i;
            }
        }