Esempio n. 1
0
        public void Select(RoutedPropertyChangedEventArgs <object> args)
        {
            if (args.NewValue is not MenuItem item)
            {
                return;
            }

            SelectModel = item.Screen;
            MainViewModel main = IoC.Get <MainViewModel>();

            main.ModuleList.IsShow   = SelectModel is ProjectViewModel;
            main.EntityList.IsShow   = SelectModel is ModuleViewModel;
            main.PropertyList.IsShow = SelectModel is EntityViewModel;
            switch (SelectModel)
            {
            case ProjectViewModel project:
                ModuleListViewModel list1 = IoC.Get <ModuleListViewModel>();
                list1.Project = project;
                list1.Init();
                break;

            case ModuleViewModel module:
                EntityListViewModel list2 = IoC.Get <EntityListViewModel>();
                list2.Module = module;
                list2.Init();
                break;

            case EntityViewModel entity:
                PropertyListViewModel list3 = IoC.Get <PropertyListViewModel>();
                list3.Entity = entity;
                list3.Init();
                break;
            }
        }
Esempio n. 2
0
        public ActionResult CheckModules()
        {
            var arguments = new ModuleFilterSorterArguments
            {
                LeerjaarFilter = _unitOfWork.GetRepository <Schooljaar>().GetAll().Max(src => src.JaarId)
            };
            var maxSchooljaar = _unitOfWork.GetRepository <Schooljaar>().GetAll().Max(src => src.JaarId);
            var queryPack     = new ModuleQueryablePack(arguments, _unitOfWork.GetRepository <Module>().GetAll().AsQueryable().Where(src => src.Schooljaar.Equals(maxSchooljaar)));
            var modules       = _filterSorterService.ProcessData(queryPack).ToList();
            var moduleList    = new ModuleListViewModel(modules.Count());

            moduleList.AddModules(modules);

            var users    = _userRepository.GetAll().AsQueryable();
            var userList = new UserListViewModel(users.Count());

            userList.AddUsers(users);

            var checkModulesVm = new CheckModulesViewModel
            {
                ModuleViewModels = moduleList,
                Users            = userList
            };

            return(View(checkModulesVm));
        }
Esempio n. 3
0
        public ActionResult Index(ModuleSearchInputDto input)
        {
            var output = _moduleAppService.SearchModules(input);

            var model = new ModuleListViewModel(output.Modules)
            {
                SelectedModuleState = input.State,
                SelectedUserId      = input.MemberId,
                SelectedProjectId   = input.ProjectId
            };

            var userList     = _userAppService.GetUsers().Result;
            var userFullList = new List <User> {
                new User {
                    Id = -1, UserName = "******"
                }
            }.Concat <User>(userList.Items);

            ViewBag.SelectedUserId = new SelectList(userFullList, "Id", "UserName", model.SelectedUserId);

            var projectList     = _projectAppService.SearchProjects(new Projects.Dto.ProjectSearchInputDto {
            });
            var projectFullList = new List <ProjectDto> {
                new ProjectDto {
                    Id = -1, Name = "All"
                }
            }.Concat <ProjectDto>(projectList.Projects);

            ViewBag.SelectedProjectId = new SelectList(projectFullList, "Id", "Name", model.SelectedProjectId);

            return(View(model));
        }
Esempio n. 4
0
        public void Initialize(IShellRegion region)
        {
            this._moduleList = IoC.GetInstance(typeof(ModuleListViewModel), null).As <ModuleListViewModel>();
            this._moduleList.CurrentModuleChangedCallback = OnCurrentModuleChanged;
            this._content   = IoC.GetInstance(typeof(ContentViewModel), null).As <ContentViewModel>();;
            this._navHeader = IoC.GetInstance(typeof(NavigationHeaderViewModel), null).As <NavigationHeaderViewModel>();

            this._region = region;
        }
