Пример #1
0
        public void AddUser()
        {
            User newUser = new User();

            newUser.Logon = "New User";
            //
            FormUserProperties addUserForm = new FormUserProperties(newUser);

            if (addUserForm.ShowDialog() == DialogResult.OK)
            {
                // add the new user to the DataSet
                usersDataSet.Tables[0].Rows.Add(new object[]
                                                { newUser
                                                  , newUser.FirstName
                                                  , newUser.LastName
                                                  , newUser.AccessLevel
                                                  , newUser.Logon });
                RefreshView();
            }
        }
Пример #2
0
        /// <summary>
        /// Called to allow the selected user to be edited
        /// </summary>
        public void EditUser()
        {
            // Ensure we have one and one only row selected
            if (this.ultraGridUsers.Selected.Rows.Count != 1)
            {
                return;
            }
            UltraGridRow selectedRow = this.ultraGridUsers.Selected.Rows[0];

            if (selectedRow.Cells[0].Value == null)
            {
                return;
            }
            //
            User thisUser           = (User)selectedRow.Cells[0].Value;                         // Column 0 is the User Object
            FormUserProperties form = new FormUserProperties(thisUser);

            if (form.ShowDialog() == DialogResult.OK)
            {
                RefreshView();
            }
        }