-
Notifications
You must be signed in to change notification settings - Fork 2
/
Signup.cs
109 lines (82 loc) · 2.87 KB
/
Signup.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
namespace hackathon1
{
public partial class Signup : Form
{
public Signup()
{
InitializeComponent();
Utility.load_users();
}
private void label5_Click(object sender, EventArgs e)
{
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
string username = textBox1.Text;
string email = textBox2.Text;
string password = textBox3.Text;
string ConfirmPass = textBox4.Text;
int count = password.Length;
if (Utility.users.Count > 0)
{
foreach (User u in Utility.users)
{
if (u.username != username)
{
if (password == ConfirmPass)
{
string path = @"C:\Users\User\Downloads\hackathon\bin\Debug\form\TextFile1.txt";
StreamWriter sw = File.AppendText(path);
User uu = new User(username, email, password);
Utility.users.Add(uu);
string ss = $"{username},{email},{password}";
sw.WriteLine(ss);
sw.Close();
Login lf = new Login();
lf.Show();
this.Hide();
}
else
{
MessageBox.Show("Passwords do not match");
}
}
else
{
MessageBox.Show("Username exists. Try another");
}
}
}
else
{
string path = "TextFile1.txt";
StreamWriter sw = File.AppendText(path);
User uu = new User(username, email, password);
Utility.users.Add(uu);
string ss = $"{username},{email},{password}";
sw.WriteLine(ss);
sw.Close();
Login lf = new Login();
lf.Show();
this.Hide();
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}