private void metroButton1_Click(object sender, EventArgs e) { CarRequest request = new CarRequest(); request.time = TbTime.Text; request.reason = TbReason.Text; request.address = TbAddress.Text; loginEnt user = new loginEnt(); if (TbTime.Text == "") { MessageBox.Show("Time required!", "Add Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (TbReason.Text == "") { MessageBox.Show("Reason required!", "Add validation", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (TbAddress.Text == "") { MessageBox.Show("Address required!", "Add validation", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { user.username = Login.username; bool b = requestRepo.AddRequest(request, user); if (b == true) { MessageBox.Show("Request add Successful"); UserDash management = new UserDash(); management.Show(); this.Hide(); } else { MessageBox.Show("Request add Failed!", "Login Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void btnLogin_Click(object sender, EventArgs e) { loginEnt login = new loginEnt(); login.username = tbUser.Text; login.password = tbPassword.Text; login.userTypeAdmin = a; login.userTypeUser = z; login.userTypeExe = y; CurrentUserValue currentUser = new CurrentUserValue(); currentUser.currentUser = tbUser.Text; username = tbUser.Text; if (tbUser.Text == "") { MessageBox.Show("Username required!", "Login Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (tbPassword.Text == "") { MessageBox.Show("Password required!", "Login validation", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { bool b = loginRepo.LoginAdmin(login); bool c = userRepo.UserLogin(login); bool f = exeRepo.ExLogin(login); bool d = cUser.CurrentUserStore(currentUser); if (c == true && d == true) { MessageBox.Show("Login Successful admin"); this.Hide(); DashboardAdmin management = new DashboardAdmin(); management.Show(); this.Hide(); } else if (b == true && d == true) { MessageBox.Show("Login Successful User"); this.Hide(); UserDash dashboard = new UserDash(); dashboard.Show(); } else if (f == true && d == true) { MessageBox.Show("Login Successful Exe"); this.Hide(); ExeDash exedashboard = new ExeDash(); exedashboard.Show(); } else { MessageBox.Show("Login Failed!", "Login Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }