public void SetUserType(string username, string txttype) { CreateRoot(); Int32 type = 0; if (txttype == "本地认证") { type = 1; } else { type = 0; } bool authType = false; if (type == 0) { authType = true; } else if (type == 1) { authType = false; } try { UserAuthObj.SetUserAuthType(username, authType); } catch (Exception ex) { } }
protected void SetUserAuthTypes(bool authType) { try { this.manageResultTextBox.Clear(); foreach (DataGridViewRow row in allUserListDataGridView.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { if (UserAuthObj.QueryUserAuthType(row.Cells[2].Value.ToString()) == authType) { this.manageResultTextBox.Text += row.Cells[1].Value.ToString() + " 没有变化." + Environment.NewLine; } else { UserAuthObj.SetUserAuthType(row.Cells[2].Value.ToString(), authType); this.manageResultTextBox.Text += row.Cells[1].Value.ToString() + " 设置成功." + Environment.NewLine; } } } } catch (COMException ex) { this.manageResultTextBox.Text = ex.Message; } finally { LoadAllRtxUsers(); } }