Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ds"> </param>
        private void populateFields(UserM user)
        {
            if (user.EmailAddress != null && user.EmailAddress != String.Empty)
            {
                txtEMailAddress.Text = user.EmailAddress;
            }

            if (user.FirstName != null && user.FirstName != String.Empty)
            {
                txtFirstName.Text = user.FirstName;
            }

            if (user.LastName != null && user.LastName != String.Empty)
            {
                txtLastName.Text = user.LastName;
            }

            if (user.MiddleName != null && user.MiddleName != String.Empty)
            {
                txtMiddleName.Text = user.MiddleName;
            }

            if (user.UniversityID != null && user.UniversityID != String.Empty)
            {
                txtUniversityIdentifier.Text = user.UniversityID;
            }

            if (user.UserName != null && user.UserName != "")
            {
                txtUserName.Text = user.UserName;
            }

            //Set current role
            RoleM role = user.GetRoleInCourse(courseId);

            for (int i = 0; i < UserRolesList.Items.Count; i++)
            {
                if (UserRolesList.Items[i].Value == role.ID.ToString())
                {
                    UserRolesList.SelectedIndex = i;
                    break;
                }
            }

            if (role.ID > 0)
            {
                RoleM currentUsersRole = RoleM.GetUsersRoleInCourse(SharedSupport.GetUserIdentity(), courseId);
                //Note: Can't change the role of someone = in level to you.
                if ((currentUsersRole.ID > (int)PermissionsID.Admin) && (currentUsersRole.ID >= role.ID))
                {
                    UserRolesList.Enabled = false;
                }
            }
        }