forked from evemuproject/evemu_control_panel_v2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAcctEdit.cs
83 lines (75 loc) · 3 KB
/
AcctEdit.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace EveControlPanelApplication
{
public partial class acctEditForm : Form
{
//roles list
private const long DEV = 5003499186008621056L;
private const long PLAYER = 6917529027641081856L;
public acctEditForm()
{
InitializeComponent();
}
private void createAccountButton_Click(object sender, EventArgs e)
{
if (usernameTX.Text != "" && passwordTX.Text != "" && userList.SelectedValue != "")
{
try
{
if (userList.SelectedIndex == 0) //Dev account
{
DBConnect.SQuery("INSERT INTO account (accountID, accountName, role, password, banned, online)" +
"VALUES (NULL, '" + usernameTX.Text + "', " + DEV + ", '" + passwordTX.Text + "', 0, 0)");
MessageBox.Show("Dev account added!");
}
else if (userList.SelectedIndex == 1) //Player account
{
DBConnect.SQuery("INSERT INTO account (accountID, accountName, role, password, banned, online)" +
"VALUES (NULL, '" + usernameTX.Text + "', " + PLAYER + ", '" + passwordTX.Text + "', 0, 0)");
MessageBox.Show("Player account added!");
}
}
catch (InvalidExpressionException)
{
MessageBox.Show("Error: You might not have installed MySql, please make you have done so.", "Error");
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message, "Error");
}
}
}
private void search_Click(object sender, EventArgs e)
{
try
{
DataTable data = new DataTable();
data = DBConnect.AQuery("SELECT accountID, accountName, role, banned, logonCount `online` FROM account WHERE accountName like '" + usernameFindTX.Text + "%';");
userDataList.DataSource = data;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void delCheckedButton_Click(object sender, EventArgs e)
{
try
{
DBConnect.SQuery("DELETE FROM account WHERE accountName='" + userDataList.CurrentCell.Value + "'");
userDataList.Rows.Remove(userDataList.CurrentRow);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}