Пример #1
0
        private void ModifyProfile_Click(object sender, EventArgs e)
        {
            ModifyProfile modifyProfile = new ModifyProfile(user_id);
            var           result        = modifyProfile.ShowDialog();

            if (result == DialogResult.OK)
            {
                UsersClass modified       = modifyProfile.modify;
                bool       returnedResult = UsersDB_Class.ChangeUsers(modified);
                if (returnedResult)
                {
                    FillListView();
                    MessageBox.Show("User changed");
                }
                else
                {
                    MessageBox.Show("Error");
                }
            }
        }
Пример #2
0
        private void btnChangeUsers_Click(object sender, EventArgs e)
        {
            UsersClass userChange = new UsersClass();

            if (listView1.SelectedItems.Count > 0)
            {
                ListViewItem item = listView1.SelectedItems[0];
                userChange.firstNameUsers = item.SubItems[0].Text;
                userChange.lastNameUsers  = item.SubItems[1].Text;
                userChange.phoneUsers     = item.SubItems[2].Text;
                userChange.emailUsers     = item.SubItems[3].Text;
                userChange.createdUsers   = Convert.ToDateTime(item.SubItems[5].Text);
                userChange.updatedUsers   = Convert.ToDateTime(item.SubItems[6].Text);
                userChange.roleUsers      = item.SubItems[7].Text;
                userChange.passwordUsers  = item.SubItems[8].Text;
                userChange.userID         = Convert.ToInt32(item.SubItems[9].Text);

                Change_users updateUser = new Change_users(userChange);
                var          result     = updateUser.ShowDialog();
                if (result == DialogResult.OK)
                {
                    UsersClass changedUser    = updateUser.changes;
                    bool       returnedResult = UsersDB_Class.ChangeUsers(userChange);
                    if (returnedResult)
                    {
                        FillListView();
                        MessageBox.Show("User changed");
                    }
                    else
                    {
                        MessageBox.Show("Error");
                    }
                }
            }
            else
            {
                MessageBox.Show("Please select an user in a list ");
            }
        }