Ejemplo n.º 1
0
 public StudentsPageVM(string dbcontextName, Student selectedStudent, ISystemUser loggedInLectuer) : base(dbcontextName)
 {
     try
     {
         studentRowsToReturn = 50;
         IsConfirmed         = false;
         SubgridContext      = SubgridContext.Groups;
         //commands
         RemoveEntityCmd         = new RemoveEntityCmd(this);
         NewModeCmd              = new NewModeCmd(this);
         SaveFormCmd             = new SaveCmd(this);
         NewPassHashCmd          = new NewPassHashCmd(this);
         MoveEntityOutOfListCmd  = new MoveEntityOutOfListCmd(this);
         MoveEntityInToListCmd   = new MoveEntityInToListCmd(this);
         ChangeSubgridContextCmd = new ChangeSubgridContextCmd(this);
         DeleteCmd        = new DeleteCmd(this);
         CancelCmd        = new CancelCmd(this);
         GoToEntityCmd    = new GoToEntityCmd(this);
         AnalyseEntityCmd = new AnalyseEntityCmd(this);
         CSVCmd           = new CSVCmd(this);
         //TODO: will likely need to attach lecturer to the DbContext..
         Lecturer         = (Lecturer)loggedInLectuer;
         SearchStudentTxt = "";
         if (selectedStudent.Id == 0)
         {
             SelectedStudent = new Student();
         }
         else
         {
             SelectedStudent = UnitOfWork.StudentRepo.Get(selectedStudent.Id);
         }
         //TODO: figure out Async with EF and Pagination/ limit the results (limit probably best)
         RefreshAvailableGroups(SelectedStudent);
         List <Student> results = UnitOfWork.StudentRepo.GetAll().ToList();
         Students = new ObservableCollection <Student>(results);
     }
     catch (Exception ex)
     {
         ShowFeedback(ex.Message, FeedbackType.Error);
     }
 }
Ejemplo n.º 2
0
 public BaseMyGroupsPageVM(string dbcontextName) : base(dbcontextName)
 {
     //Commands
     SaveFormCmd             = new SaveCmd(this);
     NewModeCmd              = new NewModeCmd(this);
     ChangeSubgridContextCmd = new ChangeSubgridContextCmd(this);
     DeleteCmd              = new DeleteCmd(this);
     RemoveEntityCmd        = new RemoveEntityCmd(this);
     MoveEntityOutOfListCmd = new MoveEntityOutOfListCmd(this);
     MoveEntityInToListCmd  = new MoveEntityInToListCmd(this);
     GoToEntityCmd          = new GoToEntityCmd(this);
     AnalyseEntityCmd       = new AnalyseEntityCmd(this);
     CancelCmd              = new CancelCmd(this);
     try
     {
         Mediator.Register(MediatorChannels.PoolingUpdate.ToString(), PoolingUpdate);
     }
     catch (Exception ex)
     {
         ShowFeedback(ex.Message, FeedbackType.Error);
     }
 }
Ejemplo n.º 3
0
 public BaseMySessionsPageVM(string dbcontextName) : base(dbcontextName)
 {
     //register commands
     NewModeCmd              = new NewModeCmd(this);
     SaveFormCmd             = new SaveCmd(this);
     AddLecturerCmd          = new AddLecturerCmd(this);
     RemoveEntityCmd         = new RemoveEntityCmd(this);
     DeleteCmd               = new DeleteCmd(this);
     ChangeSubgridContextCmd = new ChangeSubgridContextCmd(this);
     GoToEntityCmd           = new GoToEntityCmd(this);
     AnalyseEntityCmd        = new AnalyseEntityCmd(this);
     CancelCmd               = new CancelCmd(this);
     //initial setup
     try
     {
         Mediator.Register(MediatorChannels.PoolingUpdate.ToString(), PoolingUpdate);
     }
     catch (Exception ex)
     {
         ShowFeedback(ex.Message, FeedbackType.Error);
     }
 }
Ejemplo n.º 4
0
        public DataAnalysisVM(BaseEntity entityToFocusOn, string dbcontextName) : base(dbcontextName)
        {
            //commands
            GoToEntityCmd = new GoToEntityCmd(this);
            RemoveCmd     = new RemoveCmd(this);
            AddCmd        = new AddCmd(this);

            //initialize
            UpdateHeader();
            try
            {
                User     = (Lecturer)App.AppUser;
                UserRole = Role.Lecturer;
                rowLimit = 30;
                Groups   = new ObservableCollection <Group>(UnitOfWork.GroupRepository.GetTopXFromSearch(GroupSearchTxt, rowLimit));
                if (entityToFocusOn is Group)
                {
                    SelectedGroup = UnitOfWork.GroupRepository.Get(entityToFocusOn.Id);
                }
                else if (entityToFocusOn is Session)
                {
                    Session session = (Session)entityToFocusOn;
                    SelectedGroup = UnitOfWork.GroupRepository.Get(session.Group.Id);
                    if (SelectedGroup != null)
                    {
                        SelectedSession = UnitOfWork.SessionRepository.Get(entityToFocusOn.Id);
                    }
                }
                //Register for pooling update signals
                Mediator.Register(MediatorChannels.PoolingUpdate.ToString(), PoolingUpdate);
            }
            catch (Exception ex)
            {
                ShowFeedback(ex.Message, FeedbackType.Error);
            }
        }