コード例 #1
0
 private void FillUsers(DataStructure.Users userInfo, UserTypes includeUserTypes)
 {
     for (int ii = 0; ii <= mockUsers.GetUpperBound(0); ii++)
     {
         if (((includeUserTypes & UserTypes.Students) == UserTypes.Students &&
              !string.IsNullOrEmpty(mockUsers[ii, (int)MockUserFieldIndexes.StudentId])) ||
             ((includeUserTypes & UserTypes.Instructors) == UserTypes.Instructors &&
              !string.IsNullOrEmpty(mockUsers[ii, (int)MockUserFieldIndexes.InstructorId])))
         {
             FillUser(userInfo, ii + 1);
         }
     }
 }
コード例 #2
0
        //userId is equal to index + 1 since there won't be any user ID "0" in the real system
        private void FillUser(DataStructure.Users userInfo, int userId)
        {
            DataStructure.Users.UsersRow newRow = userInfo._Users.NewUsersRow();
            int userIndex = userId - 1;

            newRow.ta_user_id      = userId;
            newRow.last_name       = mockUsers[userIndex, (int)MockUserFieldIndexes.LastName];
            newRow.first_name      = mockUsers[userIndex, (int)MockUserFieldIndexes.FirstName];
            newRow.middle_name     = mockUsers[userIndex, (int)MockUserFieldIndexes.MiddleName];
            newRow.nickname        = mockUsers[userIndex, (int)MockUserFieldIndexes.Nickname];
            newRow.network_user_id = mockUsers[userIndex, (int)MockUserFieldIndexes.NetworkId];
            userInfo._Users.AddUsersRow(newRow);
            //Add Student Row if appropriate
            if (!string.IsNullOrEmpty(mockUsers[userIndex, (int)MockUserFieldIndexes.StudentId]))
            {
                userInfo.Students.AddStudentsRow(newRow, mockUsers[userIndex, (int)MockUserFieldIndexes.StudentId]);
            }
            if (!string.IsNullOrEmpty(mockUsers[userIndex, (int)MockUserFieldIndexes.InstructorId]))
            {
                userInfo.Instructors.AddInstructorsRow(newRow, mockUsers[userIndex, (int)MockUserFieldIndexes.InstructorId]);
            }
        }
コード例 #3
0
 public DataStructure.Users GetUsers()
 {
     DataStructure.Users result = new DataStructure.Users();
     FillUsers(result, UserTypes.AllUserTypes);
     return(result);
 }
コード例 #4
0
 public DataStructure.Users GetUser(int userId)
 {
     DataStructure.Users result = new DataStructure.Users();
     FillUser(result, userId);
     return(result);
 }
コード例 #5
0
 protected User()
 {
     _userDataSet = new DataStructure.Users();
     _userData    = _userDataSet._Users.AddUsersRow("", "", "", "", "");
 }