This repository was archived by the owner on Dec 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormAccountSettings.cs
More file actions
61 lines (55 loc) · 2.11 KB
/
FormAccountSettings.cs
File metadata and controls
61 lines (55 loc) · 2.11 KB
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
using CodeForger.CodeForgerDBDataSetTableAdapters;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CodeForger
{
public partial class FormAccountSettings : Form
{
public FormAccountSettings()
{
InitializeComponent();
this.BackgroundImage = Properties.Resources.fundal;
}
private void buttonChangePassword_Click(object sender, EventArgs e)
{
UsersTableTableAdapter adapter = new UsersTableTableAdapter();
CodeForgerDBDataSet.UsersTableDataTable data = adapter.GetData();
int accID = Properties.Settings.Default.AccountLogin;
if (string.Equals(data[accID][3].ToString(), textBoxOldPassword.Text))
{
data[accID][3] = textBoxNewPassword.Text;
adapter.Update(data);
MessageBox.Show("Password updated successfully!");
textBoxOldPassword.Text = "";
textBoxNewPassword.Text = "";
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void buttonDeleteAccount_Click(object sender, EventArgs e)
{
var result = MessageBox.Show("Are you sure you want to delete your account?", "Confirm Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
UsersTableTableAdapter adapter = new UsersTableTableAdapter();
CodeForgerDBDataSet.UsersTableDataTable data = adapter.GetData();
int accID = Properties.Settings.Default.AccountLogin;
data[accID].Delete();
adapter.Update(data);
Properties.Settings.Default.AccountLogin = -1;
Properties.Settings.Default.RememberAccount = false;
Properties.Settings.Default.Save();
this.Close();
}
}
}
}