Пример #1
0
        public void Execute()
        {
            try
            {
                viewModel.Admin.Name         = viewModel.Name;
                viewModel.Admin.PasswordHash = PasswordEncryptor.EncryptPassword(viewModel.Password);
                viewModel.Admin.IsActive     = true;
                viewModel.Project.IsActive   = true;
                if (viewModel.Project.WorkstationType != Domain.Entity.Setup.WorkstationType.Mill)
                {
                    viewModel.MillPipeNumberMask = string.Empty;
                }

                firstSetupRepo.BeginTransaction();
                firstSetupRepo.RoleRepo.Save(viewModel.SuperUser);
                firstSetupRepo.UserRepo.Save(viewModel.Admin);
                firstSetupRepo.ProjectRepo.Save(viewModel.Project);
                firstSetupRepo.Commit();
                firstSetupRepo.RoleRepo.Evict(viewModel.SuperUser);
                firstSetupRepo.UserRepo.Evict(viewModel.Admin);
                firstSetupRepo.ProjectRepo.Evict(viewModel.Project);
                viewModel.IsSaved = true;

                var seeder = new InnitialDataSeeder(viewModel);
                seeder.Seed(Program.IsSeed);
            }
            catch (RepositoryException ex)
            {
                log.Error(ex.Message);
            }
        }
Пример #2
0
        public void Execute()
        {
            try
            {
                viewModel.Admin.Name = viewModel.Name;
                viewModel.Admin.PasswordHash = PasswordEncryptor.EncryptPassword(viewModel.Password);
                viewModel.Admin.IsActive = true;
                viewModel.Project.IsActive = true;
                if (viewModel.Project.WorkstationType != Domain.Entity.Setup.WorkstationType.Mill)
                {
                    viewModel.MillPipeNumberMask = string.Empty;
                }

                firstSetupRepo.BeginTransaction();
                firstSetupRepo.RoleRepo.Save(viewModel.SuperUser);
                firstSetupRepo.UserRepo.Save(viewModel.Admin);
                firstSetupRepo.ProjectRepo.Save(viewModel.Project);
                firstSetupRepo.Commit();
                firstSetupRepo.RoleRepo.Evict(viewModel.SuperUser);
                firstSetupRepo.UserRepo.Evict(viewModel.Admin);
                firstSetupRepo.ProjectRepo.Evict(viewModel.Project);
                viewModel.IsSaved = true;

                var seeder = new InnitialDataSeeder(viewModel);
                seeder.Seed(Program.IsSeed);
            }
            catch (RepositoryException ex)
            {
                log.Error(ex.Message);
            }

        }