Esempio n. 5
0
        /// <summary>Called just after the root View has been displayed</summary>
        protected override void OnLaunch()
        {
            ProjectListViewModel projectList = IoC.Get <ProjectListViewModel>();
            ModuleListViewModel  moduleList  = IoC.Get <ModuleListViewModel>();

            if (moduleList.Project == null && !projectList.IsShow)
            {
                projectList.Show();
            }
        }
        private string[] GetEntities()
        {
            ProjectViewModel    project    = IoC.Get <MenuViewModel>().Project;
            ModuleListViewModel moduleList = IoC.Get <ModuleListViewModel>();
            List <string>       list       = new List <string>()
            {
                "OSharp.Core.EntityInfos.EntityInfo",
                "OSharp.Core.Functions.Function",
                "OSharp.Core.Systems.KeyValue"
            };

            list.AddRange(new[]
            {
                "Identity.Entities.LoginLog",
                "Identity.Entities.Organization",
                "Identity.Entities.Role",
                "Identity.Entities.RoleClaim",
                "Identity.Entities.User",
                "Identity.Entities.UserClaim",
                "Identity.Entities.UserDetail",
                "Identity.Entities.UserLogin",
                "Identity.Entities.UserRole",
                "Identity.Entities.UserToken",
                "Security.Entities.EntityRole",
                "Security.Entities.EntityUser",
                "Security.Entities.Module",
                "Security.Entities.ModuleFunction",
                "Security.Entities.ModuleRole",
                "Security.Entities.ModuleUser",
                "Systems.Entities.AuditEntity",
                "Systems.Entities.AuditOperation",
                "Systems.Entities.AuditProperty"
            }.Select(m => $"{project.NamespacePrefix}.{m}"));
            if (moduleList != null)
            {
                if (_project == null)
                {
                    IServiceProvider rootProvider = IoC.Get <IServiceProvider>();
                    MenuViewModel    menu         = rootProvider.GetRequiredService <MenuViewModel>();
                    rootProvider.ExecuteScopedWork(provider =>
                    {
                        IDataContract contract = provider.GetRequiredService <IDataContract>();
                        _project = contract.GetCodeProject(m => m.Name == menu.Project.Name).First();
                    });
                }
                list.AddRange(_project.Modules.SelectMany(m => m.Entities.Select(n => $"{project.NamespacePrefix}.{m.Name}.Entities.{n.Name}"))
                              .OrderBy(m => m));
            }

            return(list.Distinct().ToArray());
        }
Esempio n. 7
0
        //************************* GetActListAjax ******************************************
        public async Task <IActionResult> GetActListAjax(int?Id)
        {
            if (Id == null)
            {
                return(BadRequest());
            }

            if (Request.IsAjax())
            {
                // Jag har modul Id (Id)
                // Ta reda på vilket kurs Id modulen har
                // Lista all moduler som har samma kurs id

                var module = await db.Modules
                             .FirstOrDefaultAsync(m => m.Id == Id);

                var courseId = module.CourseId;

                var modules = await db.Modules
                              .Where(ms => ms.CourseId == courseId)
                              .OrderBy(m => m.StartTime)
                              .ToListAsync();

                List <ModuleListViewModel> moduleList = new List <ModuleListViewModel>();

                foreach (var mod in modules)
                {
                    var modLVM = new ModuleListViewModel();
                    modLVM.Id              = mod.Id;
                    modLVM.Name            = mod.Name;
                    modLVM.StartTime       = mod.StartTime;
                    modLVM.EndTime         = mod.EndTime;
                    modLVM.IsCurrentModule = false;

                    moduleList.Add(modLVM);
                }

                SetCurrentModule(moduleList, (int)Id);

                StudentViewModel studVM = new StudentViewModel();

                studVM.ModuleList   = moduleList;
                studVM.ActivityList = GetModuleActivityListAsync((int)Id).Result;

                return(PartialView("StudentModuleAndActivityPartial", studVM));
            }

            return(BadRequest());
        }
Esempio n. 8
0
        public ModulesList(ProcessModuleCollection collection)
        {
            InitializeComponent();

            DataContext = new ModuleListViewModel(collection);
        }
Esempio n. 9
0
 public ModuleListView()
 {
     InitializeComponent();
     DataContext = new ModuleListViewModel();
 }
Esempio n. 10
0
 public ModuleListPage()
 {
     DataContext = new ModuleListViewModel();
     InitializeComponent();
 }
