-
Notifications
You must be signed in to change notification settings - Fork 0
/
Login_Form.cs
60 lines (58 loc) · 1.8 KB
/
Login_Form.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
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;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace IDMB_project
{
public partial class Login_Form : Form
{
public static bool is_logged_in = false;
public static int logged_in_user_id;
public Login_Form()
{
InitializeComponent();
}
//login button is pressed
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "admin" && textBox2.Text == "admin")
{
this.Hide();
Admin_Menu_Form admin_form = new Admin_Menu_Form();
admin_form.ShowDialog();
this.Close();
}
else
{
bool user_is_valid = false;
foreach(string i in Menu_Form.users_name_password_dictionary.Keys)
{
if(i == textBox1.Text && Menu_Form.users_name_password_dictionary[i] == textBox2.Text)
{
user_is_valid = true;
logged_in_user_id = Menu_Form.users_name_id_dictionary[i];
break;
}
}
if (!user_is_valid)
{
MessageBox.Show("username or password is incorrect");
}
else
{
is_logged_in = true;
this.Hide();
Browse_Movie choose_form = new Browse_Movie();
choose_form.ShowDialog();
this.Close();
}
}
}
}
}