private void lstUsers_SelectedIndexChanged(object sender, EventArgs e) { var selectedUser = (user)lstUsers.SelectedItem; wtrUserName.Text = selectedUser.username; wtrPassword.Text = selectedUser.password; Program.UserAccessOptions uac = (Program.UserAccessOptions)selectedUser.accessflags; chkEditRecords.Checked = ((uac & Program.UserAccessOptions.Edit) == Program.UserAccessOptions.Edit); chkView.Checked = ((uac & Program.UserAccessOptions.View) == Program.UserAccessOptions.View); chkAdmin.Checked = ((uac & Program.UserAccessOptions.UserControl) == Program.UserAccessOptions.UserControl); }
private user CollectSettings() { user u = (user)lstUsers.SelectedItem; u.username = wtrUserName.Text; u.email = wtrPassword.Text; Program.UserAccessOptions uao = new Program.UserAccessOptions(); if (chkAdmin.Checked) { uao |= Program.UserAccessOptions.UserControl; } if (chkEditRecords.Checked) { uao |= Program.UserAccessOptions.Edit; } if (chkView.Checked) { uao |= Program.UserAccessOptions.View; } u.accessflags = (byte)uao; return(u); }