Esempio n. 11
0
 public ModuleListWindow()
 {
     InitializeComponent();
     DataContext = new ModuleListViewModel(StationManager.DataStorage.SelectedProcess);
 }
        public void ModulesToListViewModelTest()
        {
            // Arrange
            var modules             = _moduleRepository.GetAll();
            var moduleListViewModel = new ModuleListViewModel(modules.Count());

            moduleListViewModel.AddModules(modules);

            // Act
            #region Expected ModuleListViewModel : checkModuleListViewModel

            var checkModuleListViewModel = new ModuleListViewModel(3)
            {
                data = new List <ModuleViewModel>
                {
                    #region expected first ModuleViewModel
                    new ModuleViewModel
                    {
                        Blokken           = "3",
                        CursusCode        = "INMODL312345",
                        Docenten          = "Jan Stekker, Dozijn Ei",
                        FaseNamen         = "Software Ontwikkeling, Business Intelligence",
                        Naam              = "Modelleren 3",
                        Status            = "Compleet(ongecontroleerd)",
                        Verantwoordelijke = "Fahiem Karsodimedjo",
                        TotalEc           = 5
                    },
                    #endregion
                    #region expected second ModuleViewModel
                    new ModuleViewModel
                    {
                        Blokken           = "3, 4",
                        CursusCode        = "IN_ALG612345",
                        Docenten          = "Hans Boos, Zwan Beer, Poco de Man",
                        FaseNamen         = "Software Architecture, Software Testin",
                        Naam              = "Algoritmiek 3000S",
                        Status            = "Compleet(gecontroleerd)",
                        Verantwoordelijke = "Fahiem Karsodimedjo",
                        TotalEc           = 3
                    },
                    #endregion
                    #region expected third ModuleViewModel
                    new ModuleViewModel
                    {
                        Blokken           = "3, 4",
                        CursusCode        = "IN_PROG4123456",
                        Docenten          = "Jan Stekker, Meer Man, Poco de Man",
                        FaseNamen         = "Software Architecture, Business Intelligence, TestFase",
                        Naam              = "Programmeren 7",
                        Status            = "Incompleet",
                        Verantwoordelijke = "Fahiem Karsodimedjo",
                        TotalEc           = 24
                    }
                    #endregion
                }
            };

            #endregion

            // Assert <expected, actual>
            Assert.AreEqual(checkModuleListViewModel.recordsFiltered, moduleListViewModel.recordsFiltered);
            Assert.AreEqual(checkModuleListViewModel.recordsTotal, moduleListViewModel.recordsTotal);
            Assert.AreEqual(checkModuleListViewModel.data.Count, moduleListViewModel.data.Count);
            Assert.AreEqual(checkModuleListViewModel.data.ElementAt(0).Status, moduleListViewModel.data.ElementAt(0).Status);
            Assert.AreEqual(checkModuleListViewModel.data.ElementAt(1).Status, moduleListViewModel.data.ElementAt(1).Status);
            Assert.AreEqual(checkModuleListViewModel.data.ElementAt(2).Status, moduleListViewModel.data.ElementAt(2).Status);
            Assert.AreEqual(checkModuleListViewModel.data.ElementAt(2).TotalEc, moduleListViewModel.data.ElementAt(2).TotalEc);
            Assert.AreEqual(checkModuleListViewModel.data.ElementAt(1).Blokken, moduleListViewModel.data.ElementAt(1).Blokken);

            Assert.AreEqual(checkModuleListViewModel.data.ElementAt(2).TotalEc, 24);
        }
Esempio n. 13
0
        public ModuleListViewModel GetOverview([FromBody] ArgumentsViewModel value)
        {
            var modules = _unitOfWork.GetRepository <Module>().GetAll();

            ICollection <string> competentieFilters = null;

            if (value.Filter.Competenties.First() != null)
            {
                competentieFilters = value.Filter.Competenties;
            }

            ICollection <string> tagFilters = null;

            if (value.Filter.Tags.First() != null)
            {
                tagFilters = value.Filter.Tags;
            }

            ICollection <string> leerlijnFilters = null;

            if (value.Filter.Leerlijnen.First() != null)
            {
                leerlijnFilters = value.Filter.Leerlijnen;
            }

            ICollection <string> faseFilters = null;

            if (value.Filter.Fases.First() != null)
            {
                faseFilters = value.Filter.Fases;
            }

            ICollection <string> blokFilters = null;

            if (value.Filter.Blokken.First() != null)
            {
                blokFilters = value.Filter.Blokken.ToArray();
            }

            string zoektermFilter = null;

            if (value.Filter.Zoekterm != null)
            {
                zoektermFilter = value.Filter.Zoekterm;
            }

            string leerjaarFilter = null;

            if (value.Filter.Leerjaar != null)
            {
                leerjaarFilter = value.Filter.Leerjaar;
            }

            int    column = value.OrderBy.Column;
            string columnName;

            switch (column)
            {
            case 1:
                columnName = "Naam";
                break;

            case 2:
                columnName = "CursusCode";
                break;

            case 3:
                columnName = "Schooljaar";
                break;

            case 7:
                columnName = "Verantwoordelijke";
                break;

            default:
                columnName = "Naam";
                break;
            }

            bool dir;

            if (value.OrderBy.Dir == "desc")
            {
                dir = true;
            }
            else
            {
                dir = false;
            }

            var arguments = new ModuleFilterSorterArguments
            {
                CompetentieFilters = competentieFilters,
                TagFilters         = tagFilters,
                LeerlijnFilters    = leerlijnFilters,
                FaseFilters        = faseFilters,
                BlokFilters        = blokFilters,
                ZoektermFilter     = zoektermFilter,
                LeerjaarFilter     = leerjaarFilter,
                SortBy             = columnName,
                SortDesc           = dir
            };

            var queryPack = new ModuleQueryablePack(arguments, modules.AsQueryable());

            modules = _filterSorterService.ProcessData(queryPack);

            var enumerable = modules as Module[] ?? modules.ToArray();
            var modArray   = enumerable.ToArray().Where(m => m.Status.Equals("Compleet (gecontroleerd)"));

            if (User.Identity.IsAuthenticated)
            {
                modArray = enumerable.ToArray();
            }
            var moduleList   = modArray as Module[] ?? modArray.ToArray();
            var moduleListVm = new ModuleListViewModel(moduleList.Count());

            moduleListVm.AddModules(moduleList);

            return(moduleListVm);
        }