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)); } }
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)); } }
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 }; }
public FirstSetupSaveCommand(FirstSetupViewModel viewModel, IFirstSetupRepo firstSetupRepo) { this.viewModel = viewModel; this.firstSetupRepo = firstSetupRepo; }
public InnitialDataSeeder(FirstSetupViewModel vm) { this.firstSetupRepo = new FirstSetupRepo(); this.viewModel = vm; }