コード例 #1
0
        public FirstSetupViewModel(IFirstSetupRepo firstSetupRepo)
        {
            try
            {
                this.firstSetupRepo = firstSetupRepo;
                saveCommand = ViewModelSource.Create(() => new FirstSetupSaveCommand(this, firstSetupRepo));

                var defaultStation = (WorkstationType)Enum.Parse(typeof(WorkstationType), ConfigurationManager.AppSettings["WorkstationType"]);

                var defaultProjName = ConfigurationManager.AppSettings["ProjectName"];

                if(defaultStation == WorkstationType.Undefined)
                {
                    defaultStation = WorkstationType.Mill;
                }
                project.WorkstationType = defaultStation;
                project.Title = defaultProjName;
                project.DocumentSizeLimit = 1024;

                foreach(Permission permission in firstSetupRepo.PermissionRepo.GetAll())
                {
                    SuperUser.Permissions.Add(permission);
                }
                admin.Roles = new List<Role>() { SuperUser };
            }
            catch(RepositoryException ex)
            {
                log.Warn(this.GetType().Name + " | " + ex.ToString());
                notify.ShowWarning(Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Message),
            Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Header));
            }
        }
コード例 #2
0
        public FirstSetupViewModel(IFirstSetupRepo firstSetupRepo)
        {
            try
            {
                this.firstSetupRepo = firstSetupRepo;
                saveCommand         = ViewModelSource.Create(() => new FirstSetupSaveCommand(this, firstSetupRepo));

                var defaultStation = (WorkstationType)Enum.Parse(typeof(WorkstationType), ConfigurationManager.AppSettings["WorkstationType"]);

                var defaultProjName = ConfigurationManager.AppSettings["ProjectName"];

                if (defaultStation == WorkstationType.Undefined)
                {
                    defaultStation = WorkstationType.Mill;
                }
                project.WorkstationType   = defaultStation;
                project.Title             = defaultProjName;
                project.DocumentSizeLimit = 1024;

                foreach (Permission permission in firstSetupRepo.PermissionRepo.GetAll())
                {
                    SuperUser.Permissions.Add(permission);
                }
                admin.Roles = new List <Role>()
                {
                    SuperUser
                };
            }
            catch (RepositoryException ex)
            {
                log.Warn(this.GetType().Name + " | " + ex.ToString());
                notify.ShowWarning(Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Message),
                                   Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Header));
            }
        }
コード例 #3
0
ファイル: FirstSetupViewModel.cs プロジェクト: horba/prizm
        public FirstSetupViewModel(IFirstSetupRepo firstSetupRepo)
        {
            this.firstSetupRepo = firstSetupRepo;
            saveCommand         = ViewModelSource.Create(() => new FirstSetupSaveCommand(this, firstSetupRepo));

            var defaultStation = (WorkstationType)Enum.Parse(typeof(WorkstationType), ConfigurationManager.AppSettings["WorkstationType"]);

            var defaultProjName = ConfigurationManager.AppSettings["ProjectName"];

            if (defaultStation == WorkstationType.Undefined)
            {
                defaultStation = WorkstationType.Mill;
            }
            project.WorkstationType   = defaultStation;
            project.Title             = defaultProjName;
            project.DocumentSizeLimit = 1024;

            foreach (Permission permission in firstSetupRepo.PermissionRepo.GetAll())
            {
                SuperUser.Permissions.Add(permission);
            }
            admin.Roles = new List <Role>()
            {
                SuperUser
            };
        }
コード例 #4
0
 public FirstSetupSaveCommand(FirstSetupViewModel viewModel, IFirstSetupRepo firstSetupRepo)
 {
     this.viewModel      = viewModel;
     this.firstSetupRepo = firstSetupRepo;
 }
コード例 #5
0
ファイル: InnitialDataSeeder.cs プロジェクト: horba/prizm
 public InnitialDataSeeder(FirstSetupViewModel vm)
 {
     this.firstSetupRepo = new FirstSetupRepo();
     this.viewModel      = vm;
 }
コード例 #6
0
 public InnitialDataSeeder(FirstSetupViewModel vm)
 {
     this.firstSetupRepo = new FirstSetupRepo();
     this.viewModel = vm;
 }
コード例 #7
0
 public FirstSetupSaveCommand(FirstSetupViewModel viewModel, IFirstSetupRepo firstSetupRepo)
 {
     this.viewModel = viewModel;
     this.firstSetupRepo = firstSetupRepo;
 }