Exemple #1
0
        /// <summary>
        /// fill a user object from the form
        /// </summary>
        /// <param name="user"></param>
        public void FillUser(User user)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            user.Username = UsernameTextBox.Text;
            user.Address = AddressTextBox.Text;
            user.City = CityTextBox.Text;
            user.Email = EmailTextBox.Text;
            user.FirstName = FirstNameTextBox.Text;
            user.LastName = LastNameTextBox.Text;
            user.PhoneNumber = PhoneTextBox.Text;
            user.State = StateTextBox.Text;
            user.ZipCode = ZipTextBox.Text;

            if (NewPassword1TextBox.Text.Length > 0)
            {
                user.Password = NewPassword1TextBox.Text;
            }
        }
Exemple #2
0
        /// <summary>
        /// Fills the form with a user's information
        /// </summary>
        /// <param name="user">A PMT user</param>
        public void FillForm(User user)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            FirstNameTextBox.Text = user.FirstName;
            FirstNameLabel.Text = user.FirstName;
            LastNameTextBox.Text = user.LastName;
            LastNameLabel.Text = user.LastName;
            AddressTextBox.Text = user.Address;
            AddressLabel.Text = user.Address;
            CityTextBox.Text = user.City;
            CityLabel.Text = user.City;
            StateTextBox.Text = user.State;
            StateLabel.Text = user.State;
            ZipTextBox.Text = user.ZipCode;
            ZipLabel.Text = user.ZipCode;
            PhoneTextBox.Text = user.PhoneNumber;
            PhoneLabel.Text = user.PhoneNumber;
            EmailTextBox.Text = user.Email;
            EmailLabel.Text = user.Email;
            UsernameTextBox.Text = user.Username;
            UsernameLabel.Text = user.Username;

            // select the correct Security in the dropdown
            SecurityDropDownList.SelectedValue = user.Role.ToString("d");
            SecurityLabel.Text = user.Role.ToString();
        }