private void editAcctButtonItem_Click(object sender, EventArgs e) { if (mysql != null && accountsComboBoxItem.SelectedIndex != -1) { using (var editAcct = new EditAccount()) { editAcct.AccountModified += editAcct_AccountModified; Dictionary<string, List<string>> acctDict = mysql.ReadAll(Settings.Default.AuthDB, "account", new[] { "username" }, new[] { accountsComboBoxItem.SelectedItem. ToString() }); if (acctDict.ContainsKey("username")) { if (acctDict["username"].Count == 1) { editAcct.accountName = acctDict["username"][0]; int id = 0; if (acctDict.ContainsKey("id")) int.TryParse(acctDict["id"][0], out id); int expansion = 0; if (acctDict.ContainsKey("expansion")) int.TryParse(acctDict["expansion"][0], out expansion); editAcct.expansion = expansion; Dictionary<string, List<string>> accessDict = mysql.ReadAll(Settings.Default.AuthDB, "account_access", new[] { "id" }, new[] { id.ToString() }); if (accessDict.ContainsKey("gmlevel")) { if (accessDict["gmlevel"].Count == 1) { int gmLevel = 0; int.TryParse(accessDict["gmlevel"][0], out gmLevel); editAcct.gmLevel = gmLevel; } } editAcct.ShowDialog(); } } } } }
private void editAccountButton_Click(object sender, EventArgs e) { EditAccount editAccount = new EditAccount(); editAccount.ShowDialog(); }
private void editAcct_AccountModified(object sender, EditAccount.AccountModifiedEventArgs e) { SendToServer(String.Format("{0} {1} {2} -1", Constants.SetGMLevel, e.accountName, e.gmLevel)); if (e.password != String.Empty) SendToServer(String.Format("{0} {1} {2} {3}", Constants.SetAcctPassword, e.accountName, e.password, e.password)); SendToServer(String.Format("{0} {1} {2}", Constants.SetExpansion, e.accountName, e.expansion)); }