예제 #1
0
        public void RefreshProjectList()
        {
            bool success;

            // load project list
            ObservableCollection <ProjectContainer> projectList;

            if (GlobalVars.Instance.UserRole == GlobalVars.USER_ROLE_ENUM.ADMIN)
            {
                success     = m_wgDB.GetAllProjects(VM.IncludeArchivedProjects);
                projectList = m_wgDB.m_projectList;
            }
            else
            {
                success = m_wgDB.GetAllProjectsForUser(GlobalVars.Instance.UserID, out projectList);
            }

            if (success && projectList != null)
            {
                VM.ProjectList.Clear();
                VM.CurrentProject = null;

                foreach (ProjectContainer project in projectList)
                {
                    if (!project.Archived || (project.Archived && VM.IncludeArchivedProjects))
                    {
                        PlateExplorer_ViewModel.ProjectListItem pli = new PlateExplorer_ViewModel.ProjectListItem();
                        pli.Description = project.Description;
                        pli.ProjectID   = project.ProjectID;
                        VM.ProjectList.Add(pli);
                    }
                }
            }
        }
예제 #2
0
        public bool GetProjectList(int userID)
        {
#if (SIMULATE)
            m_vm.projects.Clear();

            ProjectContainer project = new ProjectContainer();
            project.Archived    = false;
            project.Description = "project 1";
            project.ProjectID   = 1;
            project.TimeStamp   = DateTime.Now;
            m_vm.projects.Add(project);

            project             = new ProjectContainer();
            project.Archived    = false;
            project.Description = "project 2";
            project.ProjectID   = 2;
            project.TimeStamp   = DateTime.Now;
            m_vm.projects.Add(project);

            return(true);
#else
            bool success = true;
            ObservableCollection <ProjectContainer> projects;
            if (m_db.GetAllProjectsForUser(userID, out projects))
            {
                m_vm.projects = projects;
            }
            else
            {
                success = false;
            }
            return(success);
#endif
        }
예제 #3
0
        public void RefreshProjectList()
        {
            ObservableCollection <ProjectContainer> projList;

            bool success = wgDB.GetAllProjectsForUser(GlobalVars.Instance.UserID, out projList);

            if (success)
            {
                VM.ProjectList = projList;
            }
        }
예제 #4
0
        public bool GetProjectList(int userID)
        {
            bool success = true;
            ObservableCollection <ProjectContainer> projects;

            if (m_db.GetAllProjectsForUser(userID, out projects))
            {
                m_vm.projects = projects;
            }
            else
            {
                success = false;
            }
            return(success);
        }
예제 #5
0
        public void Refresh()
        {
            Users.Clear();

            bool success = wgDB.GetAllUsers();

            if (success)
            {
                for (int i = 0; i < wgDB.m_userList.Count(); i++)
                {
                    UserSimple user = new UserSimple();
                    user.Firstname = wgDB.m_userList[i].Firstname;
                    user.Lastname  = wgDB.m_userList[i].Lastname;
                    user.Username  = wgDB.m_userList[i].Username;
                    user.Role      = wgDB.m_userList[i].Role;
                    user.UserID    = wgDB.m_userList[i].UserID;
                    user.Password  = wgDB.m_userList[i].Password;

                    Users.Add(user);


                    ObservableCollection <ProjectContainer> projects;
                    success = wgDB.GetAllProjectsForUser(user.UserID, out projects);

                    if (success)
                    {
                        for (int j = 0; j < projects.Count(); j++)
                        {
                            if (!projects[j].Archived)
                            {
                                ProjectFullname pfn = new ProjectFullname();
                                pfn.Fullname = projects[j].Description;
                                user.Projects.Add(pfn);
                            }
                        }
                    }
                }

                int count = Users.Count();
            }
        }