private void btnSave_Click(object sender, EventArgs e) { SenpaApi agent = new SenpaApi(); using (new OperationContextScope(agent.context)) { string password = ""; if (chkDefaultPassword.Checked) { password = agent.operation.DefaultPassword(); } else { password = txtPassword.Text; } senpa.UserActionResponse response = agent.operation.AddUser(txtUsername.Text, password, Globals.GetComboBoxValue(cmbStakeholder), cmbRoleGroups.Text, txtName.Text, txtSurname.Text, txtEmail.Text, txtMobile.Text, chkPasswordExpires.Checked, chkActive.Checked, chkLocked.Checked); if (response.actionStatus) { txtName.Text = ""; txtSurname.Text = ""; txtUsername.Text = ""; txtEmail.Text = ""; txtMobile.Text = ""; txtPassword.Text = ""; } else { MessageBox.Show(response.responseMessage); } } }
private void chkExpires_CheckedChanged(object sender, EventArgs e) { SenpaApi agent = new SenpaApi(); using (new OperationContextScope(agent.context)) { senpa.UserActionResponse response = agent.operation.UpdateUser(SEnPAMain.currentUsername, ((chkExpires.Checked) ? "expire" : "notexpire")); chkExpires.Checked = response.actionStatus; } }