Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btn_AdminReg_Click(object sender, EventArgs e)
- {
- this.Hide();
- Admin_Login login = new Admin_Login(1);
- login.Show();
- }
- public partial class Admin_Login : MetroFramework.Forms.MetroForm
- {
- int separator; // this is used to separate different logins
- public Admin_Login(int value)
- {
- InitializeComponent();
- separator = value;
- }
- //------- Legend ---------
- //if separator= 1 : AdminTerminal
- //if separator= 2 : UpdatingTerminal
- //if separator= 3 : View Registration
- //if separator= 4 : Registration
- //if separator= 5 : Reports
- //if separator= 6 : Cancel Union
- static string path = Path.GetFullPath(Environment.CurrentDirectory);
- static string dataBaseName = "Trade_Union_Registration.mdf";
- private void btn_Login_Click(object sender, EventArgs e)
- {
- if (separator == 1)
- {
- Data getTable = new Data();
- DataTable table = getTable.GetData("select UserName,Password from SuperUser where UserName='" + txt_UserName.Text + "' and Password='" + txt_Password.Text + "'");
- if (table.Rows.Count == 1)
- {
- this.Hide();
- TerminalAdmin AdminTerminal = new TerminalAdmin();
- AdminTerminal.Show();
- }
- else
- {
- MetroFramework.MetroMessageBox.Show(this, "Invalid Username/Password please check your Username and Password and try again.", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error);
- txt_Password.Clear();
- }
- }
- else if (separator == 2)
- {
- Data getTable = new Data();
- DataTable table = getTable.GetData("select UserName,Password from Admin_Table where UserName='" + txt_UserName.Text + "' and Password='" + txt_Password.Text + "'");
- if (table.Rows.Count == 1)
- {
- Data getter = new Data();
- DataTable dt = getter.GetData("select UserID from Admin_Table where UserName='" + txt_UserName.Text + "'");
- MessageBox.Show(dt.Rows[0][0].ToString());
- this.Hide();
- Updating form = new Updating(dt.Rows[0][0].ToString(), txt_UserName.Text);
- form.Show();
- }
Add Comment
Please, Sign In to add comment