Пример #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
        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
 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;
 }